akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 808 forks source link

ld.gold: --default-symver: unknown option; ld.bfd: 1 of 5 test suites failed #605

Closed sassy-crick closed 2 years ago

sassy-crick commented 2 years ago

Dear all, I am having an issue with the latest version of Jansson (2.14) and GCC-11.2.0 on Debian Linux (bullseye). Using the ld.gold linker, which is the default in EasyBuild, the compilation crashes with --default-symver: unknown option. Switching to the ld.bfd linker it builds, but one test is failing (see attached file). So I am a bit stuck between a rock and a hard place. I should add that the previous version, which does not have the --default-symver flag, compiles without a problem. My problem might be related to issue 528. However, I should point out as I am using EasyBuild, the OS should not play too much of a role here. Any suggestions how to solve this problem? I am happy to provide more information if required. Thanks for your help!

Jörg

stderr.txt

dukess commented 2 years ago

Same problem. As a workaround you can use cmake instead ./configure:

mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DJANSSON_BUILD_SHARED_LIBS=ON ..
make all
make install
cd ..

or try to use this patch:

diff -Naur jansson-2.14/configure.ac jansson-2.14-symver/configure.ac
--- jansson-2.14/configure.ac   2021-09-09 21:18:55.000000000 +0300
+++ jansson-2.14-symver/configure.ac    2022-03-10 13:39:10.722057006 +0300
@@ -139,7 +139,16 @@

 # Enable symbol versioning on GNU libc
 JSON_SYMVER_LDFLAGS=
-AC_CHECK_DECL([__GLIBC__], [JSON_SYMVER_LDFLAGS=-Wl,--default-symver])
+AC_MSG_CHECKING(for --default-symver)
+saved_LDFLAGS="${LDFLAGS}"
+LDFLAGS="-Wl,--default-symver"
+AC_TRY_LINK(
+  [], [],
+  [JSON_SYMVER_LDFLAGS=-Wl[,]--default-symver
+  AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)],
+)
+LDFLAGS="${saved_LDFLAGS}"
 AC_SUBST([JSON_SYMVER_LDFLAGS])

 AC_ARG_ENABLE([ossfuzzers],

then autoreconf -fvi ./configure etc

sassy-crick commented 2 years ago

Switching to CMake did the trick for me, many thanks!