Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 683892

Summary: dev-libs/protobuf-3.7.1 with ld.gold - ./.libs/libprotoc.so: error: undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto'
Product: Gentoo Linux Reporter: Tomas Jelinek <tomasjelinek>
Component: Current packagesAssignee: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Status: RESOLVED FIXED    
Severity: normal CC: Adrian.Bassett, dschridde+gentoobugs, esigra, fabio.coatti, mmk, proxy-maint, sarnex, StormByte, zhuyifei1999
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 269315    
Attachments: emerge --info dev-libs/protobuf
build.log

Description Tomas Jelinek 2019-04-20 10:15:09 UTC
Created attachment 573470 [details]
emerge --info dev-libs/protobuf

Using -fuse-ld=bfd solves the issue.
Comment 1 Tomas Jelinek 2019-04-20 10:16:09 UTC
Created attachment 573472 [details]
build.log
Comment 2 Dennis Schridde 2019-05-04 13:00:09 UTC
(In reply to Tomas Jelinek from comment #0)
> Created attachment 573470 [details]
> emerge --info dev-libs/protobuf
> 
> Using -fuse-ld=bfd solves the issue.

dev-lang/ghc-8.6.4 appears to also have trouble with ld.gold and solves that in this way:
    case ${CTARGET} in
      arm*)
        # ld.bfd-2.28 does not work for ghc. Force ld.gold
        # instead. This should be removed once gentoo gets
        # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
        econf_args+=(LD=${CTARGET}-ld.gold)
      ;;
      sparc*)
        # ld.gold-2.28 does not work for ghc. Force ld.bfd
        # instead. This should be removed once gentoo gets
        # a fix for missing --no-relax support bug:
        # https://sourceware.org/ml/binutils/2017-07/msg00183.html
        econf_args+=(LD=${CTARGET}-ld.bfd)
      ;;
      *) 
        econf_args+=(LD=${CTARGET}-ld)
    esac


app-text/fbreader-0.99.4-r5 also contains a patch with custom logic to force usage of ld.bfd:
--- fbreader-0.99.4.orig/fbreader/Makefile  2012-11-30 19:41:25.000000000 +0700
+++ fbreader-0.99.4/fbreader/Makefile 2018-01-11 22:18:18.000208200 +0700
@@ -23,5 +23,5 @@
  done;
  @echo -n 'Linking $(TARGET) ...'
- @$(LD) $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3
+ @$(LD) -fuse-ld=bfd $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3
  @echo ' OK'
 


toolchain-funcs.eclass on the other hand ships tc-ld-disable-gold which seems to contain a generic solution:
# @FUNCTION: tc-ld-disable-gold
# @USAGE: [toolchain prefix]
# @DESCRIPTION:  
# If the gold linker is currently selected, configure the compilation
# settings so that we use the older bfd linker instead.
Comment 3 Dennis Schridde 2019-05-04 13:02:55 UTC
(In reply to Dennis Schridde from comment #2)
> app-text/fbreader-0.99.4-r5 also contains a patch with custom logic to force
> usage of ld.bfd:
> [...]

See-Also: https://bugs.gentoo.org/show_bug.cgi?id=437262
Comment 4 Arfrever Frehtes Taifersar Arahesis 2019-05-05 03:50:27 UTC
We are planning investigation on proper fix (either in protobuf or gold itself), instead of applying some workarounds like tc-ld-disable-gold().
Comment 5 Dennis Schridde 2019-05-05 08:08:07 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #4)
> We are planning investigation on proper fix (either in protobuf or gold
> itself), instead of applying some workarounds like tc-ld-disable-gold().

Until that has been done: Could we please get a workaround?  It has been almost two weeks since this issue emerged.
Comment 6 Jan Psota 2019-05-05 10:13:37 UTC
> Until that has been done: Could we please get a workaround?  It has been
> almost two weeks since this issue emerged.

Haha! As I know Michał Górny, now you can expect 
=dev-libs/protobuf-3.7.1 
in package.mask ;-)
Comment 7 Arfrever Frehtes Taifersar Arahesis 2019-05-06 03:55:24 UTC
https://sourceware.org/bugzilla/show_bug.cgi?id=24527
Comment 8 Arfrever Frehtes Taifersar Arahesis 2019-05-06 05:39:58 UTC
In libraries build with linker BFD:

$ nm libprotobuf.so.18.0.1 | grep scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
000000000033ad60 D scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
$ nm libprotoc.so.18.0.1 | grep scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
                 U scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
$ readelf -dW libprotoc.so.18.0.1 | grep libprotobuf.so.18
 0x0000000000000001 (NEEDED)             Shared library: [libprotobuf.so.18]


In libraries build with linker GOLD:
$ nm libprotobuf.so.18.0.1 | grep scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
0000000000349340 d scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
$ nm libprotoc.so.18.0.1 | grep scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
                 U scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
$ readelf -dW libprotoc.so.18.0.1 | grep libprotobuf.so.18
 0x0000000000000001 (NEEDED)             Shared library: [libprotobuf.so.18]
Comment 9 Arfrever Frehtes Taifersar Arahesis 2019-05-08 03:08:38 UTC
I suspect that this bug in linker GOLD might remain open for longer time, so I will force linker BFD in ebuilds of dev-libs/protobuf in situation when detected linker is linker GOLD (but not any other linker, like linker LLD).


(Problem with 'extern "C++"' is absent in linker LLD.
Linker LLD does not support 'extern "Java"'.
dev-libs/protobuf-3.7.1 with compiler Clang 8.0.0 and linker LLD 8.0.0 builds correctly and passes all tests.
In dev-libs/protobuf-3.7.1, there are no differences between list of defined global symbols in libraries built with compiler Clang 8.0.0 + linker BFD and list of defined global symbols in libraries built with compiler Clang 8.0.0 + linker LLD 8.0.0.)
Comment 10 Dennis Schridde 2019-05-16 21:06:40 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #9)
> I suspect that this bug in linker GOLD might remain open for longer time, so
> I will force linker BFD in ebuilds of dev-libs/protobuf in situation when
> detected linker is linker GOLD (but not any other linker, like linker LLD).

Has this happened yet? For me dev-libs/protobuf-3.7.1 still fails to build.
Comment 11 Larry the Git Cow gentoo-dev 2019-05-17 19:35:46 UTC
The bug has been closed via the following commit(s):

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

commit 4be8cdbce708604f34fd8d9018198027e353a011
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2019-05-17 15:14:37 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-05-17 19:33:25 +0000

    dev-libs/protobuf: Force linker BFD when linker GOLD is detected.
    
    Fixes: https://bugs.gentoo.org/683892
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-libs/protobuf/protobuf-3.7.1.ebuild | 6 ++++++
 1 file changed, 6 insertions(+)