makefile - crti.o file missing -
i'm building project using gnu tool chain , works fine until linking it, linker complains missing/can't find crti.o
. not 1 of object files, seems related libc can't understand why need crti.o
, wouldn't use library file, e.g. libc.a
?
i'm cross compiling arm platform. have file in toolchain, how linker include it?
crti.o
on 1 of 'libraries' search path, should .o
file on library path?
is search path same gcc
, ld
?
crti.o
bootstrap library, quite small. it's statically linked binary. should found in /usr/lib
.
if you're running binary distribution tend put developer stuff -dev packages (e.g. libc6-dev) it's not needed run compiled programs, build them.
you're not cross-compiling you?
if you're cross-compiling it's problem gcc's search path not matching crti.o is. should have been built when toolchain was. first thing check gcc -print-search-dirs
, see if crti.o in of paths.
the linking done ld has paths passed down gcc. quickest way find out what's going on compile helloworld.c program , strace see getting passed ld , see what's going on.
strace -v -o log -f -e trace=open,fork,execve gcc hello.c -o test
open log file , search crti.o, can see non-cross compiler:
10616 execve("/usr/bin/ld", ["/usr/bin/ld", "--eh-frame-hdr", "-m", "elf_x86_64", "--hash-style=both", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o" , "test", "/usr/lib/gcc/x86_64-linux-gnu/4."..., "/usr/lib/gcc/x86_64-linux-gnu/4."..., "/usr/lib/gcc/x86_64-linux-gnu/4."..., "-l/usr/lib/gcc/x86_64-linux-g nu/"..., "-l/usr/lib/gcc/x86_64-linux-gnu/"..., "-l/usr/lib/gcc/x86_64-linux-gnu/"..., "-l/lib/../lib", "-l/usr/lib/../lib", "-l/usr/lib/gcc/x86_64-linux-gnu /"..., "/tmp/cc4rfjwd.o", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/gcc/x86_ 64-linux-gnu/4."..., "/usr/lib/gcc/x86_64-linux-gnu/4."...], "collect_gcc=gcc", "collect_gcc_options=\'-o\' \'test\' "..., "compiler_path=/usr/lib/gcc/x86_6"..., "library_path=/usr/lib/gcc/x86_64"..., "co llect_no_demangle="]) = 0 10616 open("/etc/ld.so.cache", o_rdonly) = 3 10616 open("/usr/lib/libbfd-2.18.0.20080103.so", o_rdonly) = 3 10616 open("/lib/libc.so.6", o_rdonly) = 3 10616 open("test", o_rdwr|o_creat|o_trunc, 0666) = 3 10616 open("/usr/lib/gcc/x86_64-linux-gnu/4.2.3/../../../../lib/crt1.o", o_rdonly) = 4 10616 open("/usr/lib/gcc/x86_64-linux-gnu/4.2.3/../../../../lib/crti.o", o_rdonly) = 5 10616 open("/usr/lib/gcc/x86_64-linux-gnu/4.2.3/crtbegin.o", o_rdonly) = 6 10616 open("/tmp/cc4rfjwd.o", o_rdonly) = 7
if see bunch of attempts open(...crti.o) = -1 enoent
, ld
getting confused , want see path it's opening came from...
Comments
Post a Comment