<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Try passing `-isysroot $(xcrun -show-sdk-path)` to -DCMAKE_C_FLAGS and DCMAKE_CXX_FLAGS.</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 14, 2019 at 10:47 PM David Greene via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm attempting to build clang/compiler-rt/lld/libc++ on OSX using ninja.<br>
I get the errors below from lld when running unit tests.  It appears<br>
that clang doesn't know or isn't providing the necessary link paths for<br>
system libraries to lld.<br>
<br>
I haven't be able to find many guides about building clang on OSX.  The<br>
ones I have found use Xcode but for various reasons I would rather not<br>
have to do that.  Is Xcode the only way to build clang on OSX?  If not,<br>
is there a CMake variable or other setting that tells clang or lld where<br>
the system libraries are?<br>
<br>
Thanks for any help!<br>
<br>
                      -David<br>
<br>
<br>
FAIL: Builtins :: TestCases/Darwin/os_version_check_test_no_core_foundation.c (1 of 2)<br>
******************** TEST 'Builtins :: TestCases/Darwin/os_version_check_test_no_core_foundation.c' FAILED ********************<br>
Script:<br>
--<br>
: 'RUN: at line 1';      /Users/greened/llvm-project/build/x86_64/./bin/clang  /Users/greened/llvm-project/llvm-project/compiler-rt/test/builtins/TestCases/Darwin/os_version_check_test_no_core_foundation.c -o /Users/greened/llvm-project/build/x86_64/projects/compiler-rt/test/builtins/TestCases/Darwin/Output/os_version_check_test_no_core_foundation.c.tmp -mmacosx-version-min=10.6<br>
: 'RUN: at line 2';    /Users/greened/llvm-project/build/x86_64/projects/compiler-rt/test/builtins/TestCases/Darwin/Output/os_version_check_test_no_core_foundation.c.tmp<br>
--<br>
Exit Code: 1<br>
<br>
Command Output (stderr):<br>
--<br>
ld64.lld: warning: ignoring unknown argument: -no_deduplicate<br>
ld64.lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version<br>
ld64.lld: error: Unable to find library for -lSystem<br>
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)<br>
<br>
******************** TEST 'Builtins :: TestCases/Darwin/os_version_check_test.c' FAILED ********************<br>
Script:<br>
--<br>
: 'RUN: at line 1';      /Users/greened/llvm-project/build/x86_64/./bin/clang  /Users/greened/llvm-project/llvm-project/compiler-rt/test/builtins/TestCases/Darwin/os_version_check_test.c -o /Users/greened/llvm-project/build/x86_64/projects/compiler-rt/test/builtins/TestCases/Darwin/Output/os_version_check_test.c.tmp -mmacosx-version-min=10.6 -framework CoreFoundation -DMAJOR=10 -DMINOR=14 -DSUBMINOR=3<br>
: 'RUN: at line 2';    /Users/greened/llvm-project/build/x86_64/projects/compiler-rt/test/builtins/TestCases/Darwin/Output/os_version_check_test.c.tmp<br>
--<br>
Exit Code: 1<br>
<br>
Command Output (stderr):<br>
--<br>
ld64.lld: warning: ignoring unknown argument: -no_deduplicate<br>
ld64.lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version<br>
ld64.lld: error: Unable to find framework for -framework CoreFoundation<br>
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>