Page MenuHomePhabricator

Atomic operations API used in CppMicroServices are deprecated in macOS Sierra 10.12.5
Closed, ResolvedPublic

Description

/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:203:5: error: 
      'OSAtomicIncrement64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic>
      instead [-Werror,-Wdeprecated-declarations]
    US_ATOMIC_INCREMENT(&m_Counter);
    ^
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:90:55: note: expanded from
      macro 'US_ATOMIC_INCREMENT'
        #define US_ATOMIC_INCREMENT(x)    IntType n = OSAtomicIncrement64Barrier(x)
                                                      ^
/usr/include/libkern/OSAtomicDeprecated.h:269:9: note: 'OSAtomicIncrement64Barrier' has been explicitly marked deprecated here
int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue );
        ^
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usSharedLibrary.cpp:22:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedLibrary.h:26:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedData.h:32:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usAtomicInt_p.h:27:
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:209:5: error: 
      'OSAtomicIncrement64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic>
      instead [-Werror,-Wdeprecated-declarations]
    US_ATOMIC_INCREMENT(&lval);
    ^
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:90:55: note: expanded from
      macro 'US_ATOMIC_INCREMENT'
        #define US_ATOMIC_INCREMENT(x)    IntType n = OSAtomicIncrement64Barrier(x)
                                                      ^
/usr/include/libkern/OSAtomicDeprecated.h:269:9: note: 'OSAtomicIncrement64Barrier' has been explicitly marked deprecated here
int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue );
        ^
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usSharedLibrary.cpp:22:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedLibrary.h:26:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedData.h:32:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usAtomicInt_p.h:27:
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:215:5: error: 
      'OSAtomicDecrement64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_sub() from <atomic>
      instead [-Werror,-Wdeprecated-declarations]
    US_ATOMIC_DECREMENT(&m_Counter);
    ^
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:91:55: note: expanded from
      macro 'US_ATOMIC_DECREMENT'
        #define US_ATOMIC_DECREMENT(x)    IntType n = OSAtomicDecrement64Barrier(x)
                                                      ^
/usr/include/libkern/OSAtomicDeprecated.h:288:9: note: 'OSAtomicDecrement64Barrier' has been explicitly marked deprecated here
int64_t OSAtomicDecrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue );
        ^
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usSharedLibrary.cpp:22:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedLibrary.h:26:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/include/usSharedData.h:32:
In file included from /Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usAtomicInt_p.h:27:
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:227:5: error: 
      'OSAtomicCompareAndSwap64Barrier' is deprecated: first deprecated in macOS 10.12 - Use
      std::atomic_compare_exchange_strong() from <atomic> instead [-Werror,-Wdeprecated-declarations]
    US_ATOMIC_ASSIGN(&lval, m_Counter);
    ^
/Users/dxr/Install/MITK/MITK-2016.03/Modules/CppMicroServices/core/src/util/usThreads_p.h:92:43: note: expanded from
      macro 'US_ATOMIC_ASSIGN'
        #define US_ATOMIC_ASSIGN(l, v)    OSAtomicCompareAndSwap64Barrier(*l, v, l)
                                          ^
/usr/include/libkern/OSAtomicDeprecated.h:645:9: note: 'OSAtomicCompareAndSwap64Barrier' has been explicitly marked deprecated
      here
bool    OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue,
        ^

Event Timeline

As suggested in the MITK mailinglist, one approach would be switching to cppMicroServices 3.x https://sourceforge.net/p/mitk/mailman/message/35879160/

Or any other suggestions? @nolden

Affected class usThreads_p.h is not available in cppMicroServices 3.x . Most likely it got replaced by 5Zhttps://github.com/CppMicroServices/CppMicroServices/blob/development/framework/include/cppmicroservices/detail/Threads.h

This branch does not yet compile since some paths to cppmicroservice include-files need to be updated:

  • GlobalConfig.h moved from MITK-build/Modules/CppMicroServices/framework/include to MITK-build/Modules/CppMicroServices/include/cppmicroservices
  • Header Search Paths are currently Modules/CppMicroServices/framework/include but should be extended to Modules/CppMicroServices/framework/include/cppmicroservices

However, CMake fixes to configure and generate MITK using cppmicroservices v3.1.0 works and is provided in the first commit of this pushed branch.

From the current state, this needs to be updated in MITK:

  • header includes from cppmicroservice (e.g. usSharedData is now called SharedData)
  • namespaces need to be renamed from us to cppmicroservice
  • a cppmicroservice module is now called bundle (rename Objects and class includes from us::Module to cppmicroservice::Bundle)

As suggested in the MITK mailinglist, one approach would be switching to cppMicroServices 3.x https://sourceforge.net/p/mitk/mailman/message/35879160/

Or any other suggestions? @nolden

Affected class usThreads_p.h is not available in cppMicroServices 3.x . Most likely it got replaced by 5Zhttps://github.com/CppMicroServices/CppMicroServices/blob/development/framework/include/cppmicroservices/detail/Threads.h

I just contacted @zelzer about this issue. CppMicroservices 3.1 are still missing the autoload feature we need in MITK. This can probably be implemented on the MITK side, but for now updating to 3.1 would break MITK functionalities.

Deleted branch T22929-cppMicroServices3-for-MITK.