OpenWrt Forum Archive

Topic: OpenWrt-libtool: link: only absolute run-paths are allowed

The content of this topic has been archived on 30 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I am experimenting with openwrt and attempting to port some packages. I was able to port kmod for example (to the degree of it building an ipkg), so I am a bit familiar with basic Makefile syntax. I am currently trying to compile systemd, but I am apparently running into some rpath issue in the linking stage (configure and compile seem to be fine):

OpenWrt-libtool: compile:  x86_64-openwrt-linux-gnu-gcc -DHAVE_CONFIG_H -I. -include ./config.h -DSYSCONFDIR=\"/etc\" -DSYSTEM_CONFIG_FILE=\"/etc/systemd/system.conf\" -DSYSTEM_CONFIG_UNIT_PATH=\"/etc/systemd/system\" -DSYSTEM_DATA_UNIT_PATH=\"/usr/lib/systemd/system\" -DSYSTEM_SYSVINIT_PATH=\"/etc/init.d\" -DSYSTEM_SYSVRCND_PATH=\"/etc/rc.d\" -DUSER_CONFIG_FILE=\"/etc/systemd/user.conf\" -DUSER_CONFIG_UNIT_PATH=\"/etc/systemd/user\" -DUSER_DATA_UNIT_PATH=\"/usr/lib/systemd/user\" -DSYSTEMD_CGROUP_AGENT_PATH=\"/usr/lib/systemd/systemd-cgroups-agent\" -DSYSTEMD_BINARY_PATH=\"/usr/lib/systemd/systemd\" -DSYSTEMD_SHUTDOWN_BINARY_PATH=\"/usr/lib/systemd/systemd-shutdown\" -DSYSTEMD_SLEEP_BINARY_PATH=\"/usr/lib/systemd/systemd-sleep\" -DSYSTEMCTL_BINARY_PATH=\"/usr/bin/systemctl\" -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"/usr/bin/systemd-tty-ask-password-agent\" -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"/usr/bin/systemd-stdio-bridge\" -DROOTPREFIX=\"/usr\" -DRUNTIME_DIR=\"/run\" -DRANDOM_SEED=\"/var/lib/random-seed\" -DSYSTEMD_CRYPTSETUP_PATH=\"/usr/lib/systemd/systemd-cryptsetup\" -DSYSTEM_GENERATOR_PATH=\"/usr/lib/systemd/system-generators\" -DUSER_GENERATOR_PATH=\"/usr/lib/systemd/user-generators\" -DSYSTEM_SHUTDOWN_PATH=\"/usr/lib/systemd/system-shutdown\" -DSYSTEM_SLEEP_PATH=\"/usr/lib/systemd/system-sleep\" -DSYSTEMD_KBD_MODEL_MAP=\"/usr/share/systemd/kbd-model-map\" -DX_SERVER=\"/usr/bin/X\" -DUDEVLIBEXECDIR=\"/usr/lib/udev\" -DPOLKIT_AGENT_BINARY_PATH=\"/usr/bin/pkttyagent\" -I ./src -I ./src/shared -I ./src/login -I ./src/journal -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -Wp,-D_FORTIFY_SOURCE=2 -DKBD_LOADKEYS=\"/bin/loadkeys\" -DKBD_SETFONT=\"/bin/setfont\" -I/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/include -I/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/include -I/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/usr/include -I/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/include -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 -fvisibility=default -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -O2 -pipe -fwrapv -DNDEBUG -O2 -pipe -march=athlon64 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -fpic -Wl,-rpath-link=/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib -MT src/python-systemd/_journal_la-_journal.lo -MD -MP -MF src/python-systemd/.deps/_journal_la-_journal.Tpo -c src/python-systemd/_journal.c -o src/python-systemd/_journal_la-_journal.o >/dev/null 2>&1
mv -f src/python-systemd/.deps/_journal_la-_journal.Tpo src/python-systemd/.deps/_journal_la-_journal.Plo



/bin/sh ./libtool  --tag=CC   --mode=link x86_64-openwrt-linux-gnu-gcc -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 -fvisibility=default -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -O2 -pipe -fwrapv -DNDEBUG -O2 -pipe -march=athlon64 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -fpic -Wl,-rpath-link=/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib  -Wl,--as-needed -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now -shared -module -avoid-version -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/lib -Wl,-rpath-link=/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib  -o _journal.la -rpath lib64/python2.7/site-packages/systemd src/python-systemd/_journal_la-_journal.lo -lpthread -ldl -lutil -lm -lpython2.7 libsystemd-journal.la -ldl -lrt
OpenWrt-libtool: link: only absolute run-paths are allowed
make[5]: *** [_journal.la] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[3]: Leaving directory `/mnt/sda2/src/openwrt/build_dir/target-x86_64_eglibc-2.15/systemd-194'

there is no --disable-rpath option in systemd configure script.

there are some m4 files present in the source tree (not sure if it is relevant or not)

# find . -name "*m4"
./src/core/load-fragment-gperf.gperf.m4
./m4
./m4/acx_libwrap.m4
./m4/ltoptions.m4
./m4/gtk-doc.m4
./m4/libtool.m4
./m4/ltversion.m4
./m4/lt~obsolete.m4
./m4/ltsugar.m4
./m4/attributes.m4
./m4/intltool.m4
./units/getty@.service.m4
./units/serial-getty@.service.m4
./aclocal.m4

I tried the following workarounds (borrowed from other Makefiles)
PKG_FIXUP:=autoreconf
PKG_FIXUP:=patch-libtool
PKG_REMOVE_FILES:=aclocal.m4 m4/libtool.m4
TARGET_CFLAGS += $(FPIC) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
and their combinations

This is openwrt trunk.

Could someone assist me with this? I would greatly appreciate any response.

Thank you,
Eric Laganowski

(Last edited by elagano on 18 Oct 2012, 04:47)

You need to find the Makefile.in / Makefile.am or macro which injects the rpath, then see if it needs soem prefix of some sort which you have to set to "/". If not, patch it out.

Thank you jow. The issue turned out to be empty --exec-prefix= in CONFIGURE_ARGS. Silly me.

I am now running into another issue, which I am not sure is specific to the package I am attempting to port.

I compiled libblkid and libuuid and made them dependencies for systemd, however linking stage is failing:

/bin/sh ./libtool  --tag=CC   --mode=link x86_64-openwrt-linux-gnu-gcc -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 -O2 -pipe -march=athlon64 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable  -Wl,--as-needed -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/lib -luuid -lblkid  -o udevadm src/udev/udevadm.o src/udev/udevadm-info.o src/udev/udevadm-control.o src/udev/udevadm-monitor.o src/udev/udevadm-settle.o src/udev/udevadm-trigger.o src/udev/udevadm-test.o src/udev/udevadm-test-builtin.o libudev-core.la libsystemd-shared.la -ldl -lrt
libtool: link: x86_64-openwrt-linux-gnu-gcc -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 -O2 -pipe -march=athlon64 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wl,--as-needed -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -o udevadm src/udev/udevadm.o src/udev/udevadm-info.o src/udev/udevadm-control.o src/udev/udevadm-monitor.o src/udev/udevadm-settle.o src/udev/udevadm-trigger.o src/udev/udevadm-test.o src/udev/udevadm-test-builtin.o  -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/usr/lib -L/mnt/sda2/src/openwrt/staging_dir/toolchain-x86_64_gcc-4.6-linaro_eglibc-2.15/lib ./.libs/libudev-core.a -lkmod ./.libs/libsystemd-shared.a -luuid -lblkid -ldl -lrt
/mnt/sda2/src/openwrt/staging_dir/target-x86_64_eglibc-2.15/usr/lib/libblkid.a(probe.o): In function `blkid_unparse_uuid':
probe.c:(.text+0x1911): undefined reference to `uuid_unparse'
collect2: ld returned 1 exit status
make[5]: *** [udevadm] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[3]: Leaving directory `/mnt/sda2/src/openwrt/build_dir/target-x86_64_eglibc-2.15/systemd-194'
make[2]: *** [/mnt/sda2/src/openwrt/build_dir/target-x86_64_eglibc-2.15/systemd-194/.built] Error 2

This seem to be a problem with util-linux package that has both libblkid and libuuid.


Thanks in advance,
Eric

The discussion might have continued from here.