cannot specify root sdk directory with syslibroot

2019-08-19 01:56发布

问题:

I have a few static libraries I want to link with ld. My libraries are in the directories /Users/rlt/p4/lib/ and /Users/rlt/p4/usr2/lib. I want to pass in the relative paths of these directories w.r.t /Users/rlt/p4 and use the -syslibroot to point to this directory. The documentation for ld says that this option will prepend a pre-fix to all search paths. However, the following command gives me directory not found errors for both paths I specify:

ld -syslibroot /Users/rlt/p4 -L/lib -L/usr2/lib -lA -lB -lC

This gives me could not find /lib and /usr2/lib. I tried using -Lusr2/lib and -Llib with same results. What am I missing?

回答1:

-syslibroot does not prepend its argument string to arbitrary paths. It will only add it to the paths which are consistent with the sdk directory structure.



标签: macos ld