Linker error with crt on OS X



  • I have a Qt Creator project (qmake) that contains a lot of C code (*.c files).
    I managed to compile the files. But linking is not working.
    The linker complains about crt1.10.6.o

    ld: library not found for -lcrt1.10.6.o
    

    The main part of the build output:

    11:56:01: Starte "/usr/bin/make" 
    /Users/Boot/Qt/5.5/clang_64/bin/qmake -spec macx-clang CONFIG+=debug CONFIG+=x86_64 -o Makefile ../QFreeRTOS/QFreeRTOS.pro
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -v -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/Users/Boot/Qt/5.5/clang_64/lib -o QFreeRTOS main_blinky.o croutine.o event_groups.o list.o queue.o tasks.o timers.o port.o   -F/Users/Boot/Qt/5.5/clang_64/lib -framework QtCore -framework DiskArbitration -framework IOKit 
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin15.2.0
    Thread model: posix
     "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -headerpad_max_install_names -macosx_version_min 10.7.0 -o QFreeRTOS -lcrt1.10.6.o -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -rpath /Users/Boot/Qt/5.5/clang_64/lib main_blinky.o croutine.o event_groups.o list.o queue.o tasks.o timers.o port.o -framework QtCore -framework DiskArbitration -framework IOKit -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a -F/Users/Boot/Qt/5.5/clang_64/lib
    ld: library not found for -lcrt1.10.6.o
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    I'm on Mac OS X 10.11.2
    using Qt 5.5.0

    Thx



  • I managed to fix this problem.
    There are two different aproaches:

    1. change qdevice.pri (<Qt_dir>/5.5/clang_64/mkspecs/qdevice.pri)
      add
    QMAKE_MAC_SDK = macosx10.11
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
    

    or

    1. Change project file (*.pro)
      add
    macx {
      # Build against latest platform SDK, deployable on OS X 10.8
      QMAKE_MAC_SDK = macosx10.11
      QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
    }
    

    Cheers


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Glad you found out and thanks for sharing !

    Please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)



  • Thank you for the hint about 'solved'.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.