Have exact same problem on fedora 31, as it was in bug 1749971 on fedora 30 - and surprised that the fixed was not carried over. Versions: $ rpm -q gcc-x86_64-linux-gnu gcc-x86_64-linux-gnu-9.2.1-1.fc31.x86_64 $ rpm -q clang clang-9.0.1-2.fc31.x86_64 +++ This bug was initially created as a clone of Bug #1749971 +++ Description of problem: When clang is supposed to natively link a C program, it picks the gcc installation in /usr/lib/gcc/x86_64-linux-gnu/9 instead of the one in /usr/lib/gcc/x86_64-redhat-linux/9 and fails with "/usr/bin/ld: cannot find -lgcc_s" instead of producing a native executable. Version-Release number of selected component (if applicable): clang-8.0.0-1.fc30.x86_64 with the following two packages installed gcc-9.2.1-1.fc30.x86_64 gcc-x86_64-linux-gnu-9.1.1-1.fc30.x86_64 How reproducible: 100% Steps to Reproduce: 1. dnf -y install clang 2. clang -o basic-main basic-main.c # this works 3. dnf -y install gcc-x86_64-linux-gnu 4. clang -o basic-main basic-main.c # this fails Actual results: /usr/bin/ld: cannot find -lgcc_s clang-8: error: linker command failed with exit code 1 (use -v to see invocation) Expected results: No error message, and an executable file to run natively. Additional info: ### The basic C code example file basic-main.c ### #include <stdio.h> int main(void) { printf("basic main program\n"); return 0; } ### The error case with "clang -v -o basic-main basic-main.c" ### clang version 8.0.0 (Fedora 8.0.0-1.fc30) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/bin/clang-8" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name basic-main.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/ndim/clang-and-gcc-bug -ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/basic-main-606e4c.o -x c basic-main.c -faddrsig clang -cc1 version 8.0.0 based upon LLVM 8.0.0 default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib64/clang/8.0.0/include /usr/include End of search list. "/usr/bin/ld" --hash-style=gnu --no-add-needed --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o basic-main /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/basic-main-606e4c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../lib64/crtn.o /usr/bin/ld: cannot find -lgcc_s clang-8: error: linker command failed with exit code 1 (use -v to see invocation) ### The success case with "clang -v -o basic-main basic-main.c" ### clang version 8.0.0 (Fedora 8.0.0-1.fc30) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/9 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/bin/clang-8" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name basic-main.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/ndim/clang-and-gcc-bug -ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/basic-main-aabab6.o -x c basic-main.c -faddrsig clang -cc1 version 8.0.0 based upon LLVM 8.0.0 default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib64/clang/8.0.0/include /usr/include End of search list. "/usr/bin/ld" --hash-style=gnu --no-add-needed --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o basic-main /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-redhat-linux/9/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-redhat-linux/9 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/basic-main-aabab6.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-redhat-linux/9/crtend.o /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crtn.o --- Additional comment from Tom Stellard on 2019-09-07 04:21:39 UTC --- Pull request: https://src.fedoraproject.org/rpms/clang/pull-request/40 --- Additional comment from Fedora Update System on 2019-09-26 00:10:33 UTC --- FEDORA-2019-30920cc6e1 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-30920cc6e1 --- Additional comment from Fedora Update System on 2019-09-27 02:18:48 UTC --- clang-8.0.0-3.fc30, llvm-test-suite-8.0.0-3.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-30920cc6e1 --- Additional comment from Fedora Update System on 2019-10-04 21:24:09 UTC --- clang-8.0.0-3.fc30, llvm-test-suite-8.0.0-3.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.
In addition, c++ include path is also screwed up: $ clang++ -v oclang/test.cpp clang version 9.0.1 (Fedora 9.0.1-2.fc31) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/i686-redhat-linux/9 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/9 Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/bin/clang-9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/9.0.1 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-unknown-linux-gnu/c++/9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/9.0.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/Hin-Tak/git-others/osxcross-up -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/test-f742da.o -x c++ oclang/test.cpp clang -cc1 version 9.0.1 based upon LLVM 9.0.1 default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-unknown-linux-gnu/c++/9" ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward /usr/local/include /usr/lib64/clang/9.0.1/include /usr/include End of search list. In file included from oclang/test.cpp:1: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream:38:10: fatal error: 'bits/c++config.h' file not found #include <bits/c++config.h> ^~~~~~~~~~~~~~~~~~ 1 error generated.
The fc30 fix needs to go into fc31 (and possibly fc32, etc too).
FEDORA-2020-3a2812cd4d has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a2812cd4d
FEDORA-2020-3a2812cd4d has been pushed to the Fedora 31 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-3a2812cd4d` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a2812cd4d See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2020-3a2812cd4d has been pushed to the Fedora 31 stable repository. If problem still persists, please make note of it in this bug report.
This message is a reminder that Fedora 31 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '31'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 31 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Just verified the bug persists on Fedora 33 with the following package versions: clang-11.0.0-1.fc33.x86_64 gcc-x86_64-linux-gnu-10.2.1-3.fc33.x86_64
FEDORA-2020-7987e5f6e1 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-7987e5f6e1
Hans, can you confirm https://bodhi.fedoraproject.org/updates/FEDORA-2020-7987e5f6e1 fixes the issue?
(In reply to serge_sans_paille from comment #9) > Hans, can you confirm > https://bodhi.fedoraproject.org/updates/FEDORA-2020-7987e5f6e1 fixes the > issue? Serge, yes, that fixes the issue (and for some reason, I cannot give it a thumbs up in the bodhi web interface). BTW, should I pre-file the same issue for F34, as we can apparently expect it to re-occur? :-)
FEDORA-2020-7987e5f6e1 has been pushed to the Fedora 33 stable repository. If problem still persists, please make note of it in this bug report.