Closed Zombie-Ryushu closed 1 year ago
It looks like you are using GCC 7. That major release is over six years old. My build environment typically uses more up-to date versions. I am currently using GCC 11. It seems to link against libpthread automatically. For building with older versions, you may try to adjust src/CMakeLists.txt as described here: https://stackoverflow.com/questions/1620918/cmake-and-libpthread
I believe the OpenSuse Build cluster has parameters for building with gcc-10, let me try that.
[ 52s] /usr/bin/gcc-10 -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libsignald.so -o libsignald.so CMakeFiles/signald.dir/attachments.c.o CMakeFiles/signald.dir/comms.c.o CMakeFiles/signald.dir/contacts.c.o CMakeFiles/signald.dir/groups.c.o CMakeFiles/signald.dir/libsignald.c.o CMakeFiles/signald.dir/link.c.o CMakeFiles/signald.dir/login.c.o CMakeFiles/signald.dir/message.c.o CMakeFiles/signald.dir/signald_procmgmt.c.o CMakeFiles/signald.dir/input.c.o CMakeFiles/signald.dir/options.c.o CMakeFiles/signald.dir/receipt.c.o CMakeFiles/signald.dir/admin.c.o CMakeFiles/signald.dir/status.c.o CMakeFiles/signald.dir/interface.c.o CMakeFiles/signald.dir/reply.c.o CMakeFiles/signald.dir/__/submodules/MegaMimes/src/MegaMimes.c.o CMakeFiles/signald.dir/__/submodules/QR-Code-generator/c/qrcodegen.c.o -lpurple -lglib-2.0 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0
[ 52s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/signald.dir/login.c.o: in function `try_connect':
[ 52s] /home/abuild/rpmbuild/BUILD/purple-signald-1678641082.7f1d736/src/login.c:133: undefined reference to `pthread_create'
[ 52s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/purple-signald-1678641082.7f1d736/src/login.c:136: undefined reference to `pthread_detach'
[ 52s] collect2: error: ld returned 1 exit status
[ 52s] make[2]: *** [src/CMakeFiles/signald.dir/build.make:372: src/libsignald.so] Error 1
[ 52s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/purple-signald-1678641082.7f1d736/build'
[ 52s] make[1]: *** [CMakeFiles/Makefile2:101: src/CMakeFiles/signald.dir/all] Error 2
[ 52s] make: *** [Makefile:139: all] Error 2
[ 52s] error: Bad exit status from /var/tmp/rpm-tmp.scaG1Q (%build)
Same error with gcc-10.
it's suffering from obvious underlinking. Add a -lpthread where necessary or patch src/CMakeLists.txt
It is far from obvious to me. Adding libpthread is my recommendation in my first answer. I am hesitant to change the src/CMakeLists.txt without investigating. Before I understand why it is working now, I might break things for other people.
Update: Maybe it is due to this change in glibc. There is some discussion about it. I will now add the Threads dependency explicitly. Does it work for you?