Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 914757 - clang: error: linker command failed with exit code 1
Summary: clang: error: linker command failed with exit code 1
Status: RESOLVED DUPLICATE of bug 914468
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-26 18:30 UTC by Jordan
Modified: 2023-09-26 18:31 UTC (History)
0 users

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 Jordan 2023-09-26 18:30:48 UTC
After "emerge -uDN --with-bdeps=y --complete-graph=y @world":

clang -v 
clang version 17.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/17/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg
System configuration file directory: /etc/clang
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/x86_64-pc-linux-gnu-ld.bfd" -pie --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/13 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib -L/lib -L/usr/lib -z relro -z now -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crtn.o
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


cat /etc/clang/x86_64-pc-linux-gnu-clang.cfg
# This configuration file is used by x86_64-pc-linux-gnu-clang driver.
@gentoo-common.cfg
@gentoo-common-ld.cfg

cat /etc/clang/gentoo-common.cfg
# This file contains flags common to clang, clang++ and clang-cpp.
@gentoo-runtimes.cfg
@gentoo-gcc-install.cfg
@gentoo-hardened.cfg
# bug #870001
-include "/usr/include/gentoo/maybe-stddefs.h"

cat /etc/clang/gentoo-runtimes.cfg
# This file is initially generated by sys-devel/clang-runtime.
# It is used to control the default runtimes using by clang.

--rtlib=libgcc
--unwindlib=libgcc
--stdlib=libstdc++
-fuse-ld=bfd

cat /etc/clang/gentoo-gcc-install.cfg 
# This file is maintained by gcc-config.
# It is used to specify the selected GCC installation.
--gcc-install-dir="/usr/lib/gcc/x86_64-pc-linux-gnu/13"

cat /etc/clang/gentoo-hardened.cfg 
# Some of these options are added unconditionally, regardless of
# USE=hardened, for parity with sys-devel/gcc.
-fstack-clash-protection
-fstack-protector-strong
-fPIE
-include "/usr/include/gentoo/fortify.h"
# Options below are conditional on USE=hardened.
-D_GLIBCXX_ASSERTIONS

# Analogue to GLIBCXX_ASSERTIONS
-D_LIBCPP_ENABLE_ASSERTIONS=1

cat /etc/clang/gentoo-common-ld.cfg
# This file contains flags common to clang and clang++
@gentoo-hardened-ld.cfg

cat /etc/clang/gentoo-hardened-ld.cfg
# Some of these options are added unconditionally, regardless of
# USE=hardened, for parity with sys-devel/gcc.
-Wl,-z,relro
# Options below are conditional on USE=hardened.
-Wl,-z,now

***********************************************************************
I have another gentoo system which is not yet updated, so i can see the same command before "emerge -uDN --with-bdeps=y --complete-graph=y @world":

clang -v
clang version 16.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/16/bin
Configuration file: /etc/clang/clang.cfg
System configuration file directory: /etc/clang
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64

cat /etc/clang/clang.cfg
# This configuration file is used by clang driver.
@gentoo-common.cfg

All the remaining existing .cfg files with the same name are the same.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-09-26 18:31:20 UTC
fwiw this is mostly harmless, but see discussion in bug 914468

*** This bug has been marked as a duplicate of bug 914468 ***