Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 814941 - dev-libs/jansson-2.14 does not compile with ld.gold
Summary: dev-libs/jansson-2.14 does not compile with ld.gold
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: David Zero
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-09-26 06:37 UTC by Marek Bartosiewicz
Modified: 2023-07-04 03:20 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,20.38 KB, text/x-log)
2021-09-26 17:23 UTC, Mike Lothian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Bartosiewicz 2021-09-26 06:37:47 UTC
Error log:

libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src -I.. -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wno-format-truncation -O2 -pipe -march=native -ftree-vectorize -c /var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/load.c  -fPIC -DPIC -o .libs/load.o
In file included from /usr/include/string.h:519,
                 from /var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/error.c:2:
In function ‘strncpy’,
    inlined from ‘jsonp_error_set_source’ at /var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/error.c:25:9,
    inlined from ‘jsonp_error_set_source’ at /var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/error.c:17:6:
/usr/include/bits/string_fortified.h:95:10: warning: ‘__builtin___strncpy_chk’ specified bound depends on the length of the source argument [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/error.c: In function ‘jsonp_error_set_source’:
/var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14/src/error.c:23:14: note: length computed here
   23 |     length = strlen(source);
      |              ^~~~~~~~~~~~~~
/bin/sh ../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wno-format-truncation -O2 -pipe -march=native -ftree-vectorize -no-undefined -export-symbols-regex '^json_|^jansson_' -version-info 18:0:14 -Wl,--default-symver -Wl,-Bsymbolic-functions -Wl,-O1 -Wl,--as-needed -o libjansson.la -rpath /usr/lib64 dump.lo error.lo hashtable.lo hashtable_seed.lo load.lo memory.lo pack_unpack.lo strbuffer.lo strconv.lo utf.lo value.lo version.lo
libtool: link: /usr/bin/x86_64-pc-linux-gnu-nm -B  .libs/dump.o .libs/error.o .libs/hashtable.o .libs/hashtable_seed.o .libs/load.o .libs/memory.o .libs/pack_unpack.o .libs/strbuffer.o .libs/strconv.o .libs/utf.o .libs/value.o .libs/version.o   | sed -n -e 's/^.*[	 ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[	 ][	 ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' | /bin/sed 's/.* //' | sort | uniq > .libs/libjansson.exp
libtool: link: /bin/grep -E -e "^json_|^jansson_" ".libs/libjansson.exp" > ".libs/libjansson.expT"
libtool: link: mv -f ".libs/libjansson.expT" ".libs/libjansson.exp"
libtool: link: echo "{ global:" > .libs/libjansson.ver
libtool: link:  cat .libs/libjansson.exp | sed -e "s/\(.*\)/\1;/" >> .libs/libjansson.ver
libtool: link:  echo "local: *; };" >> .libs/libjansson.ver
libtool: link:  x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/dump.o .libs/error.o .libs/hashtable.o .libs/hashtable_seed.o .libs/load.o .libs/memory.o .libs/pack_unpack.o .libs/strbuffer.o .libs/strconv.o .libs/utf.o .libs/value.o .libs/version.o    -O2 -march=native -Wl,--default-symver -Wl,-Bsymbolic-functions -Wl,-O1 -Wl,--as-needed   -Wl,-soname -Wl,libjansson.so.4 -Wl,-version-script -Wl,.libs/libjansson.ver -o .libs/libjansson.so.4.14.0
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: --default-symver: unknown option
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:447: libjansson.la] Error 1
make[2]: Leaving directory '/var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14-abi_x86_64.amd64/src'
make[1]: *** [Makefile:642: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-libs/jansson-2.14/work/jansson-2.14-abi_x86_64.amd64'
make: *** [Makefile:550: all] Error 2
Comment 1 Conrad Kostecki gentoo-dev 2021-09-26 15:04:14 UTC
Please prodide a complete build.log.
Comment 2 Mike Lothian 2021-09-26 17:23:26 UTC
Created attachment 741525 [details]
build.log
Comment 3 David Zero 2021-09-26 20:44:20 UTC
Apparently the gold linker doesn't support --default-symver? I'm not sure what the best workaround for this is at the moment. We could leave builds using ld.gold without versioned symbols, or we could use this "--version-script" flag to use a version script to set the symbol versions.

Does Gentoo even support being built with ld.gold?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-09-26 20:55:11 UTC
(In reply to David Zero from comment #3)
> Apparently the gold linker doesn't support --default-symver? I'm not sure
> what the best workaround for this is at the moment. We could leave builds
> using ld.gold without versioned symbols, or we could use this
> "--version-script" flag to use a version script to set the symbol versions.


We can force using bfd if gold is detected, I guess.

> 
> Does Gentoo even support being built with ld.gold?

Eh. gold is really dead upstream at this point. I'd rather see it be removed tbh.
Comment 5 James Beddek 2021-09-27 02:56:02 UTC
Same issue with ld.lld

libtool: link:  clang -shared  -fPIC -DPIC  .libs/dump.o .libs/error.o .libs/hashtable.o .libs/hashtable_seed.o .libs/load.o .libs/memory.o .libs/pack_unpack.o .libs/strbuffer.o .libs/strconv.o .libs/utf.o .libs/value.o .libs/version.o    -march=znver2 -O3 -glldb -Wl,--default-symver -Wl,-O3 -Wl,--as-needed   -Wl,-soname -Wl,libjansson.so.4 -Wl,-version-script -Wl,.libs/libjansson.ver -o .libs/libjansson.so.4.14.0
ld.lld: error: unknown argument '--default-symver'

tc-ld-force-bfd might be good :-)
Comment 6 Ionen Wolkens gentoo-dev 2021-09-28 06:53:40 UTC
If it needs --default-symver, then the common fix is the same that sys-libs/db is doing for it (bug #729510), aka tc-ld-force-bfd which will additionally disable lld (I do find it a bit unfortunate as far as lld support goes though).
Comment 7 Ionen Wolkens gentoo-dev 2021-09-28 07:04:52 UTC
But, looking at the CMakeLists, there may be a better route. This sounds like detection issues (haven't looked deeper into it)

   if (SYMVER_WORKS)
      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--default-symver")
   else()
# some linkers may only support --version-script

I don't care for gold support myself (I too think it should be removed), but letting lld be usable where possible is nice.
Comment 8 Ionen Wolkens gentoo-dev 2021-09-30 01:34:57 UTC
Partially scratch previous comment, just realized the ebuild is using autoconf rather than cmake.

CMakeLists.txt is interesting given default-symver check seems to have a misnamed variable (pointed by sam) and so always skips --default-symver even with bfd (which seem like a good thing if anything).

On the other hand, configure seem to use default-symver if glibc is detected without testing with the linker.
Comment 9 Михаил 2021-10-09 17:58:57 UTC
(In reply to David Zero from comment #3)
> We could leave builds using ld.gold without versioned symbols

Versions is necessary https://bugs.gentoo.org/812119
Comment 10 Larry the Git Cow gentoo-dev 2021-10-10 00:32:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2385877c80446b392cd8b15633d861bf31980c5

commit e2385877c80446b392cd8b15633d861bf31980c5
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-10-10 00:30:50 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-10-10 00:30:50 +0000

    dev-libs/jansson: force bfd linker (for now)
    
    Fails with gold + lld, so let's force bfd
    for now - at least until switched to CMake.
    
    Closes: https://bugs.gentoo.org/814941
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/jansson/jansson-2.14.ebuild | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)