CLANG linker returning "illegal text-relocation to..." for x64

  • Hi,

    I just moved to Lion and its new XCode 4. I'm calling the compiler
    directly, so no XCode processing. I basically cloned the way XCode uses the
    compiler. For x86 everything works just fine, in fact CLANG seems to have
    the same options as GCC used before. But with x64 it ends up with weird
    linking errors:

    ld: illegal text-relocation to ___stdoutp in /Applications/Xcode.app/
    Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libSystem.dylib
    from __ZN5MFile9SetStdoutERK7MString in !temp/debugDebug1/test/mlibrary.o
    for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see
    invocation)

    I'm really desperate here as I have no idea what causes this and no options
    seemed to help it. The calling script is below.

    Thanks in advance!
    Vojtech

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    "-D MKERNELONLYMINIMAL" "-D MNOASSEMBLER" "-D TEST" "-D _DEBUG" "-D
    MPROJECTNAME=test" -D MPROJECTNAMESTRING=\"test\" "-D MUNICODE" "-D MNOJPG"
    "-D MNOGIF" "-D MNOTIFF" "-D MINTELIPP" -arch x86_64 -g
    -I/Volumes/Data/Programming/MLibrary/library/freetype/include
    -I/Volumes/Data/Programming/MLibrary/library/zlib
    -I/Volumes/Data/Programming/MLibrary/library/libpng
    -I/Volumes/Data/Programming/MLibrary/library/bzip2
    -I/Volumes/Data/Programming/MLibrary/library/vstsdk3
    -I/Volumes/Data/Programming/MLibrary/library/flac/include
    -I/Volumes/Data/Programming/MLibrary/library/flac/src/libFLAC/include
    -I/opt/intel/ipp/include -I/opt/intel/ipp/include
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include
    -I. -c -fvisibility=hidden -fpascal-strings -fasm-blocks -Wno-trigraphs
    -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type
    -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors
    -Wformat -Wno-missing-braces -Wparentheses -Wno-switch -Wno-unused-function
    -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable
    -Wno-unused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow
    -Wno-four-char-constants -Wno-sign-compare -Wshorten-64-to-32
    -Wno-newline-eof -Wc++11-extensions -Wdeprecated-declarations
    -Winvalid-offsetof -Wno-conversion -Wno-sign-conversion -Wno-comment
    -Wno-tautological-compare "-Wno-#pragma messages" -isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
    -mmacosx-version-min.6 -I/Volumes/Data/Programming/MLibrary
    -I/Volumes/Data/Programming/MLibrary/projects/test2/test -x c++
    test/test.cpp -o !temp/debugDebug1/test/test.o

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    "-D MKERNELONLYMINIMAL" "-D MNOASSEMBLER" "-D TEST" "-D _DEBUG" "-D
    MPROJECTNAME=test" -D MPROJECTNAMESTRING=\"test\" "-D MUNICODE" "-D MNOJPG"
    "-D MNOGIF" "-D MNOTIFF" "-D MINTELIPP" -arch x86_64 -g
    -I/Volumes/Data/Programming/MLibrary/library/freetype/include
    -I/Volumes/Data/Programming/MLibrary/library/zlib
    -I/Volumes/Data/Programming/MLibrary/library/libpng
    -I/Volumes/Data/Programming/MLibrary/library/bzip2
    -I/Volumes/Data/Programming/MLibrary/library/vstsdk3
    -I/Volumes/Data/Programming/MLibrary/library/flac/include
    -I/Volumes/Data/Programming/MLibrary/library/flac/src/libFLAC/include
    -I/opt/intel/ipp/include -I/opt/intel/ipp/include
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include
    -I. -c -fvisibility=hidden -fpascal-strings -fasm-blocks -Wno-trigraphs
    -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type
    -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors
    -Wformat -Wno-missing-braces -Wparentheses -Wno-switch -Wno-unused-function
    -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable
    -Wno-unused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow
    -Wno-four-char-constants -Wno-sign-compare -Wshorten-64-to-32
    -Wno-newline-eof -Wc++11-extensions -Wdeprecated-declarations
    -Winvalid-offsetof -Wno-conversion -Wno-sign-conversion -Wno-comment
    -Wno-tautological-compare "-Wno-#pragma messages" -isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
    -mmacosx-version-min.6 -I/Volumes/Data/Programming/MLibrary
    -I/Volumes/Data/Programming/MLibrary/projects/test2/test -x objective-c++
    /Volumes/Data/Programming/MLibrary/mlibrary/mlibrarymac.mm -o
    !temp/debugDebug1/test/mlibrarymac.o

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    "-D MKERNELONLYMINIMAL" "-D MNOASSEMBLER" "-D TEST" "-D _DEBUG" "-D
    MPROJECTNAME=test" -D MPROJECTNAMESTRING=\"test\" "-D MUNICODE" "-D MNOJPG"
    "-D MNOGIF" "-D MNOTIFF" "-D MINTELIPP" -arch x86_64 -g
    -I/Volumes/Data/Programming/MLibrary/library/freetype/include
    -I/Volumes/Data/Programming/MLibrary/library/zlib
    -I/Volumes/Data/Programming/MLibrary/library/libpng
    -I/Volumes/Data/Programming/MLibrary/library/bzip2
    -I/Volumes/Data/Programming/MLibrary/library/vstsdk3
    -I/Volumes/Data/Programming/MLibrary/library/flac/include
    -I/Volumes/Data/Programming/MLibrary/library/flac/src/libFLAC/include
    -I/opt/intel/ipp/include -I/opt/intel/ipp/include
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include
    -I. -c -fvisibility=hidden -fpascal-strings -fasm-blocks -Wno-trigraphs
    -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type
    -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors
    -Wformat -Wno-missing-braces -Wparentheses -Wno-switch -Wno-unused-function
    -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable
    -Wno-unused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow
    -Wno-four-char-constants -Wno-sign-compare -Wshorten-64-to-32
    -Wno-newline-eof -Wc++11-extensions -Wdeprecated-declarations
    -Winvalid-offsetof -Wno-conversion -Wno-sign-conversion -Wno-comment
    -Wno-tautological-compare "-Wno-#pragma messages" -isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
    -mmacosx-version-min.6 -I/Volumes/Data/Programming/MLibrary
    -I/Volumes/Data/Programming/MLibrary/projects/test2/test -x c++
    /Volumes/Data/Programming/MLibrary/MLibrary/mlibrary.cpp -o
    !temp/debugDebug1/test/mlibrary.o

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
    -arch x86_64 !temp/debugDebug1/test/test.o
    !temp/debugDebug1/test/mlibrarymac.o !temp/debugDebug1/test/mlibrary.o
    -isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
    -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
    -mmacosx-version-min.6 -L/Volumes/Data/Programming/MLibrary/library
    -L/Volumes/Data/Programming/MLibrary/projects/test2
    -L/Volumes/Data/Programming/MLibrary/projects/test2/!temp/debugDebug1
    -L/Volumes/Data/Programming/MLibrary/projects/test2/!outputdebugx64
    -L/opt/intel/ipp/lib -lmlibraryasm_x64_debug -lfreetype_x64_debug
    -lzlib_x64_debug -llibpng_x64_debug -lbzip2_x64_debug -llibflac_x64_debug
    -lippcore_l -lipps_l -lippi_l -lippvm_l -lippcore_t -lipps_t -lippi_t
    -lippvm_t
    -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/lib
    -framework Carbon -framework Cocoa -framework AudioUnit -framework
    CoreAudio -framework CoreMIDI -framework CoreServices -framework
    AudioToolbox -framework IOKit -framework Security -Wl,-no_compact_unwind -o
    !outputdebugx64/test.app/Contents/MacOS/test.bin
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today