clang not building correctly
Looks like clang-3.2-r1 from edge won’t build a working executable even for a simple one line program. Am I missing something?
$ cat test.c
int main(void) {return 0;}
$ clang -o test test.c
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find crtend.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
$ clang —version
clang version 3.2 (tags/RELEASE_32/final)
Target: i386-pc-linux-gnu
Thread model: posix
$ # huh, maybe it can’t find crtbegin.o and crtend.o because it’s
configured with the wrong target?
$ clang -target i486-alpine-linux-uclibc -o test test.c
$ # ok, that SEEMED to work
$ ls -l test2
-rwxr-xr-x 1 jim users 3766 Apr 19 23:39 test2
$ ldd test2
checking sub-depends for ‘/lib/libc.so.0.9.32’
checking sub-depends for ‘/lib/ld-uClibc.so.0.9.32’
libc.so.0.9.32 =>/lib/libc.so.0.9.32 (0x00000000)
ld-uClibc.so.0.9.32 =>/lib/ld-uClibc.so.0.9.32 (0x00000000)
not a dynamic executable
$ # why is it “not a dynamic executable”? I don’t get that message when
gcc builds it
$ # Also, are the addresses for the libraries ok?
$ # When gcc builds test.c, I get an executable with non-zero addresses
instead
$ # Let’s see if we can execute the binary that clang built…
$ ./test2
ash: ./test2: not found
$ # nope
(from redmine: issue id 1798, created on 2013-04-20, closed on 2013-05-27)
- Changesets:
- Revision fcc33438 by Natanael Copa on 2013-04-23T15:43:13Z:
main/llvm: make it compile
- make it find dynamic linker
- set the target to i486-alpine-linux-uclibc
fixes #1798
- Uploads:
- alpine-llvm.patch
- alpine-llvm-aports.patch update aports to clang-3.2-r2