Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 756823 - app-admin/hardinfo-0.5.2_pre20130823 clang compiled and lld linked project fails to build (PATCH)
Summary: app-admin/hardinfo-0.5.2_pre20130823 clang compiled and lld linked project fa...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2020-11-26 12:07 UTC by Denis Pronin
Modified: 2022-11-15 02:45 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Pronin 2020-11-26 12:07:48 UTC
There are attachments including build.log, emerge.info.log, proposed patch

The problem is in multiple definitions of symbols that is detected by lld when linking libraries

Indeed, some symbols in headers are exposed not as declarations but definitions

A proposed patch is attached. It includes some specifiers to prevent compiler from thinking that the language entity declared in headers must be defined in each compilation unit they are included in

Reproducible: Always

Steps to Reproduce:
1. emerge hardinfo
Actual Results:  
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c                                                                                                                                                                       
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)                                                                                                                 
>>> defined at blowfish.c                                                                                                                                                                        
>>>            CMakeFiles/benchmark.dir/modules/benchmark/blowfish.c.o:(.bss+0x0)                                                                                                                
                                                                                                                                                                                                 
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c                                                                                                                                                                       
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)                                                                                                                 
>>> defined at cryptohash.c                                                                                                                                                                      
>>>            CMakeFiles/benchmark.dir/modules/benchmark/cryptohash.c.o:(.bss+0x0)                                                                                                              
                                                                                                                                                                                                 
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c                                                                                                                                                                       
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)                                                                                                                 
>>> defined at drawing.c                                                                                                                                                                         
>>>            CMakeFiles/benchmark.dir/modules/benchmark/drawing.c.o:(.bss+0x0)                                                                                                                 
                                                                                                                                                                                                 
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c                                                                                                                                                                       
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)            
>>> defined at fft.c                                                                                                                                                                             
>>>            CMakeFiles/benchmark.dir/modules/benchmark/fft.c.o:(.bss+0x0)                                                                                                                     
                                                                                                                                                                                                 
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c                                                                                                                                                                       
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)                                                                                                                 
>>> defined at fib.c                                                                                                                                                                             
>>>            CMakeFiles/benchmark.dir/modules/benchmark/fib.c.o:(.bss+0x0)                                                                                                                     
                                                                                                                                                                                                 
ld.lld: error: duplicate symbol: BenchmarkEntries                                                                                                                                                
>>> defined at benchmark.c
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)
>>> defined at nqueens.c
>>>            CMakeFiles/benchmark.dir/modules/benchmark/nqueens.c.o:(.bss+0x2C)

ld.lld: error: duplicate symbol: BenchmarkEntries
>>> defined at benchmark.c
>>>            CMakeFiles/benchmark.dir/modules/benchmark.c.o:(BenchmarkEntries)
>>> defined at raytrace.c
>>>            CMakeFiles/benchmark.dir/modules/benchmark/raytrace.c.o:(.bss+0x0)
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Expected Results:  
Build is successful
Comment 1 Denis Pronin 2020-11-26 12:09:13 UTC
Portage 3.0.9 (python 3.6.12-final-0, default/linux/amd64/17.1/desktop/gnome/systemd, gcc-9.3.0, glibc-2.32-r2, 5.4.72-gentoo-dannftk x86_64)
=================================================================
System uname: Linux-5.4.72-gentoo-dannftk-x86_64-Intel-R-_Core-TM-_i3-4005U_CPU_@_1.70GHz-with-gentoo-2.7
KiB Mem:    12186180 total,   4350376 free
KiB Swap:    3590140 total,   3590140 free
Head commit of repository gentoo: 7ba0655bd6bc237affd3a85693d366c086cc3cef

Timestamp of repository eclipse: Wed, 25 Nov 2020 18:29:09 +0000
Head commit of repository eclipse: a1f4fabedda98e882005d29ba09c2a78533c777c

Timestamp of repository gig: Wed, 25 Nov 2020 18:29:25 +0000
Head commit of repository gig: 39a0982a153ba1f77801740becf52ec02151e908

Timestamp of repository jm-overlay: Wed, 25 Nov 2020 18:28:53 +0000
Head commit of repository jm-overlay: 38b23a0da8bc897f773867126e74a6ba804e8077

Timestamp of repository zugaina: Wed, 25 Nov 2020 18:28:49 +0000
Head commit of repository zugaina: 77b13d3574e180a42cae8248511da7587a313332

sh bash 5.0_p18
ld GNU gold (Gentoo 2.34 p6 2.34.0) 1.16
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r4::gentoo, 3.6.12::gentoo, 3.7.9::gentoo, 3.8.6::gentoo, 3.9.0::gentoo
dev-util/cmake:           3.17.4-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.12.6-r2::gentoo, 1.15.1-r2::gentoo, 1.16.2-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/dannftk/gentoo.git
    priority: -1000

eclipse
    location: /var/db/repos/eclipse
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/eclipse.git
    masters: gentoo

gig
    location: /var/db/repos/gig
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gig.git
    masters: gentoo

jm-overlay
    location: /var/db/repos/jm-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/jm-overlay.git
    masters: gentoo

zugaina
    location: /var/db/repos/zugaina
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/zugaina.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-O2 -pipe -march=native -mtune=generic"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXX="clang++"
CXXFLAGS="-O2 -pipe -march=native -mtune=generic -std=gnu++17"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS=" -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
LINGUAS="en ru"
MAKEOPTS="-j5"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr clang cli colord compiler-rt crypt cups dbus default-compiler-rt default-libcxx default-lld dri dts dvd dvdr eds emboss encode evo exif extensions flac fortran gdbm gdm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gui hal i915 i965 iconv icu infinality intel introspection ipv4 ipv6 ithreads java jce jpeg lcms libcxx libcxxabi libglvnd libnotify libsecret libtirpc libunwind llvm mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl nsplugini ogg opengl openmp pam pango pcre pcre16 pdf png policykit ppds pulseaudio qt5 readline sdl seccomp spell split-usr ssh ssl startup-notification svg system-bootstrap system-llvm systemd tcpd tiff tracker truetype udev udisks unicode upnp-av upower usb user-session vorbis wxwidgets x264 xattr xcb xinerema xml xmp xorg xv xvid zlib zsh-completion" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="keyboard mouse synaptics evdev libinput" KERNEL="linux" L10N="en ru zh-CN" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_6 python3_7" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Denis Pronin 2020-11-26 12:10:48 UTC
proposed patch:

--- hardinfo-0.5.2_pre20130823.orig/includes/benchmark.h	2020-11-26 14:42:43.821261158 +0300
+++ hardinfo-0.5.2_pre20130823/includes/benchmark.h	2020-11-26 14:41:53.029256542 +0300
@@ -5,7 +5,7 @@
 
 extern ProgramParameters params;
 
-enum {
+typedef enum {
     BENCHMARK_BLOWFISH,
     BENCHMARK_CRYPTOHASH,
     BENCHMARK_FIB,
--- hardinfo-0.5.2_pre20130823.orig/includes/ssh-conn.h	2020-11-26 14:43:42.464314297 +0300
+++ hardinfo-0.5.2_pre20130823/includes/ssh-conn.h	2020-11-26 14:41:39.768262189 +0300
@@ -61,6 +61,6 @@
 	      gconstpointer buffer, gint num_bytes, gint * bytes_written);
 int ssh_read(gint fd, gpointer buffer, gint num_bytes, gint * bytes_read);
 
-const char *ssh_conn_errors[10];
+extern const char *ssh_conn_errors[10];
 #endif				/* HAS_LIBSOUP */
 #endif				/* __SSH_CONN_H__ */
Comment 3 Denis Pronin 2020-11-26 12:11:18 UTC
The service of attachments does not work so I pinned the patch herein
Comment 4 Pascal Jäger 2022-11-14 12:59:31 UTC
Newest version here https://github.com/gentoo/gentoo/pull/28260 builds fine with
CC=clang CXX=clang++ LD=lld
Comment 5 Larry the Git Cow gentoo-dev 2022-11-15 02:45:04 UTC
The bug has been closed via the following commit(s):

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

commit e7ea37be474e6c1847b56036f9109b1b3fe48f1e
Author:     Pascal Jäger <pascal.jaeger@leimstift.de>
AuthorDate: 2022-11-13 23:16:09 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-11-15 02:42:55 +0000

    app-admin/hardinfo: fix build for clang16
    
    Closes: https://bugs.gentoo.org/875500
    Closes: https://bugs.gentoo.org/756823
    
    Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
    Closes: https://github.com/gentoo/gentoo/pull/28260
    Signed-off-by: Sam James <sam@gentoo.org>

 app-admin/hardinfo/Manifest                        |   1 +
 .../hardinfo-0.6-fix-function-declarations.patch   | 226 +++++++++++++++++++++
 .../hardinfo/hardinfo-0.6_alpha_pre20221113.ebuild |  38 ++++
 3 files changed, 265 insertions(+)