views:

1100

answers:

4

I have a unix command line app (with big nasty makefile) that I'm trying to run on a mac. I am compiling it on a 10.6 system, with all of the appropriate libraries of course. The deployment environment is a 10.5 system, with no extra libraries.

I compiled without -dynamic, and it appears to have static libraries, correctly. When I run it on the 10.6 system, it works. However, when I run it on the 10.5 system, I get:

dyld: unknown required load command 0x80000022

I got this same error when I compiled things for the 10.6 system using the 10.5 xcode, so it looks like a version mis-match type problem. However, I used gcc-4.0, and

$CFLAGS = -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5

so it SHOULD be set up for 10.5... any ideas?

thanks

Editing an ancient question:

I have the exact same problem on a different computer. This time I am at 10.5.8, fully update, the same executable works on 10.6 still.

Has anyone had any luck with this in the months since I asked this?

A: 

Depending on how many libraries you use, it may be difficult to get all of them linked statically. What does "otool -L your_binary' tell you?

In order to get a self-contained package for an application of my own, I made a custom MacPorts install in a non-standard directory, so that I could dynlink with the libraries from that directory and only be constrained in asking people to install the whole thing in the same place on their computers. Not great, not the Mac spirit at all, but it's an Unix app and you need to be familiar with Unix to use it anyway.

Good luck

Pascal

Pascal Cuoq
Well, At least the non-standard libraries (except for /usr/lib/X11/libexpat*, whatever that is, which got depricated at 10.5, but I still need for whatever reason) got compiled in... and that wasn't the "unknown load command" problem anyway...
Brian Postow
I had not thought it through, but now that you mention it, dynamically *loaded* libraries, which wouldn't even show up with otool -L, may have been the reason I had my own problems linking everything statically.
Pascal Cuoq
A: 

It turns out that there is a dynamic library load function (0x22) that got added at 10.5.6. The system I was running on was 10.5.5. I upgraded to 10.5.8, and everything runs!

Brian Postow
Nope, on a different computer, 10.5.8 and it DOESN'T run... dagnabit.
Brian Postow
A: 

Ok, SECOND solution, and NOT very satisfying, is to find a 10.5.8 computer, install the developer packages and re-compile... same for powerPC... sad but it will work...

Brian Postow
+1  A: 

I have been searching for the same issue, as I develop on 10.6 but must have a version that works on 10.5. In addition to the compiler flags above, you should add:

-no_compact_linkedit

It is described here:

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/ld.1.html

where it says:

Normally when targeting Mac OS X 10.6, the linker will generate compact information in the __LINKEDIT segment. This option causes the linker to instead produce traditional relocation information.

I got there from a discussion on the xcode-users mailing list about "unknown required load command 0x80000022".

todbot