Can't build client_lib caused by missing '-fPIC' on NymphRPC
aanno opened this issue · 3 comments
aanno commented
+ cd NymphCast/src/client_lib
+ mkdir src
+ ln -s /opt/nymph/include/nymph src
+ make lib
mkdir -p lib
mkdir -p obj/shared
mkdir -p obj/static
g++ -c -o obj/static/bytebauble.o bytebauble.cpp -I src -g3 -std=c++17 -O0
g++ -c -o obj/static/nyansd.o nyansd.cpp -I src -g3 -std=c++17 -O0
g++ -c -o obj/static/nymphcast_client.o nymphcast_client.cpp -I src -g3 -std=c++17 -O0
rm -f lib/libnymphcast.a
ar rcs lib/libnymphcast.a obj/static/bytebauble.o obj/static/nyansd.o obj/static/nymphcast_client.o
g++ -c -o obj/shared/bytebauble.o bytebauble.cpp -I src -g3 -std=c++17 -O0 -fPIC -shared -Wl,-soname,libnymphcast.so.0.1 -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON
g++ -c -o obj/shared/nyansd.o nyansd.cpp -I src -g3 -std=c++17 -O0 -fPIC -shared -Wl,-soname,libnymphcast.so.0.1 -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON
g++ -c -o obj/shared/nymphcast_client.o nymphcast_client.cpp -I src -g3 -std=c++17 -O0 -fPIC -shared -Wl,-soname,libnymphcast.so.0.1 -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON
g++ -o lib/libnymphcast.so.0.1 -I src -g3 -std=c++17 -O0 -fPIC -shared -Wl,-soname,libnymphcast.so.0.1 obj/shared/bytebauble.o obj/shared/nyansd.o obj/shared/nymphcast_client.o -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_types.o): relocation R_X86_64_32 against symbol `_ZTV10NymphArray' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_utilities.o): relocation R_X86_64_32 against symbol `_ZN14NymphUtilities7idMutexE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(remote_server.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(dispatcher.o): relocation R_X86_64_32 against undefined symbol `__pthread_key_create' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_listener.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_logger.o): relocation R_X86_64_32 against symbol `_ZTV18NymphLoggerChannel' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_method.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_session.o): relocation R_X86_64_32 against symbol `_ZTV12NymphSession' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_socket_listener.o): relocation R_X86_64_32 against symbol `_ZTV19NymphSocketListener' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(remote_client.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(worker.o): relocation R_X86_64_32 against undefined symbol `__pthread_key_create' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(callback_request.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_message.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnymphrpc.a(nymph_server.o): relocation R_X86_64_32 against symbol `_ZN11NymphServer2ssE' can not be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
make: *** [Makefile:92: lib/libnymphcast.so.0.1] Error 1
Error: error building at STEP "RUN set -ex; mkdir /opt/owntone || true; mkdir -p /opt/owntone/lib /opt/owntone/include/nymph /opt/owntone/bin || true; cd; echo "fastestmirror=1" >>/etc/dnf/dnf.conf; dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm; dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm; dnf -y install git tree gcc-c++ gcc make poco-devel SDL2-devel SDL2_image-devel ffmpeg-devel libatomic qt5-qtbase-devel; export DESTDIR=/; export PREFIX=/opt/owntone; git clone https://github.com/MayaPosch/NymphRPC; cd NymphRPC; make lib; cp lib/* /opt/owntone/lib; cp src/*.h /opt/owntone/include/nymph; cd; ln -s /opt/owntone/lib/* /usr/lib64; git clone https://github.com/MayaPosch/NymphCast; cd NymphCast/src/server; ln -s /opt/owntone/include/nymph .; ln -s /usr/include/ffmpeg/* .; make; make install; make install-systemd; tree .; cd; cd NymphCast/src/client_lib; mkdir src; ln -s /opt/owntone/include/nymph src; make lib; make install; cd; cd NymphCast/player/NymphCastPlayer; mkdir build; cd build; qmake ..; make; tree .; make install;": error while running runtime: exit status 2
MayaPosch commented
That looks like the linker isn't finding the libnymphrpc.so file and tries to use the static library instead.
The make install
option in the NymphRPC Makefile creates a symlink to libnymphrpc.so.0.1 so that the linker can find a libnymphrpc.so file. You can either use this existing Makefile target, or add this step to your commands.
aanno commented
Indeed, it was a matter of ln -s libnymphrpc.so.0.1 libnymphrpc.so
. Thank you!
MayaPosch commented
Glad to hear you got it fixed :)
Feel free to open a new ticket if there are any remaining issues.