Resolved Error symbol(s) not found for architecture x86_64

Discussion in 'Mac Programming' started by Amott, Jul 22, 2016.

  1. Amott macrumors newbie

    Amott

    Joined:
    Jul 22, 2016
    #1
    Hi everybody,

    I am working on a project that consist in compiling a Windows application on Mac. The application is written in C++ with Qt. It is composed with libraries and the main project :
    http://hpics.li/d8bb2ec
    The project uses an external library, ODA, to manage .dwg and .dgn files.
    The problem is when I compile the first library (MdCore), I get an error : symbol(s) not found for architecture x86_64.
    At first I added -stdlib=libstdc++ to qmake argument but Qt generated me 0 byte files, so it was not the solution.
    I have tried different version of the ODA libary : 32bit, 64bit for OSX 10.7 and 10.11. (My Mac is on OSX 10.11)
    I made the command "file" on my libraries and here the output :

    <ervery ODA lib> :
    <lib>.a: current ar archive random library

    <other lib on /usr/lib>.dylib :
    Mach-0 universal binary with 2 architectures
    (for architecture x68_64): Mach-0 64-bit dynamically linked shared library x86_64
    (for architecture i386): Mach-0 dynamically linked shared library i386

    I have tried to compile on 32 and 64bit but it does not change anything. I am on this problem for two weeks I don't know what I can do :(

    I have made a topic on the Qt forum maybe you can find more information :
    https://forum.qt.io/topic/69171/compile-generate-0-byte-files-on-os-x/11

    If someone have a clue or a solution I will be interested :)

    Thanks !
     
  2. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #2
    I don't know anything about qmake but maybe you should just post what your compiler commands are to compile and maybe someone will be able to see what is wrong.
     
  3. Amott thread starter macrumors newbie

    Amott

    Joined:
    Jul 22, 2016
    #3
    hi cqexbesd, thanks for your answer, here is the beginning of the build output :

    17:34:10: Begin : "/Users/developpement/Qt/5.7/clang_64/bin/qmake" /Users/developpement/Desktop/Mediacad2/MdCore/MdCore.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug

    17:34:10: The process "/Users/developpement/Qt/5.7/clang_64/bin/qmake" has finished normally

    17:34:10: Begin : "/usr/bin/make"

    ...
     
  4. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #4
    What I meant was the qmake is just a tool for calling the compiler. Can you find the line where qmake calls the compiler?Presumably it's not calling it correctly or things would be working. Its at least somewhere to start.
     
  5. Amott, Jul 25, 2016
    Last edited by a moderator: Jul 25, 2016

    Amott thread starter macrumors newbie

    Amott

    Joined:
    Jul 22, 2016
    #5
    I think it's here :
    Code:
    Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.8 -Wall -W -fPIC -DMDCORE_LIBRARY -D_TOOLKIT_IN_DLL_ -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../MdCore -I. -I../../include -I../../include/teigha -I../../include/Extensions/ExServices -I../../include/Extensions/win -I../../include/Extensions/win/Crypt -I../../../../Qt/5.7/clang_64/lib/QtWidgets.framework/Headers -I../../../../Qt/5.7/clang_64/lib/QtGui.framework/Headers -I../../../../Qt/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I../../../../Qt/5.7/clang_64/mkspecs/macx-clang -F/Users/developpement/Qt/5.7/clang_64/lib -o mduserio.o ../../MdCore/mduserio.cpp
    in my compilation output I have those lines several time, but only the last line changes (the name of the file changes)

    Edit : here are the same lines but with spaces between them
    Code:
    Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c
    -pipe
    -stdlib=libc++
    -g
    -std=gnu++11
    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
    -mmacosx-version-min=10.8
    -Wall
    -W
    -fPIC
    -DMDCORE_LIBRARY
    -D_TOOLKIT_IN_DLL_
    -DQT_QML_DEBUG
    -DQT_WIDGETS_LIB
    -DQT_GUI_LIB -DQT_CORE_LIB
    -I../../MdCore
    -I.
    -I../../include
    -I../../include/teigha
    -I../../include/Extensions/ExServices
    -I../../include/Extensions/win
    -I../../include/Extensions/win/Crypt -I../../../../Qt/5.7/clang_64/lib/QtWidgets.framework/Headers -I../../../../Qt/5.7/clang_64/lib/QtGui.framework/Headers -I../../../../Qt/5.7/clang_64/lib/QtCore.framework/Headers
    -I.
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers
    -I../../../../Qt/5.7/clang_64/mkspecs/macx-clang
    -F/Users/developpement/Qt/5.7/clang_64/lib
    -o mduserio.o ../../MdCore/mduserio.cpp
     
  6. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #6
    There should also be a linking line - e.g. a line where clang++ is called without the -c argument. It might be useful if you can paste a link to the entire output in fact.
     
  7. Amott, Jul 26, 2016
    Last edited by a moderator: Jul 26, 2016

    Amott thread starter macrumors newbie

    Amott

    Joined:
    Jul 22, 2016
    #7
    I don't think it's possible to change arguments of the compiler. I may do it with the prompt.
    Here is the full output (it's very very long ! 100.000 lines) : http://textup.fr/171939hC


    Edit : I compiled with the prompt so I have more lines on the output, and the last lines are interesting :


    Undefined symbols for architecture x86_64:

    Code:
      "_CFArrayGetCount", referenced from:
    
          ExSystemServices::ExSystemServices() in ExSystemServices.o
    
      "_CFArrayGetValueAtIndex", referenced from:
    
          ExSystemServices::ExSystemServices() in ExSystemServices.o
    
      "_CFLocaleCopyPreferredLanguages", referenced from:
    
          ExSystemServices::ExSystemServices() in ExSystemServices.o
    
      "_CFStringGetCharacterAtIndex", referenced from:
    
          ExSystemServices::ExSystemServices() in ExSystemServices.o
    
      "_CFStringGetLength", referenced from:
    
          ExSystemServices::ExSystemServices() in ExSystemServices.o
    
    ld: symbol(s) not found for architecture x86_64
    
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    make: *** [../debug/libMdCore.1.0.0.dylib] Error 1
     
  8. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #8
    I think 100K output for a build from anything but the most complicated system is probably a sign that things have gone wrong somewhere - but that is a more general comment about the state of the industry.

    Back to your specific problem. I don't see the linking errors you posted in the "full output" however this looks just to be a regular linker errors. As on other platforms, you can use nm (or Google) to find where those symbols are defined and it appears to be in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation for me (but I have a very old mac so it may not be true for you).

    You wouldn't link against that library directly. Try adding
    Code:
    -framework CoreFoundation
    to your linker flags.
     
  9. Amott thread starter macrumors newbie

    Amott

    Joined:
    Jul 22, 2016
    #9
    Yes you are right !! Thank you so much I can compile now ! I was facing this problem for 3 weeks ! Thanks a lot !
     

Share This Page