Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-isysroot or SDKROOT problem

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?

like image 594
Raviprakash Avatar asked Jan 22 '23 13:01

Raviprakash


1 Answers

-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).

like image 128
Paul R Avatar answered Jan 26 '23 05:01

Paul R