Message ID | 20240916133057.1358143-1-buildroot@bubu1.eu |
---|---|
State | New |
Headers | show |
Series | package/python-sdbus: fix linking on aarch64 | expand |
On Mon, 16 Sep 2024 15:30:57 +0200 Marcus Hoffmann via buildroot <buildroot@buildroot.org> wrote: > The following config snippet fails to build on arm-aarch64. Adding -fPIC > to LDFLAGS fixes this. This has also been discussed upstream [1] > in the past without determining an exact reason/cause. FYI, I did some further research on this, and commented at: https://github.com/python-sdbus/python-sdbus/issues/50 Thomas
diff --git a/package/python-sdbus/python-sdbus.mk b/package/python-sdbus/python-sdbus.mk index 0b3ea37b30..5ed798fbe0 100644 --- a/package/python-sdbus/python-sdbus.mk +++ b/package/python-sdbus/python-sdbus.mk @@ -12,6 +12,7 @@ PYTHON_SDBUS_LICENSE = LGPL-2.1+ PYTHON_SDBUS_LICENSE_FILES = COPYING PYTHON_SDBUS_DEPENDENCIES = systemd +PYTHON_SDBUS_ENV += LDFLAGS=-fPIC ifeq ($(BR2_STATIC_LIBS),y) PYTHON_SDBUS_ENV += PYTHON_SDBUS_USE_STATIC_LINK=1 endif
The following config snippet fails to build on arm-aarch64. Adding -fPIC to LDFLAGS fixes this. This has also been discussed upstream [1] in the past without determining an exact reason/cause. Error repropduction: $ cat python-sdbus.config BR2_INIT_SYSTEMD=y BR2_PACKAGE_SYSTEMD=y BR2_PACKAGE_PYTHON3=y BR2_PACKAGE_PYTHON_SDBUS=y $ ./utils/test-pkg -p python-sdbus -c python-sdbus.config bootlin-armv5-uclibc [1/6]: SKIPPED bootlin-armv7-glibc [2/6]: OK bootlin-armv7m-uclibc [3/6]: SKIPPED bootlin-x86-64-musl [4/6]: SKIPPED br-arm-full-static [5/6]: SKIPPED arm-aarch64 [6/6]: FAILED $ tail -20 ~/br-test-pkg/arm-aarch64/logfile /home/marcus/br-test-pkg/arm-aarch64/host/bin/aarch64-none-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -I/home/marcus/br-test-pkg/arm-aarch64/build/python3-3.12.5/Include -I/home/marcus/br-test-pkg/arm-aarch64/build/python3-3.12.5 -c src/sdbus/sd_bus_internals_interface.c -o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_interface.o -flto /home/marcus/br-test-pkg/arm-aarch64/host/bin/aarch64-none-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -I/home/marcus/br-test-pkg/arm-aarch64/build/python3-3.12.5/Include -I/home/marcus/br-test-pkg/arm-aarch64/build/python3-3.12.5 -c src/sdbus/sd_bus_internals_message.c -o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_message.o -flto /home/marcus/br-test-pkg/arm-aarch64/host/bin/aarch64-none-linux-gnu-gcc -shared -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals.o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_bus.o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_funcs.o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_interface.o build/temp.linux-aarch64-cpython-312/src/sdbus/sd_bus_internals_message.o -L. -o build/lib.linux-aarch64-cpython-312/sdbus/sd_bus_internals.cpython-312-aarch64-linux-gnu.so -lsystemd -flto /home/marcus/br-test-pkg/arm-aarch64/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-none-linux-gnu/13.3.1/../../../../aarch64-none-linux-gnu/bin/ld: /tmp/ccMnk9xf.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `SdBus_async_callback' which may bind externally can not be used when making a shared object; recompile with -fPIC /tmp/ccMnk9xf.ltrans0.ltrans.o: in function `SdBus_call_async': <artificial>:(.text+0x1d50): dangerous relocation: unsupported relocation /home/marcus/br-test-pkg/arm-aarch64/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-none-linux-gnu/13.3.1/../../../../aarch64-none-linux-gnu/bin/ld: /tmp/ccMnk9xf.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_SdBus_match_signal_instant_callback' which may bind externally can not be used when making a shared object; recompile with -fPIC /tmp/ccMnk9xf.ltrans0.ltrans.o: in function `SdBus_match_signal_async': <artificial>:(.text+0x203c): dangerous relocation: unsupported relocation /home/marcus/br-test-pkg/arm-aarch64/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-none-linux-gnu/13.3.1/../../../../aarch64-none-linux-gnu/bin/ld: /tmp/ccMnk9xf.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_SdBus_signal_callback' which may bind externally can not be used when making a shared object; recompile with -fPIC <artificial>:(.text+0x2040): dangerous relocation: unsupported relocation /home/marcus/br-test-pkg/arm-aarch64/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-none-linux-gnu/13.3.1/../../../../aarch64-none-linux-gnu/bin/ld: /tmp/ccMnk9xf.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `SdBus_request_name_callback' which may bind externally can not be used when making a shared object; recompile with -fPIC /tmp/ccMnk9xf.ltrans0.ltrans.o: in function `SdBus_request_name_async': <artificial>:(.text+0x2310): dangerous relocation: unsupported relocation collect2: error: ld returned 1 exit status error: command '/home/marcus/br-test-pkg/arm-aarch64/host/bin/aarch64-none-linux-gnu-gcc' failed with exit code 1 ERROR Backend subprocess exited when trying to invoke build_wheel make[1]: *** [package/pkg-generic.mk:289: /home/marcus/br-test-pkg/arm-aarch64/build/python-sdbus-0.12.0/.stamp_built] Error 1 make: *** [Makefile:83: _all] Error 2 [1] https://github.com/python-sdbus/python-sdbus/issues/50 Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu> --- package/python-sdbus/python-sdbus.mk | 1 + 1 file changed, 1 insertion(+)