4

I am a newbie to libhistory, so I was looking at the sample found with readline library. Compiled it on command prompt using:

gcc -o ./a.out /usr/local/share/readline/histexamp.c -lreadline -L/usr/local/lib/
It compiles and maintains history.

Then crated a xcode project with the same file and linked against readline library it compiles fine. But when I run , it won't maintain history and crashing while enumeration of history entries. After some trials i found that -isysroot argument is the cause for this problem:

-isysroot /Developer/SDKs/MacOSX10.6.sdk
The gcc man page says isysroot is like the --sysroot option, but applies only to header files.

Why the same program behaves differently with this option?

3

2 Answers 2

5

-isysroot is used to define the SDK that you build with. If you build with the 10.6 SDK and then try and run on OS X 10.5 then you will probably fail. You should build with whichever SDK corresponds to the minimum required OS for your program (for maximum backward-compatibility).

3
-isysroot /Developer/SDKs/MacOSX10.6.sdk

the sysroot will overwrite the system path /usr/local etc.

In my opinion, it is a problematic way to use the SDK path by XCode. It will result in a non-existent path like /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/ if you want to search in the user link -L/usr/local/lib/

I don't think it is a good idea at all to change sysroot just in order to use SDK

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.