Bug 28318 - С помощью clang3.1 не собираются программы
Summary: С помощью clang3.1 не собираются программы
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: clang (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Arseny Maslennikov
QA Contact: qa-sisyphus
URL: https://bugzilla.redhat.com/show_bug....
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-08 22:12 MSK by Vitaly Lipatov
Modified: 2014-04-11 00:41 MSK (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Lipatov 2013-01-08 22:12:00 MSK
Steps to Reproduce:
1. echo 'int main(void) {return 0;}' > testcase.c
2. clang testcase.c
  
Actual results:
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc

$ clang -v testcase.c
clang version 3.1 (branches/release_31)
Target: i386-alt-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple i386-alt-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name testcase.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.23.51.0.1 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.1 -fmodule-cache-path /tmp/.private/lav/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /tmp/.private/lav/RPM/BUILD/darling-0.0.0/CMakeFiles -ferror-limit 19 -fmessage-length 134 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/.private/lav/testcase-GCYH2L.o -x c testcase.c
clang -cc1 version 3.1 based upon LLVM 3.1 default target i386-alt-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/bin/../lib/clang/3.1/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o a.out /usr/lib/crt1.o /usr/lib/crti.o crtbegin.o -L/lib -L/usr/lib /tmp/.private/lav/testcase-GCYH2L.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /usr/lib/crtn.o
/usr/bin/ld: cannot find crtbegin.o: Нет такого файла или каталога
/usr/bin/ld: cannot find -lgcc
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Он там пытается рыться в куче каталогов, но, видимо, не находит
/usr/lib/gcc/i586-alt-linux/4.7.2

Вот strace:
openat(AT_FDCWD, "/usr/lib/gcc/i686-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i686-linux-gnu/gcc/i686-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i686-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i686-pc-linux-gnu/gcc/i686-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i686-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i486-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i486-linux-gnu/gcc/i486-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i486-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i386-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i386-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i386-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i686-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i686-redhat-linux/gcc/i686-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i686-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i586-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i586-redhat-linux/gcc/i586-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i586-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i386-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-redhat-linux/gcc/i386-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i386-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i586-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i586-suse-linux/gcc/i586-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i586-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i486-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i486-slackware-linux/gcc/i486-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i486-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/i386-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-alt-linux-gnu/gcc/i386-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/i386-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-unknown-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-unknown-linux-gnu/gcc/x86_64-unknown-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-unknown-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-pc-linux-gnu/gcc/x86_64-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-pc-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-redhat-linux6E", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-redhat-linux6E/gcc/x86_64-redhat-linux6E", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-redhat-linux6E", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-redhat-linux/gcc/x86_64-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-redhat-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-suse-linux/gcc/x86_64-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-suse-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-manbo-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-manbo-linux-gnu/gcc/x86_64-manbo-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-manbo-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-slackware-linux/gcc/x86_64-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-slackware-linux", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/gcc/x86_64-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/x86_64-alt-linux-gnu/gcc/x86_64-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 
openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/gcc/x86_64-alt-linux-gnu", O_RDONLY...) = -1 ENOENT 

Мне кажется, весь этот поиск в корне вреден.
Comment 1 Gleb F-Malinovskiy 2013-08-29 13:16:06 MSK
(In reply to comment #0)
> Мне кажется, весь этот поиск в корне вреден.

Тем не менее, так устроен clang... Его придётся пересобирать даже с минорными релизами gcc. Ну, или захакать.
Comment 2 Gleb F-Malinovskiy 2014-04-11 00:41:46 MSK
Современные версии clang (>=3.4) научились в итоге всех этих вредных проверок всё же находить разные версии нашего gcc -- лишние пересборки теперь не нужны и clang теперь не привязан к конкретной версии gcc, ему подойдёт любая.