hithwen
hithwen

Reputation: 2203

MacOS compile from Mavericks Lion compatible executable

Since I updated to Mavericks my C app, compiled in my machine with clang, cannot be executed in Lion machines (yep, there are some people who have not updated). It throws

Segmentation fault: 11 error

I've read about stdlib option in this thread but it seems it only applies to clang++ and not to plain clang. Is there a similar option for clang? I've searched for --stdlib=libstdc in google but all results are for --stdlib=libstdc++

Upvotes: 1

Views: 212

Answers (2)

user1502657
user1502657

Reputation:

I'm not sure the intent of the question, but Lion is actually 10.7, Mountain Lion is 10.8. Obviously, you wouldn't want to set the deployment target to 10.8, if you were targeting Lion (10.7). Both the previous comments and answer are conflicting in that regard.

*Note: I can't comment on them, as I don't have enough rep!

Upvotes: 0

Martin R
Martin R

Reputation: 539975

To compile an app for OS X 10.8 (Lion), you have to set the "Deployment Target". The corresponding command line option for clang is

-mmacosx-version-min=10.8

You might also want to set the SDK to 10.8, to avoid that any library functions are used that are available only in 10.9:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Upvotes: 3

Related Questions