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: Greg Guerin <email@hidden>
- Date: Tue, 22 Apr 2008 10:40:19 -0700
Philip wrote:
>This was an over-reduced example, but whether I would want to do this or
>not, the error should DEFINATELY NOT BE that the
>files is NOT OF REQUIRED ARCHITECTURE.
I agree, except it was a WARNING, not an ERROR. Quoting the original post:
$ ld -arch i386 -r -o linked.o libMyListMod.so libMyListTree.so
ld: warning in libMyListMod.so, file is not of required architecture
ld: warning in libMyListTree.so, file is not of required architecture
The word "warning" is evident, and you didn't say whether it produced any
output or not, nor what its exit status was. Subject to further
investigation (see below), you should submit a bug that ld is emitting the
wrong message: the error is the word "architecture" in the warning.
>$ ld -r -o foobar.o foo.o bar.o X.so
>ld: warning -arch not specified
>ld: warning in libX.so, file is not of required architecture
>
>(Do I have to go and repaste the output of lipo and file applied to libX.so
>that both state it is thin an of x86,
A simple URL link suffices:
<http://lists.apple.com/archives/xcode-users/2008/Apr/msg00223.html>
>or do I have to explicitly include
>the execution of ld WITH the -arch x86 flag?)
There is no "x86" arch value. It should be:
-arch i386
or:
-arch `arch`
And yes, you should try it and see what happens.
Peter O'Gorman wrote:
> You are trying to create a reloadable object file from 2 shared
> libraries? Don't do that, you will just get an empty object file.
To explain this...
Regardless of ".so" or any other suffix, an object file has both an
ARCHITECTURE and a TYPE. The architecture can be correct but the type can
be wrong for the intended 'ld' action. For example, an executable (type)
of arch i386 cannot be used to produce a reloadable (type) object file,
despite the arch being correct and consistent.
Without making a test-case myself, my advice to the OP is to go back and
look at the TYPE of the .so files, rather than the architecture. The
'file' command will do this: it's the word that appears right before the
architecture name, e.g. "executable" for an executable. The 'lipo' command
does not appear to display the type, not even with the -detailed_info
option.
Also see the man page for 'otool', in particular the -h option.
I'd also google the keywords:
MH_OBJECT MH_EXECUTE MH_DYLIB
as these are the defined constants for the relocatable, executable, and
dylib Mach-O file types, respectively. There are other types.
So, if the actual type allows the .so files to be linked in a reloadable
object form, then the problem is probably something in 'ld'. Make a simple
fail-case and file a bug:
<http://developer.apple.com/bugreporter>
However, if the .so file's actual type is NOT the reloadable object form,
then the OP needs to look farther up the production chain to the
compilation stage that is producing the .so files, and correct that stage
so it produces relocatable object files, which 'ld' can then process.
Since the production of the .so files was not described, I have no specific
advice on what to change there.
Finally, if it turns out the .so files are the wrong type, e.g. executable
or dylib rather than relocatable, then 'ld' is clearly emitting the wrong
message. It should be warning that the file is "not of required TYPE",
rather than the misleading complaint about architecture. That should be in
the OP's bug-report.
-- GG
_______________________________________________
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