-isysroot or SDKROOT problem

13,028

Solution 1

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

Solution 2

-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

Share:
13,028
Raviprakash
Author by

Raviprakash

Started career as Mac OS System Software developer. Later became Mobile App developer. Have experience and expertise in iOS and Android Mobile app development. Curious about science. Interested in software design and architecture.

Updated on June 14, 2022

Comments

  • Raviprakash
    Raviprakash almost 2 years

    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?