Re: vwarn: libc vs opensolaris/ctf/tools

From: Mark Johnston <markj_at_freebsd.org>
Date: Thu, 21 Apr 2022 14:44:17 UTC
On Thu, Apr 21, 2022 at 04:24:18PM +0200, stephane rochoy wrote:
> Hello,
> 
> Trying to build stable/13 [1] (for ARMv6) if encountered the
> following linker error when building cddl/user.bin/ctfdump.
> 
>     ld: error: duplicate symbol: vwarn
>     >>> defined at utils.c
>     >>>            utils.o:(vwarn)
>     >>> defined at err.c:148 (/usr/src/lib/libc/gen/err.c:148)
>     >>>            err.o:(.text+0x4D0) in archive /usr/lib/libc.a
>     cc: error: linker command failed with exit code 1 (use -v to 
>     see invocation)
> 
> The vwarn function seems to be defined both in lib/libc/gen/err.c
> and in cddl/contrib/opensolaris/tools/ctf/common/utils.c. It seems
> to be ok to workaround the problem by enclosing OpenSolaris'
> implementation in #if 0.

I think that'd be fine.  We can remove it outright.

Your build is statically linking ctfdump, due to the use of NO_SHARED.
I can reproduce the failure locally, but as far as I can tell the
problem has been there for a long time.

> I don't see anything related in my src.conf:
> 
>     TARGET=arm
>     TARGET_ARCH=armv6
>     TARGET_CPUARCH=arm
>     TARGET_CPUTYPE=armv6softfp
>     
>     DESTDIR=/home/stephaner/c/freebsd/dest
>     KERNCONF=ARMADA38X
>     METALOG=/home/stephaner/c/freebsd/dest/METALOG
>     
>     # Jan 1, 2030 00:00:00
>     BUILD_UTC=1893452400
>     DB_FROM_SRC=1
>     NO_FSCHG=1
>     NO_ROOT=1
>     NO_SHARED=1
>     NO_RTLD=1
>     
>     WITHOUT_BEARSSL=1
>     WITHOUT_BLUETOOTH=1
>     WITHOUT_CAPSICUM=1
>     WITHOUT_CASPER=1
>     WITHOUT_CFI=1
>     WITHOUT_CLEAN=1
>     WITHOUT_DEBUG_FILES=1
>     WITHOUT_DICT=1
>     WITHOUT_GAMES=1
>     WITHOUT_GROFF=1
>     WITHOUT_KERBEROS=1
>     WITHOUT_LIB32=1
>     WITHOUT_LLVM_TARGET_ALL=1
>     WITHOUT_LOADER_VERIEXEC=1
>     WITHOUT_MAIL=1
>     WITHOUT_NLS=1
>     WITHOUT_OFED=1
>     WITHOUT_PROFILE=1
>     WITHOUT_SAFESTACK=1
>     WITHOUT_TESTS=1
>     WITHOUT_VERIEXEC=1
>     WITHOUT_WARNS=1
>     WITHOUT_WERROR=1
>     WITHOUT_ZFS=1
>     
>     WITH_BIND_NOW=1
>     WITH_CLANG=1
>     WITH_INSTALL_AS_USER=1
>     WITH_PIE=1
>     WITH_REPRODUCIBLE_BUILD=1
>     WITH_RESCUE=1
>     WITH_SHLIBRANDOM=1

What is WITH_SHLIBRANDOM?

> 
> Does anyone have a hint or any thing I could investigate?
> 
> [1] dd19f0e9c006370d33b56b6d1b66015d7afd00eb
> 
> Regards,
> -- 
> Stéphane Rochoy
> O: Stormshield
>