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: Alastair Houghton <email@hidden>
- Date: Thu, 10 Apr 2008 16:32:32 +0100
On 10 Apr 2008, at 16:01, Philip Hölzenspies wrote:
On Apr 10, 2008, at 1:33 PM, Alastair Houghton wrote:
What does it say if you do
ld -arch i386 -o application foo.o bar.o lib1.so lib2.so lib3.so
instead? i.e. write the object files first, then the libraries,
not the other way around.
I don't quite see where that should matter (unless we're now hacking
away at ld's undocumented features).
Historically speaking, order is often significant on linker command
lines. This is one thing, actually, that has changed on 10.5
(according to the man page, the linker now continually searches static
libraries rather than the previous behaviour of scanning them only
when they were encountered). It's true that we're talking dynamic
libraries here, but nevertheless it's a good thing to check if you're
getting unexpected errors from a linker on some platform.
[snip]
The first of these is most important; it worked under Mac OS X 10.4.
Thus, only if the invocation interface of ld has changed in 10.5
should we look at the invocation. Otherwise, it should remain as is
and the actual resolution mechanism should be understood.
ld on OS X 10.5 is a totally different program to the one used on 10.4.
Nevertheless, the GCC command line is probably the place to look if
that's where the errors are coming from.
You have a lot of libraries and a number of search paths on your
command line. Are you *certain* that there aren't other versions of
your libraries in any of those paths that aren't themselves multi-
architecture?
This is the actual point I want to come to understand: How does ld
do multi-architecture resolution? -OR- What does this specific ld
invocation try to resolve? -OR- Can I let ld be so verbose that I
can see which architecture check actually fails?
You can see how it works in the ld code, which is in the ld64 project
on the Darwin Open Source page. It looks to me like it does what
you'd expect... that is, it looks through the available architectures
until it finds one that matches what it wants, then checks that the
data for that architecture is valid. If it can't find the right
architecture or if the data isn't valid, it will either display
"missing required architecture ... in file", or "file is not of
required architecture" depending on whether the file was fat or not.
The code in question is here:
<http://www.opensource.apple.com/darwinsource/10.5.2/ld64-77.1/src/ld.cpp
>
As for resolving the problem, you could try adding (to the GCC command
line) "-Wl,-t" to get the linker to tell you what it's actually loading.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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