[cfe-dev] Building clang on OSX

Jean-Daniel via cfe-dev cfe-dev at lists.llvm.org
Fri Mar 15 12:17:59 PDT 2019


Moreover, new Apple SDKs don’t include libraries anymore, and uses tbd files instead. That’s probably why lld can’t find System library.


> Le 15 mars 2019 à 19:58, Shoaib Meenai via cfe-dev <cfe-dev at lists.llvm.org> a écrit :
> 
> LLD for Mach-O has bitrotted significantly and isn't really functional anymore (beyond the most basic programs). I'd recommend sticking with ld64 as the linker.
> 
> On 3/15/19, 10:52 AM, "cfe-dev on behalf of David Greene via cfe-dev" <cfe-dev-bounces at lists.llvm.org <mailto:cfe-dev-bounces at lists.llvm.org> on behalf of cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> 
>    Nico Weber <thakis at chromium.org> writes:
> 
>> Try passing `-isysroot $(xcrun -show-sdk-path)` to -DCMAKE_C_FLAGS and DCMAKE_CXX_FLAGS.
> 
>    Unfortunately, that did not work.  It's not the compiler building clang
>    that can't find the libraries, it's the built clang that's having
>    trouble.  Is there some CMake variable to give the built clang a set of
>    default options to use?
> 
>                             -David
> 
>> 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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_N4QJ3jEb7yLs0RYi6gtqi2qNCzUJpWDEseQpWEkqT0&s=e-cPJFuE65rzuwsXlfMM4gq7Q7fsOSy1YwMOAvXl3JY&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_N4QJ3jEb7yLs0RYi6gtqi2qNCzUJpWDEseQpWEkqT0&s=e-cPJFuE65rzuwsXlfMM4gq7Q7fsOSy1YwMOAvXl3JY&e=>
>    _______________________________________________
>    cfe-dev mailing list
>    cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_N4QJ3jEb7yLs0RYi6gtqi2qNCzUJpWDEseQpWEkqT0&s=e-cPJFuE65rzuwsXlfMM4gq7Q7fsOSy1YwMOAvXl3JY&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_N4QJ3jEb7yLs0RYi6gtqi2qNCzUJpWDEseQpWEkqT0&s=e-cPJFuE65rzuwsXlfMM4gq7Q7fsOSy1YwMOAvXl3JY&e=>
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <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/20190315/d31b6aab/attachment.html>


More information about the cfe-dev mailing list