devilutionX icon indicating copy to clipboard operation
devilutionX copied to clipboard

Haiku 64-bit Build Process Fails. "recompile with -fPIC"

Open reedlove opened this issue 2 years ago • 7 comments

Operating System

Other (please specify)

DevilutionX version

1.4.1 (latest release)

Describe

[ 89%] Linking CXX executable ../control_test /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccagzQFx.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZZN7testing8internal11MatcherBaseIRKSsE9GetVTableINS4_11ValuePolicyIPKNS_16MatcherInterfaceIS3_EELb1EEEEEPKNS4_6VTableEvE7kVTable' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status test/CMakeFiles/appfat_test.dir/build.make:112: recipe for target 'appfat_test' failed make[2]: *** [appfat_test] Error 1 CMakeFiles/Makefile2:1998: recipe for target 'test/CMakeFiles/appfat_test.dir/all' failed make[1]: *** [test/CMakeFiles/appfat_test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//cclQIk7m.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZTV24AnimationInfo_Stand_Test' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status test/CMakeFiles/animationinfo_test.dir/build.make:112: recipe for target 'animationinfo_test' failed make[2]: *** [animationinfo_test] Error 1 CMakeFiles/Makefile2:1964: recipe for target 'test/CMakeFiles/animationinfo_test.dir/all' failed make[1]: *** [test/CMakeFiles/animationinfo_test.dir/all] Error 2 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccGoJFTt.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZTV23Control_ClearPanel_Test' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status test/CMakeFiles/control_test.dir/build.make:112: recipe for target 'control_test' failed make[2]: *** [control_test] Error 1 CMakeFiles/Makefile2:2100: recipe for target 'test/CMakeFiles/control_test.dir/all' failed make[1]: *** [test/CMakeFiles/control_test.dir/all] Error 2 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccHcNktz.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZTV35Codec_codec_get_encoded_len_eq_Test' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status test/CMakeFiles/codec_test.dir/build.make:112: recipe for target 'codec_test' failed make[2]: *** [codec_test] Error 1 CMakeFiles/Makefile2:2066: recipe for target 'test/CMakeFiles/codec_test.dir/all' failed make[1]: *** [test/CMakeFiles/codec_test.dir/all] Error 2 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccU9rGeN.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZTV29Automap_AutomapZoomReset_Test' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status test/CMakeFiles/automap_test.dir/build.make:112: recipe for target 'automap_test' failed make[2]: *** [automap_test] Error 1 CMakeFiles/Makefile2:2032: recipe for target 'test/CMakeFiles/automap_test.dir/all' failed make[1]: *** [test/CMakeFiles/automap_test.dir/all] Error 2 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccNV32Jq.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol _ZN10devilution7dungeonE' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status CMakeFiles/devilutionx.dir/build.make:417: recipe for target 'devilutionx' failed make[2]: *** [devilutionx] Error 1 CMakeFiles/Makefile2:1139: recipe for target 'CMakeFiles/devilutionx.dir/all' failed make[1]: *** [CMakeFiles/devilutionx.dir/all] Error 2 Makefile:145: recipe for target 'all' failed make: *** [all] Error 2

To Reproduce

  1. cmake -S. -Bbuild -DVERSION_NUM=1.4.1 -DVERSION_SUFFIX=FFFFFFF -DCMAKE_BUILD_TYPE=Release -DDISABLE_ZERO_TIER=ON
  2. cmake --build build -j $(getconf _NPROCESSORS_ONLN)

Note: I utilized "-DDISABLE_ZERO_TIER=ON" as recommended for now, being that libzt causes the build process to fail as well, as of the 1.4.1 Release source code.

Expected Behavior

No response

Additional context

No response

reedlove avatar Aug 26 '22 16:08 reedlove

Could you try with -DBUILD_TESTING=OFF

Note that the libzt issue should be solved in latest master.

AJenbo avatar Aug 26 '22 18:08 AJenbo

No dice. XP

[100%] Linking CXX executable devilutionx /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//cc3Ro59W.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_ZN10devilution7dungeonE' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status CMakeFiles/devilutionx.dir/build.make:417: recipe for target 'devilutionx' failed make[2]: *** [devilutionx] Error 1 CMakeFiles/Makefile2:317: recipe for target 'CMakeFiles/devilutionx.dir/all' failed make[1]: *** [CMakeFiles/devilutionx.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2

reedlove avatar Aug 26 '22 20:08 reedlove

Did you try -DSDL_STATIC_PIC=ON?

AJenbo avatar Aug 26 '22 20:08 AJenbo

Possibly -DPIE=ON

AJenbo avatar Aug 26 '22 20:08 AJenbo

No dice.

cmake -S. -Bbuild -DVERSION_NUM=1.4.1 -DVERSION_SUFFIX=FFFFFFF -DCMAKE_BUILD_TYPE=Release -DDISABLE_ZERO_TIER=ON -DBUILD_TESTING=OFF -DSDL_STATIC_PIC=ON -DPIE=ON

cmake --build build -j $(getconf _NPROCESSORS_ONLN)

[100%] Linking CXX executable devilutionx /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: /tmp//ccZP6d9N.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_ZN10devilution7dungeonE' can not be used when making a shared object; recompile with -fPIC /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status CMakeFiles/devilutionx.dir/build.make:417: recipe for target 'devilutionx' failed make[2]: *** [devilutionx] Error 1 CMakeFiles/Makefile2:317: recipe for target 'CMakeFiles/devilutionx.dir/all' failed make[1]: *** [CMakeFiles/devilutionx.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2

reedlove avatar Aug 26 '22 23:08 reedlove

Why is it making a shared object? DevilutionX does not build any shared libs by default (when -DBUILD_TESTING=OFF). Is there something special about the Haiku linking process?

glebm avatar Aug 26 '22 23:08 glebm

So back in April, they made the following change to their port of GCC.

https://git.haiku-os.org/buildtools/commit/?h=btrev43193&id=493aaad4dc61224ff101425c283a36960fb6841b

  • /* PIE does not work on Haiku, but PIC does the right thing for position
    • independant executables. So if asked for PIE, do PIC instead.
  • */
  • if (flag_pie && !flag_pic)
  • flag_pic = flag_pie;
  • flag_pie = 0;

I've also tried with -DPIE=OFF and it still doesn't work correctly. Bear with me, while I certainly understand more than the average bear and have some practical programming experience, I've never really familiarized myself with the eccentricities of the various GNU build tools and their forks/variants. So I apologize if I'm not being super helpful. =]

reedlove avatar Aug 27 '22 14:08 reedlove