[Bug 282728] tsan linking failure: duplicated symbols

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 13 Nov 2024 13:26:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282728

            Bug ID: 282728
           Summary: tsan linking failure: duplicated symbols
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: bapt@FreeBSD.org

When linking on freebsd with tsan: (https://github.com/freebsd/pkg/pull/2343)


ld: error: duplicate symbol: _pthread_mutex_init
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(_pthread_mutex_init) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at thr_mutex.c:380 (/home/pkgbuild/worktrees/main/lib/libthr/thread/thr_mutex.c:380)
>>>            thr_mutex.o:(__Tthr_mutex_init) in archive /usr/lib/libpthread.a

ld: error: duplicate symbol: _pthread_mutex_lock
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(_pthread_mutex_lock) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at thr_mutex.c:745 (/home/pkgbuild/worktrees/main/lib/libthr/thread/thr_mutex.c:745)
>>>            thr_mutex.o:(__Tthr_mutex_lock) in archive /usr/lib/libpthread.a

ld: error: duplicate symbol: _pthread_mutex_trylock
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(_pthread_mutex_trylock) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at thr_mutex.c:616 (/home/pkgbuild/worktrees/main/lib/libthr/thread/thr_mutex.c:616)
>>>            thr_mutex.o:(__Tthr_mutex_trylock) in archive /usr/lib/libpthread.a

ld: error: duplicate symbol: arc4random_buf
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(arc4random_buf) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at arc4random.c:248 (/home/pkgbuild/worktrees/main/lib/libc/gen/arc4random.c:248)
>>>            arc4random.o:(.text+0xC0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: opendir
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(opendir) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at opendir.c:53 (/home/pkgbuild/worktrees/main/lib/libc/gen/opendir.c:53)
>>>            opendir.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: posix_spawn
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(posix_spawn) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at posix_spawn.c:377 (/home/pkgbuild/worktrees/main/lib/libc/gen/posix_spawn.c:377)
>>>            posix_spawn.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: posix_spawnp
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(posix_spawnp) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at posix_spawn.c:386 (/home/pkgbuild/worktrees/main/lib/libc/gen/posix_spawn.c:386)
>>>            posix_spawn.o:(.text+0x180) in archive /usr/lib/libc.a

ld: error: duplicate symbol: scandir
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(scandir) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at scandir.c:144 (/home/pkgbuild/worktrees/main/lib/libc/gen/scandir.c:144)
>>>            scandir.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: sigemptyset
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(sigemptyset) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at sigsetops.c:61 (/home/pkgbuild/worktrees/main/lib/libc/gen/sigsetops.c:61)
>>>            sigsetops.o:(.text+0x80) in archive /usr/lib/libc.a

ld: error: duplicate symbol: sigfillset
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(sigfillset) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at sigsetops.c:71 (/home/pkgbuild/worktrees/main/lib/libc/gen/sigsetops.c:71)
>>>            sigsetops.o:(.text+0x90) in archive /usr/lib/libc.a

ld: error: duplicate symbol: _setjmp
>>> defined at tsan_rtl_amd64.S:72 (/home/pkgbuild/worktrees/main/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:72)
>>>            tsan_rtl_amd64.o:(_setjmp) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at _setjmp.S:45 (/home/pkgbuild/worktrees/main/lib/libc/amd64/gen/_setjmp.S:45)
>>>            _setjmp.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: setlocale
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(setlocale) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at setlocale.c:98 (/home/pkgbuild/worktrees/main/lib/libc/locale/setlocale.c:98)
>>>            setlocale.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: wcsnrtombs
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(wcsnrtombs) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at wcsnrtombs.c:54 (/home/pkgbuild/worktrees/main/lib/libc/locale/wcsnrtombs.c:54)
>>>            wcsnrtombs.o:(.text+0x40) in archive /usr/lib/libc.a

ld: error: duplicate symbol: getaddrinfo
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(getaddrinfo) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at getaddrinfo.c:391 (/home/pkgbuild/worktrees/main/lib/libc/net/getaddrinfo.c:391)
>>>            getaddrinfo.o:(.text+0x40) in archive /usr/lib/libc.a

ld: error: duplicate symbol: getifaddrs
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(getifaddrs) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at getifaddrs.c:78 (/home/pkgbuild/worktrees/main/lib/libc/net/getifaddrs.c:78)
>>>            getifaddrs.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: getprotoent
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(getprotoent) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at getprotoent.c:540 (/home/pkgbuild/worktrees/main/lib/libc/net/getprotoent.c:540)
>>>            getprotoent.o:(.text+0xDC0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: fflush
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(fflush) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at fflush.c:50 (/home/pkgbuild/worktrees/main/lib/libc/stdio/fflush.c:50)
>>>            fflush.o:(.text+0x0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: vfprintf
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(vfprintf) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at vfprintf.c:287 (/home/pkgbuild/worktrees/main/lib/libc/stdio/vfprintf.c:287)
>>>            vfprintf.o:(.text+0x35D0) in archive /usr/lib/libc.a

ld: error: duplicate symbol: localtime
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(localtime) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at localtime.c:1681 (/home/pkgbuild/worktrees/main/contrib/tzcode/localtime.c:1681)
>>>            localtime.o:(.text+0x300) in archive /usr/lib/libc.a

ld: error: duplicate symbol: localtime_r
>>> defined at tsan_interceptors_posix.cpp
>>>            tsan_interceptors_posix.o:(localtime_r) in archive /usr/lib/clang/19/lib/freebsd/libclang_rt.tsan-x86_64.a
>>> defined at localtime.c:1708 (/home/pkgbuild/worktrees/main/contrib/tzcode/localtime.c:1708)
>>>            localtime.o:(.text+0x460) in archive /usr/lib/libc.a

ld: error: too many errors emitted, stopping now (use --error-limit=0 to see
all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [pkg-static] Error code 1

-- 
You are receiving this mail because:
You are the assignee for the bug.