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

Bug 777444

Summary: dev-util/babeltrace-1.2.4 multiple definition of `bt_lookup_format' when using rlibtool
Product: Gentoo Linux Reporter: Alessandro Barbieri <lssndrbarbieri>
Component: Current packagesAssignee: Yixun Lan <dlan>
Status: RESOLVED FIXED    
Severity: normal CC: ionen, orbea, sam
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/25408
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 765709    
Attachments: babeltrace-1.2.4:20210321-012018.log

Description Alessandro Barbieri 2021-03-21 01:23:14 UTC
In file included from /usr/include/glib-2.0/glib/gdir.h:32,                                                                                                                                                                                   
                 from /usr/include/glib-2.0/glib.h:45,                                                                                                                                                                                        
                 from ../../include/babeltrace/types.h:39,                                                                                                                                                                                    
                 from ../../include/babeltrace/ctf/types.h:30,                                                                                                                                                                                
                 from ctf.c:30:                                                                                                                                                                                                               
/usr/include/dirent.h:183:12: note: declared here                                                                                                                                                                                             
  183 | extern int readdir_r (DIR *__restrict __dirp,                                                                                                                                                                                         
      |            ^~~~~~~~~                                                                                                                                                                                                                  
rlibtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -Wall -Wformat -include config.h -I../../include -Os -pipe -march=native -fdiagnostics-color=
always -Os -pipe -march=native -fdiagnostics-color=always -Wimplicit-function-declaration -Wno-error=implicit-function-declaration -Wl,--no-as-needed -version-info 1:0:0 -Wl,-O1 -Wl,--as-needed -o libbabeltrace-ctf.la -rpath /usr/lib64 ct
f.lo events.lo iterator.lo callbacks.lo ../../lib/libbabeltrace.la types/libctf-types.la metadata/libctf-parser.la metadata/libctf-ast.la writer/libctf-writer.la -lpopt  -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0              
rlibtool: lconf: {.name="libtool"}.                                                                                                                                                                                                           
rlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/var/tmp/portage/dev-util/babeltrace-1.2.4/work/babeltrace-1.2.4/formats/ctf"}.                                                                                                                 
rlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 40, .st_ino = 9627}.                                                                                                                                                                
rlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].                                                                                                                                                                         
rlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 5.                                                                                                                                                                                    
rlibtool: lconf: fstat(5,...) = 0 {.st_dev = 40, .st_ino = 9617}.                                                                                                                                                                             
rlibtool: lconf: openat(5,"libtool",O_RDONLY,0) = -1 [ENOENT].                                                                                                                                                                                
rlibtool: lconf: openat(5,"../",O_DIRECTORY,0) = 6.                                                                                                                                                                                           
rlibtool: lconf: fstat(6,...) = 0 {.st_dev = 40, .st_ino = 9596}.                                                                                                                                                                             
rlibtool: lconf: openat(6,"libtool",O_RDONLY,0) = 5.                                                                                                                                                                                          
rlibtool: lconf: found "/var/tmp/portage/dev-util/babeltrace-1.2.4/work/babeltrace-1.2.4/libtool".                                                                                                                                            
rlibtool: link: ar crs .libs/libbabeltrace-ctf.a .libs/ctf.o .libs/events.o .libs/iterator.o .libs/callbacks.o                                                                                                                                
rlibtool: link: x86_64-pc-linux-gnu-gcc .libs/ctf.o .libs/events.o .libs/iterator.o .libs/callbacks.o -Wl,--whole-archive types/.libs/libctf-types.a -Wl,--no-whole-archive -Wl,--whole-archive metadata/.libs/libctf-parser.a -Wl,--no-whole-
archive -Wl,--whole-archive metadata/.libs/libctf-ast.a -Wl,--no-whole-archive -Wl,--whole-archive writer/.libs/libctf-writer.a -Wl,--no-whole-archive -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4
 -Wall -Wformat -include config.h -I../../include -Os -pipe -march=native -fdiagnostics-color=always -Os -pipe -march=native -fdiagnostics-color=always -Wimplicit-function-declaration -Wno-error=implicit-function-declaration -Wl,--no-as-n
eeded -Wl,-O1 -Wl,--as-needed -L../../lib/.libs -lbabeltrace -lpopt -lgmodule-2.0 -lglib-2.0 -lpopt -lgmodule-2.0 -Ltypes/../../../lib/.libs -lbabeltrace -Lmetadata/../../../lib/.libs -luuid -lpopt -lgmodule-2.0 -lglib-2.0 -Lwriter/../../
../lib/.libs -lbabeltrace -Wl,--export-dynamic -pthread -shared -fPIC -Wl,-soname -Wl,libbabeltrace-ctf.so.1 -o .libs/libbabeltrace-ctf.so.1.0.0                                                                                              
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(registry.o): in function `bt_lookup_format':                                                                                      
registry.c:(.text+0x57): multiple definition of `bt_lookup_format'; types/.libs/libctf-types.a(registry.o):registry.c:(.text+0x57): first defined here                                                                                        
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(registry.o): in function `bt_fprintf_format_list':                                                                                
registry.c:(.text+0x72): multiple definition of `bt_fprintf_format_list'; types/.libs/libctf-types.a(registry.o):registry.c:(.text+0x72): first defined here                                                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(registry.o): in function `bt_unregister_format':                                                                                  
registry.c:(.text+0x12b): multiple definition of `bt_unregister_format'; types/.libs/libctf-types.a(registry.o):registry.c:(.text+0x12b): first defined here                                                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(registry.o): in function `bt_register_format':                                                                                    
registry.c:(.text+0x16f): multiple definition of `bt_register_format'; types/.libs/libctf-types.a(registry.o):registry.c:(.text+0x16f): first defined here                                                                                    
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-collection.o): in function `bt_trace_collection_add':                                                                       
trace-collection.c:(.text+0x24f): multiple definition of `bt_trace_collection_add'; types/.libs/libctf-types.a(trace-collection.o):trace-collection.c:(.text+0x24f): first defined here                                                       
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-collection.o): in function `bt_trace_collection_remove':                                                                    
trace-collection.c:(.text+0x34c): multiple definition of `bt_trace_collection_remove'; types/.libs/libctf-types.a(trace-collection.o):trace-collection.c:(.text+0x34c): first defined here                                                    
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-collection.o): in function `bt_init_trace_collection':                                                                      
trace-collection.c:(.text+0x371): multiple definition of `bt_init_trace_collection'; types/.libs/libctf-types.a(trace-collection.o):trace-collection.c:(.text+0x371): first defined here                                                      
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-collection.o): in function `bt_finalize_trace_collection':                                                                  
trace-collection.c:(.text+0x3d9): multiple definition of `bt_finalize_trace_collection'; types/.libs/libctf-types.a(trace-collection.o):trace-collection.c:(.text+0x3d9): first defined here                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-handle.o): in function `bt_trace_handle_create':                                                                            
trace-handle.c:(.text+0x0): multiple definition of `bt_trace_handle_create'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x0): first defined here                                                                        
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-handle.o): in function `bt_trace_handle_destroy':                                                                           
trace-handle.c:(.text+0x2c): multiple definition of `bt_trace_handle_destroy'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x2c): first defined here                                                                     
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-handle.o): in function `bt_trace_handle_get_path':                                                                          
trace-handle.c:(.text+0x31): multiple definition of `bt_trace_handle_get_path'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x31): first defined here                                                                    
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-handle.o): in function `bt_trace_handle_get_timestamp_begin':                                                               
trace-handle.c:(.text+0x55): multiple definition of `bt_trace_handle_get_timestamp_begin'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x55): first defined here                                                         
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(trace-handle.o): in function `bt_trace_handle_get_timestamp_end':                                                                 
trace-handle.c:(.text+0x94): multiple definition of `bt_trace_handle_get_timestamp_end'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x94): first defined here                                                           
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: metadata/.libs/libctf-ast.a(context.o): in function `bt_context_create':                                                                                      
context.c:(.text+0x4b): multiple definition of `bt_context_create'; types/.libs/libctf-types.a(context.o):context.c:(.text+0x4b): first defined here
Comment 1 Alessandro Barbieri 2021-03-21 01:23:35 UTC
Created attachment 692625 [details]
babeltrace-1.2.4:20210321-012018.log

buildlog
Comment 2 orbea 2021-03-22 17:00:43 UTC
babeltrace-1.2.4 is from 2016 and this has been fixed upstream since their v2.0.1 git tag, their most recent tag v2.0.4 also works as does their current git HEAD.

Just update babeltrace to fix this.
Comment 3 Ionen Wolkens gentoo-dev 2021-04-13 14:59:21 UTC
wrt -fno-common blocker note that -fcommon doesn't seem to fix this and it only happens with slibtool, so believe it's mostly something different.

These will mention static libraries for the first definition, e.g.

trace-handle.c:(.text+0x55): multiple definition of `bt_trace_handle_get_timestamp_begin'; types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x55): first defined here
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-13 15:35:32 UTC
(In reply to Ionen Wolkens from comment #3)
> wrt -fno-common blocker note that -fcommon doesn't seem to fix this and it
> only happens with slibtool, so believe it's mostly something different.
> 
> These will mention static libraries for the first definition, e.g.
> 
> trace-handle.c:(.text+0x55): multiple definition of
> `bt_trace_handle_get_timestamp_begin';
> types/.libs/libctf-types.a(trace-handle.o):trace-handle.c:(.text+0x55):
> first defined here

Good point!
Comment 5 orbea 2021-04-13 18:55:23 UTC
There is little point worrying about it when all this needs is a version bump.
Comment 6 Ionen Wolkens gentoo-dev 2021-04-13 19:13:05 UTC
(In reply to orbea from comment #5)
> There is little point worrying about it when all this needs is a version
> bump.
Was speaking generally because this isn't the only one, like bug #778248, and it's useful to be able to identify them.
Comment 7 orbea 2022-05-09 22:30:26 UTC
This is an overlinking issue where internal .la dependencies are linked repeatedly causing multiple definition errors.
Comment 8 Larry the Git Cow gentoo-dev 2022-05-09 23:13:54 UTC
The bug has been referenced in the following commit(s):

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

commit deaeeee3d4cd6625fcae1301af88e7454581c0e3
Author:     orbea <orbea@riseup.net>
AuthorDate: 2022-05-09 22:21:15 +0000
Commit:     Yixun Lan <dlan@gentoo.org>
CommitDate: 2022-05-09 23:13:27 +0000

    dev-util/babeltrace: Fix overlinking
    
    When building with slibtool the build fails with many multiple
    definition errors. This is because of overlinking internal .la
    files where GNU libtool somehow obscures the issue.
    
    Note the newer Babeltrace 2 which is not yet in Gentoo does
    not seem to have any slibtool related build issues.
    
    Bug: https://bugs.gentoo.org/777444
    Upstream-PR: https://github.com/efficios/babeltrace/pull/119
    Closes: https://github.com/gentoo/gentoo/pull/25408
    Signed-off-by: orbea <orbea@riseup.net>
    Signed-off-by: Yixun Lan <dlan@gentoo.org>

 dev-util/babeltrace/babeltrace-1.5.8.ebuild        |  19 +++-
 .../files/babeltrace-1.5.8-slibtool.patch          | 119 +++++++++++++++++++++
 2 files changed, 135 insertions(+), 3 deletions(-)