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. [SOLVED] Attempting to port to Qt5; but a linker error on OSX
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Attempting to port to Qt5; but a linker error on OSX

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 2.1k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    sethcall
    wrote on last edited by
    #1

    I'm trying to build a x86_64 application on MacOSX, using qmake/qt. I was able to compile in QT4, but not in QT5.

    Anyway, after running qmake to generate my makefiles etc:

    @qmake -recursive -spec macx-clang app.pro CONFIG+='release static'@

    Then when I run make, eventually I end up here:

    @/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -arch x86_64 -Wl,-dead_strip -framework Cocoa -framework Carbon -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -o [authors note: lots of .o files here] -L../lib -L../../debug -F/Users/seth/workspace/qt5.1.0//5.1.0/clang_64/lib -lprotobuf -framework Security -framework SecurityInterface -framework ApplicationServices -framework CoreFoundation -lxml2 -lbz2 -lxar -framework ScriptingBridge -L/Users/seth/workspace/qt5.1.0//5.1.0/clang_64/plugins/iconengines -lssl -lcrypto -lz -lFLAC -framework Carbon -framework QtWebKitWidgets -framework QtQuick -framework QtQml -framework QtNetwork -framework QtCore -framework QtGui -framework QtOpenGL -framework QtWidgets -framework QtPrintSupport -framework Cocoa -framework QtWebKit -framework QtSql -framework QtSensors -framework QtSvg -framework QtXml -framework OpenGL -framework AGL@
    and then error...

    @ld: '_ZN3Log16DebugE7QStringS3' in debug/Log.o contains undefined reference for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)@

    I do not understand what 'undefined reference for architecture x86_64' means, and that's certainly the heart of the problem. Upon reading some other threads, some suggest that the libraries I'm linking against aren't x86_64, but after checking and rechecking, I can't find any non-x86_64 libraries involved in the process.

    All my .o files from the build are Mach-O 64-bit object x86_64 after checking with the file command.

    And for all libraries that I'm trying to reference (like libcrypto, for instance):

    Non-fat file: ../lib/libcrypto.a is architecture: x86_64

    And of course all the mac framework libraries are both 32/64bit capable.

    Does anyone have any suggestions on how I could debug this further?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sethcall
      wrote on last edited by
      #2

      Been fiddling all day, found it.

      The method that the link is complaining about has this in it:

      qt_mac_execute_apple_script

      This method does not exist in qt5.

      (earlier in the file, I see this: extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);)

      if i comment these lines, the error goes away.

      So basically, a very bad compiler error for a missing symbol - because the compiler wasn't nice enough to point out what the actual problem is beyond the vague architecture statement; probably made worse because I'm building my application statically coupled with the extern.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        It's indeed a strange error.

        Since you're on OS X, you might be interested by the qtmacextras module, it will, on the long run, contain all the os x specific stuff.

        Since you found the solution, don't forget to update the thread's title to solved so other forum users will also know it.

        Happy coding :)

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

        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