build/unix/ does not work with LLVM trunk on OSX 10.9



5 years ago
11 months ago


(Reporter: decoder, Assigned: decoder)



(Whiteboard: [kanban:engops:] )


(1 attachment)



5 years ago
There seem to be multiple issues with build/unix/ that prevent it from working properly with LLVM trunk on OSX 10.9. The first one makes stage1 fail immediately:

Apparently, building with MACOSX_DEPLOYMENT_TARGET=10.7 breaks the build because Clang tries to build against libc++ instead of libstdc++. Clang nowadays depends on some C++11 features which break then. The particular error I get is:

error: no template named 'enable_if' in namespace 'std'; did you mean '__gnu_cxx::__enable_if'?

By setting MACOSX_DEPLOYMENT_TARGET=10.9, the stage1 builds fine.

In stage2, it now fails with 

fatal error: 'cstddef' file not found

I've asked in the LLVM developers channel and someone pointed out, that XCode 5.1 no longer installs it's headers to /usr/lib on 10.9. On 10.8, this was still the case, which is why our build script worked and used the headers found there. Not sure yet how we would fix this problem, we can either install the headers or pass the proper -I flags for stage2.

Comment 1

5 years ago
I was able to fix the second problem by adding


to the extra_cxxflags variable in the python script. I am not sure though what the "proper" fix for this issue would be. We can hardcode this in the script but there is probably also a way to figure it out automatically using xcrun. I am not an XCode/Mac expert though, so I don't know how that is supposed to work.

Comment 2

5 years ago
I talked to Rafael Espindola and he gave me the advice to include libcxx in the build. I made a small patch which adds the libcxx repository to projects/ and it solved the second problem (no additional includes needed then). Attaching the patch for both changes soon.

Comment 3

5 years ago
Adjustments for

1. Use 10.9 as deployment target instead of 10.7 (otherwise Clang won't build on 10.9).

2. Add support for building with libcxx in-tree (otherwise Clang stage2 won't build on 10.9). If the libcxx repo is not specified in the JSON config, then it won't be used, so this should be backwards compatible for the 3.3 JSON config we have.

Tested on Linux and Mac.
Attachment #8484237 - Flags: review?(rail)

Comment 4

5 years ago
Comment on attachment 8484237 [details] [diff] [review]

Review of attachment 8484237 [details] [diff] [review]:

Per IRC, the patch needs to be tested. Some comments below.

::: build/unix/build-clang/
@@ +155,5 @@
> +    # Make the use of libcxx optional
> +    libcxx_repo = None
> +    if "libcxx_repo" in config:
> +        libcxx_repo = config["libcxx_repo"]

you could shortcut the 3 lines above with:
libcxx_repo = config.get("libcxx_repo")

@@ +166,5 @@
>          os.symlink("../../clang", llvm_source_dir + "/tools/clang")
>          os.symlink("../../compiler-rt",
>                     llvm_source_dir + "/projects/compiler-rt")
> +
> +        if libcxx_repo != None:

The following would be enough:
if libcxx_repo:
Attachment #8484237 - Flags: review?(rail)


4 years ago
Whiteboard: [kanban:engops:]
QA Contact: pmoore → mshal
Ehsan was wrangling this, I think he got it sorted somehow but I don't remember how. He definitely updated the clang version in use on Mac static analysis builds:


2 years ago
Severity: critical → normal


2 years ago
Component: Other → Platform Support
QA Contact: mshal → coop

Comment 6

2 years ago
I don't think this bug is useful any more.  It's probably fixed one way or another.
Last Resolved: 2 years ago
Resolution: --- → INCOMPLETE
Component: Platform Support → Buildduty
Product: Release Engineering → Infrastructure & Operations
You need to log in before you can comment on or make changes to this bug.