-isysroot or SDKROOT

I am new to libhistory, so I looked at the sample found with the readline library. Compiled on the command line using:

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

He then broke the xcode project with the same file and linked it to the readline library that it compiles. But when I run, it will not support history and crash when listing history records. After some testing, I found that the -isysroot argument is the cause of this problem:

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

Why does the same program behave differently with this option?

+4
source share
2 answers

-isysroot is used to determine the SDK with which you are building. If you build with the 10.6 SDK, and then try and run OS X 10.5, you are likely to fail. You should build taking into account which SDK corresponds to the minimum necessary OS for your program (for maximum backward compatibility).

+4
source

-isysroot / Developer / SDKs / MacOSX10.6.sdk sysroot will overwrite the system path / usr / local, etc.

In my opinion, the problematic way to use the SDK path is Xcode. This will lead to a nonexistent path like / Developer / SDKs / MacOSX 10.6.sdk / usr / local / lib / if you want to search in the user link -L / usr / local / lib /

I don’t think it’s a good idea to change sysroot at all just to use the SDK

+4
source

Source: https://habr.com/ru/post/1301550/


All Articles