Probleme beim Linken mit -m32 unter FreeBSD 11

Sickboy

Müßiggänger
Hallo allerseits,

unter FreeBSD 11 (amd64) möchte ich 32-bit executables bauen. Leider klappt das Linken nicht:
Code:
$ cmake -DCMAKE_CXX_COMPILER=clang++50 -DCMAKE_C_COMPILER=clang50 -DCMAKE_C_FLAGS="-m32 -B/usr/lib32" -DCMAKE_CXX_FLAGS="-m32 -B/usr/lib32" -DCMAKE_EXE_LINKER_FLAGS="-m32 -B/usr/lib32" ../
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/local/bin/clang50
-- Check for working C compiler: /usr/local/bin/clang50 -- broken
CMake Error at /usr/local/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/usr/local/bin/clang50"

  is not able to compile a simple test program.

  It fails with the following output:
    [...]
    Linking C executable cmTC_75ff8
    /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_75ff8.dir/link.txt --verbose=1
    /usr/local/bin/clang50 -m32 -B/usr/lib32     CMakeFiles/cmTC_75ff8.dir/testCCompiler.c.o  -o cmTC_75ff8 
    /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
Selbes Problem mit GCC 8. Weiß jemand Rat?
 
/usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc

Hast du libgcc in einer 32-Bit-Variante installiert?

Nachtrag: versuche mal -L/usr/lib32 statt -B/usr/lib32 in der Umgebungsvariable CMAKE_EXE_LINKER_FLAGS.

Rob
 
Zuletzt bearbeitet:
Da das Problem beim Linken auftritt, gehe ich davon aus, dass ich kein 32-bit libgcc brauche. Auch mit dem -L flag klappt es nicht.

Edit: Sorry, dass ich so dumm bin. War davon ausgegangen, dass lib32 installiert ist. War es natürlich nicht … Jetzt klappt es.
 
Zurück
Oben