Well, this is the situation: I'm trying to use some old software: it works fine on Ubuntu Lucid, does not work on Natty.
So, I strace d around the bit, and it turns out that this software calls ld , and ld ultimately fails with:
.../ld: crt1.o: No such file: No such file or directory
... yes, the old crti.o file is missing an error :) However, I would like to ask a question in more general terms ...
The fact is that this is a "standalone" (older) ld here, and when I run .../ld -verbose | less .../ld -verbose | less , I get:
... SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); ...
Now the fact is that:
- In Lucid,
crt1.o is in /usr/lib/crt1.o - In Natty,
crt1.o is located in /usr/lib/i386-linux-gnu/crt1.o
... so it is not surprising why crt1.o cannot be found, I think. It seems that all I need to do is tell ld to look for crt1.o in /usr/lib/i386-linux-gnu , but how to do it?
I thought I could use the -L option, but man ld says:
to link a file "hello.o": ld -o <output> /lib/crt0.o hello.o -lc This tells ld to produce a file called output as the result of linking the file "/lib/crt0.o" with "hello.o" and the library "libc.a", which will come from the standard search directories. ... -L searchdir --library-path=searchdir Add path searchdir to the list of paths that ld will search for archive libraries and ld control scripts.
... The value of " -L " will affect where we look for " libc.a " (in the human example), but not for object files.
I would prefer an environment variable for this, but I tried both LD_PRELOAD_PATH and LD_LIBRARY_PATH no avail (I think they are associated with "shared objects" and these .o files are not one of those).
Does anyone know if there is an environment variable (preferably - or if not, a command line option for ld ) that will control where ld searches for .o object files?
As a side note, I think I could just symbolize /usr/lib/i386-linux-gnu/crt1.o in /usr/lib/ , but I would prefer to use an environment variable if it exists ... If not, are there any other possible solutions?
Thanks in advance for any answers,
Hooray!
EDIT: possibly relevant: Daniel Kegel - --with-sysroot newbie: "ld: cannot open crt1.o"