Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Symbol not found: _clock_gettime on MacOs 10.11

Symbol not found: _clock_gettime on MacOs 10.11

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 3 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dimitar
    wrote on last edited by
    #1

    Hi,

    I build my app with on my MacOS 10.12 MacBook. I use the following directive in the build:

    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8

    I expect that the resulting binary will be compatible with versions 10.8+. When I run it on MacOS 10.11 however, I get this crash:

    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_BREAKPOINT (SIGTRAP)
    Exception Codes:       0x0000000000000002, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Dyld Error Message:
      Symbol not found: _clock_gettime
      Referenced from: /Applications/Splinter.app/Contents/MacOS/splinter
      Expected in: /usr/lib/libSystem.B.dylib
    

    After doing some research, it looks like clock_gettime was added in 10.12 but doesn't exist in 10.11.

    Why didn't my build fail, having set my deployment target as 10.8?

    How can I ensure my binary is backwards compatible?

    Sample compilation output:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.8 -O2 -g -std=gnu++11 -Wall -W -fPIC -DRELEASE_BUILD -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_NO_INFO_OUTPUT -DQT_NO_WARNING_OUTPUT -DBUILD_VERSION=4444 -DMINOR_VERSION=0 -DMAJOR_VERSION=1 -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../splinter -I. -I../includes/boost_1_55_0/include  -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtGui.framework/Headers -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/mkspecs/macx-clang -F/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib -o main.o ../main.cpp
    
    A 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The "easiest" solution would be to build your application with an older macOS SDK.

      To avoid this problem, creating a virtual machine with e.g. 10.9 and using the matching latest version of Xcode works pretty well.

      Not ideal, but currently nothing Qt can do anything about.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      1
      • D dimitar

        Hi,

        I build my app with on my MacOS 10.12 MacBook. I use the following directive in the build:

        QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8

        I expect that the resulting binary will be compatible with versions 10.8+. When I run it on MacOS 10.11 however, I get this crash:

        Crashed Thread:        0  Dispatch queue: com.apple.main-thread
        
        Exception Type:        EXC_BREAKPOINT (SIGTRAP)
        Exception Codes:       0x0000000000000002, 0x0000000000000000
        Exception Note:        EXC_CORPSE_NOTIFY
        
        Dyld Error Message:
          Symbol not found: _clock_gettime
          Referenced from: /Applications/Splinter.app/Contents/MacOS/splinter
          Expected in: /usr/lib/libSystem.B.dylib
        

        After doing some research, it looks like clock_gettime was added in 10.12 but doesn't exist in 10.11.

        Why didn't my build fail, having set my deployment target as 10.8?

        How can I ensure my binary is backwards compatible?

        Sample compilation output:

        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.8 -O2 -g -std=gnu++11 -Wall -W -fPIC -DRELEASE_BUILD -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_NO_INFO_OUTPUT -DQT_NO_WARNING_OUTPUT -DBUILD_VERSION=4444 -DMINOR_VERSION=0 -DMAJOR_VERSION=1 -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../splinter -I. -I../includes/boost_1_55_0/include  -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtGui.framework/Headers -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/Users/dimitarz/Qt5.7.1/5.7/clang_64/mkspecs/macx-clang -F/Users/dimitarz/Qt5.7.1/5.7/clang_64/lib -o main.o ../main.cpp
        
        A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        @dimitar Yea that pretty much comes down to knowing what things are added in which versions.

        The way I deal with this is to make sure I test in my lowest targeted environment and my highest. I get lazy and skip the middle ones.

        I tend to work on cutting edge so I get these types of issues a lot when I use old compilers or OSes. To get around it, just test on each environment and use the lowest common function that will work on all platforms.

        Funny thing is the last time I had an issue like this it was in using the new C++ clock functions that the older g++ didn't support. Clock stuff must have changed a lot recently, lol.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          The "easiest" solution would be to build your application with an older macOS SDK.

          To avoid this problem, creating a virtual machine with e.g. 10.9 and using the matching latest version of Xcode works pretty well.

          Not ideal, but currently nothing Qt can do anything about.

          D Offline
          D Offline
          dimitar
          wrote on last edited by
          #4

          @SGaist @ambershark thank you for the answers, I suspected I'd have to test on the lower versions.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved