Re: thin linking: "file is not of required architecture"
Re: thin linking: "file is not of required architecture"
- Subject: Re: thin linking: "file is not of required architecture"
- From: Philip K.F. Hölzenspies <email@hidden>
- Date: Fri, 25 Apr 2008 15:54:56 +0200
Dear Ian, Peter, all,
Relocatability was, indeed, the problem. As a matter of fact; the
build system had explicit -bundle flags in different places. Changing
them to -dylib fixed this (btw. gcc seems to take -dynamiclib which
seems to correspond with ld's -dylib; the ld manual refers to
-dynamiclib, but actually never explains what it is).
Peter, you mentioned something about a bug you filed. Did you file
this invalid error message as a bug (because the error message *is*
wrong)? If not, should I?
I'm just a very simple unix guy, so to me there are objects (possibly
grouped in archives which are sometimes referred to as "static
(link) libraries" and shared objects ("dynamic libraries"). The bundle
thing confuses me. In the Tiger version of the compiler, all generated
shared objects are actually bundles. When I query the final executable
with "otool -L", the only anser is:
% otool -L a.out
a.out:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.10)
If I query the version from my Leopard machine (where I changed the
-bundle flags to -dy(namic)lib), the answer lists all .so files that
our compiler offered to the linker (I still need to get into dead-link
elimination, because most of them are not actually used).
Weird new problem, though; when I start the application, the dynamic
linker can't find the libraries:
% ./a.out
dyld: Library not loaded: lib/libCommandLineMod.so
[snip]
I wanted to (again) reduce this to something simple, so I have a
reduced example, now, that is linked as follows:
% ld -arch i386 -o a.out main.o *.{so,a} /usr/lib/libc.dylib /usr/lib/crt1.o
Where I have now copied all .so and .a files that I actually need to
the current directory. This links fine, but still gives the above
error upon execution. If I create a symlink, everything works:
% ln -s . lib
% ./a.out
Hello, World!
The problem seems to be that "lib/" has been recorded as part of the
shared object's name. Adding '-rpath .' doesn't actually help. How
does the recording of paths to required objects work for run-time
reference?
Thanks so much for all input already... I would just like to get this
last thing working. It all works if I fill my DYLD_LIBRARY_PATH with
all relevant lib directories, but that shouldn't actually be required
(it isn't on other platforms; if I ldd the resulting binary on linux,
the fully qualified path is in the resource table).
Regards,
Philip
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden