Closed Bug 1350036 Opened 7 years ago Closed 7 years ago

MACOSX_DEPLOYMENT_TARGET needed when building with LLVM from source

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jryans, Assigned: jryans)

References

Details

Attachments

(1 file)

In order to enable Stylo on macOS 10.12, I installed LLVM via `brew install llvm`.  (In the past, I have compiled Gecko just fine with Apple's supplied clang.)

When using this particular LLVM (clang version 4.0.0), ./mach configure fails with:

```
     0:09.18 checking for gcc... /usr/local/opt/llvm/bin/clang -std=gnu99
     0:09.24 checking whether the C compiler (/usr/local/opt/llvm/bin/clang -std=gnu99  ) works... no
     0:09.24 configure: error: installation or configuration problem: C compiler cannot create executables.
     0:09.24 DEBUG: <truncated - see config.log for full output>
     0:09.24 DEBUG:
     0:09.24 DEBUG: configure:897: checking host system type
     0:09.24 DEBUG: configure:918: checking target system type
     0:09.24 DEBUG: configure:936: checking build system type
     0:09.24 DEBUG: configure:2220: checking for gcc
     0:09.24 DEBUG: configure:2333: checking whether the C compiler (/usr/local/opt/llvm/bin/clang -std=gnu99  ) works
     0:09.24 DEBUG: configure:2349: /usr/local/opt/llvm/bin/clang -std=gnu99 -o conftest    conftest.c  1>&5
     0:09.24 DEBUG: configure:2346:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
     0:09.24 DEBUG: main(){return(0);}
     0:09.24 DEBUG: ^
     0:09.24 DEBUG: 1 warning generated.
     0:09.24 DEBUG: ld: library not found for -lcrt1.10.6.o
     0:09.24 DEBUG: clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
     0:09.24 DEBUG: configure: failed program was:
     0:09.24 DEBUG:
     0:09.24 DEBUG: #line 2344 "configure"
     0:09.24 DEBUG: #include "confdefs.h"
     0:09.24 DEBUG:
     0:09.24 DEBUG: main(){return(0);}
     0:09.24 DEBUG: configure: error: installation or configuration problem: C compiler cannot create executables.
     0:09.24 ERROR: old-configure failed
     0:09.27 *** Fix above errors and then restart with               "/Applications/Xcode.app/Contents/Developer/usr/bin/make -f client.mk build"
     0:09.27 make: *** [configure] Error 1 
```

On IRC, :froydnj suggested setting MACOSX_DEPLOYMENT_TARGET=10.9, and indeed that works.  We should pass this along by default where needed.
:bholley, have you heard of anyone else hitting this on macOS?  If it's not just me, maybe we need to fix this before we can build Stylo by default?
Flags: needinfo?(bobbyholley)
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1)
> :bholley, have you heard of anyone else hitting this on macOS?  If it's not
> just me, maybe we need to fix this before we can build Stylo by default?

Hm, I don't think the expectation is to compile Gecko with the homebrew clang, just to run bindgen. I'm not sure why that's happening. I thought llvm was supposed to be a keg-only thing - did you tap it?
Flags: needinfo?(bobbyholley)
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #2)
> (In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1)
> > :bholley, have you heard of anyone else hitting this on macOS?  If it's not
> > just me, maybe we need to fix this before we can build Stylo by default?
> 
> Hm, I don't think the expectation is to compile Gecko with the homebrew
> clang, just to run bindgen. I'm not sure why that's happening. I thought
> llvm was supposed to be a keg-only thing - did you tap it?

I believe what happened is:

1. I installed LLVM 3.9 with `brew install llvm@3.9`
2. Try `./mach configure`, it errors with:

 0:01.69 checking for llvm-config... not found
 0:01.69 ERROR: Could not find LLVM/Clang installation for compiling stylo build-time
 0:01.69 bindgen.  Please put 'llvm-config' in your PATH, specify the
 0:01.69 'LLVM_CONFIG' environment variable, or pass the '--with-libclang-path'
 0:01.69 and '--with-clang-path' options to configure.

3. To satisfy this, I added `$(brew --prefix llvm@3.9)/bin` to my PATH (before /usr/bin).  However, this exposes not only `llvm-config` but also `clang` as well, overriding the system `clang` at /usr/bin/clang.

Looking at what was done in bug 1314355 for the bootstrap workflow, it appears we're recommending to instead export only the LLVM_CONFIG env var in .mozconfig.  Changing to that seems to work.

So, I guess we don't need to fix anything here, at least not for Stylo.
I'll leave it up to the build peers to decide if this is useful to investigate for other use cases of custom `clang` versions, or to close since Stylo is able to proceed without it.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Maybe putting LLVM_CONFIG first in that error message in comment 3 would help a little.
Comment on attachment 8868151 [details]
Bug 1350036 - Clarify llvm-config detection error.

https://reviewboard.mozilla.org/r/139764/#review143074

Thanks!
Attachment #8868151 - Flags: review?(nfroyd) → review+
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/21ae7e6b4b44
Clarify llvm-config detection error. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/21ae7e6b4b44
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee: nobody → jryans
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: