mnalis / ironseed_fpc

Iron Seed is a science-fiction DOS game from 1994, which was both developed and published by Channel 7. Gameplay is real-time, featuring trading, diplomacy, and strategy. This version has been changed to make it possible to compile it with the freepascal compiler under Linux.
GNU General Public License v3.0
17 stars 0 forks source link

FTBFS on armel (undefined reference to symbol '__aeabi_d2iz@@GCC_3.5') #88

Open mnalis opened 3 years ago

mnalis commented 3 years ago

Fails to build from source: https://buildd.debian.org/status/package.php?p=ironseed This has extra error in comparison to armhf & arm64

(9015) Linking is
is.pas(86,1) Warning: (9034) "crtbeginS.o" not found, this will probably cause a linking failure
is.pas(86,1) Warning: (9034) "crtendS.o" not found, this will probably cause a linking failure
/usr/bin/ld.bfd: c_utils.o: undefined reference to symbol '__aeabi_d2iz@@GCC_3.5'
/usr/bin/ld.bfd: /lib/arm-linux-gnueabi/libgcc_s.so.1: error adding symbols: DSO missing from command line
is.pas(86,1) Error: (9013) Error while linking
is.pas(86,1) Fatal: (10026) There were 3 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode
make[2]: *** [Makefile:81: is] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j1 "INSTALL=install --strip-program=true" prefix=/usr libdir=/usr/libexec/ironseed returned exit code 2
make[1]: *** [debian/rules:14: override_dh_auto_build] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:8: binary-arch] Error 2
mnalis commented 3 years ago

In addition to warning aborting compilation (reported in https://github.com/mnalis/ironseed_fpc/issues/87) this has issues as fpc does not seem to link libgcc_s, which is needed on some architectures do divide double precision floating point numbers.

Also, just adding -lgcc_s does not work as it then breaks on x86_64, for example. Linking only when needed with --as-needed also does not work due to position in linker script where fpc puts it.

More related information:

mnalis commented 3 years ago

now it compiles as we manually bruteforce calculated library path and force linking with libgcc_s, but that makes required shared lib that should not be needed (on other architectures, like armhf, dpkg-shlibdeps warns against it.)

Ideally, we'd find out how to sort libraries so -lgcc_s is only --as-needed. Alternatively, but less cleanly, we can modify makefile to detect hardcoded architectures that need libgcc_s and set FORCE_LIBGCC=1 and add it to linker flags only if required (and add the error to the docs so people compiling will know if they need it elsewhere).