[cfe-dev] Building clang on OSX

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 14 20:42:27 PDT 2019


Try passing `-isysroot $(xcrun -show-sdk-path)` to -DCMAKE_C_FLAGS and
DCMAKE_CXX_FLAGS.

On Thu, Mar 14, 2019 at 10:47 PM David Greene via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I'm attempting to build clang/compiler-rt/lld/libc++ on OSX using ninja.
> I get the errors below from lld when running unit tests.  It appears
> that clang doesn't know or isn't providing the necessary link paths for
> system libraries to lld.
>
> I haven't be able to find many guides about building clang on OSX.  The
> ones I have found use Xcode but for various reasons I would rather not
> have to do that.  Is Xcode the only way to build clang on OSX?  If not,
> is there a CMake variable or other setting that tells clang or lld where
> the system libraries are?
>
> Thanks for any help!
>
>                       -David
>
>
> FAIL: Builtins ::
> TestCases/Darwin/os_version_check_test_no_core_foundation.c (1 of 2)
> ******************** TEST 'Builtins ::
> TestCases/Darwin/os_version_check_test_no_core_foundation.c' FAILED
> ********************
> Script:
> --
> : '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
> : '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
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> ld64.lld: warning: ignoring unknown argument: -no_deduplicate
> ld64.lld: warning: -sdk_version is required when emitting min version load
> command.  Setting sdk version to match provided min version
> ld64.lld: error: Unable to find library for -lSystem
> clang-9: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> ******************** TEST 'Builtins ::
> TestCases/Darwin/os_version_check_test.c' FAILED ********************
> Script:
> --
> : '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
> : '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
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> ld64.lld: warning: ignoring unknown argument: -no_deduplicate
> ld64.lld: warning: -sdk_version is required when emitting min version load
> command.  Setting sdk version to match provided min version
> ld64.lld: error: Unable to find framework for -framework CoreFoundation
> clang-9: error: linker command failed with exit code 1 (use -v to see
> invocation)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190314/c13e2c96/attachment.html>


More information about the cfe-dev mailing list