Open
Bug 1348451
Opened 9 years ago
Updated 4 years ago
Can't build with the official clang prebuilt binaries on Mac
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
NEW
People
(Reporter: jwatt, Unassigned)
Details
Attachments
(1 file)
|
3.87 KB,
text/plain
|
Details |
I would like to build using the official clang prebuilt binaries[1] on Mac since they include tools not included with the version of clang that comes with Xcode. To try to do that I added the following to my .mozconfig:
export CC=~/src/clang+llvm-3.9.0-x86_64-apple-darwin/bin/clang
export CXX=~/src/clang+llvm-3.9.0-x86_64-apple-darwin/bin/clang++
ac_add_options --with-macos-sdk="/Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
However, building I then get this error early during configure:
DEBUG: configure:2333: checking whether the C compiler (/Users/jwatt/src/clang+llvm-3.9.0-x86_64-apple-darwin/bin/clang -std=gnu99 ) works
DEBUG: configure:2349: /Users/jwatt/src/clang+llvm-3.9.0-x86_64-apple-darwin/bin/clang -std=gnu99 -o conftest conftest.c 1>&5
DEBUG: ld: library not found for -lcrt1.10.6.o
DEBUG: clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
DEBUG: configure: failed program was:
DEBUG:
DEBUG: #line 2344 "configure"
DEBUG: #include "confdefs.h"
DEBUG:
DEBUG: main(){return(0);}
DEBUG: configure: error: installation or configuration problem: C compiler cannot create executables.
ERROR: old-configure failed
This, despite the fact that crt1.10.6.o is under the specified SDK directory in usr/lib/crt1.10.6.o
It looks like this may be happening because this configure check comes earlier in the 'configure' file than the code that reads --with-macos-sdk into MACOS_SDK_DIR and then sets MACOS_SDK_DIR in CFLAGS and CXXFLAGS.
Is it acceptable to move the --with-macos-sdk handling block further up configure.in?
1. http://releases.llvm.org/download.html
Comment 1•9 years ago
|
||
Does the build work without --with-macos-sdk? That option was added for cross builds, and really shouldn't be necessary for native ones: clang should be able to do all the work necessary to find the files on its own.
I see that we don't even use --with-macos-sdk in our mozconfigs nowadays, maybe we should just remove it...
| Reporter | ||
Comment 3•9 years ago
|
||
No, I only added --with-mac-sdk because the build failed and I was trying other things.
I also played with setting C_INCLUDE_PATH and LIBRARY_PATH to the 'include' and 'lib' directories under the SDK, but that just gave me different errors.
Flags: needinfo?(jwatt)
Comment 4•9 years ago
|
||
I wanted to use these binaries to do a static analysis build locally to test something and I hit the same issue. As a workaround I tried this:
export CC="/Users/luser/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"
export CXX="/Users/luser/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"
I haven't done a full build, but it gets through configure successfully.
Comment 5•9 years ago
|
||
I think the magic incantation might also be --enable-macos-target=10.9. I tried recommending that to erahm and he wound up with a failure to detect some headers, so maybe there's several layers of unfortunate to cut through here.
Comment 6•9 years ago
|
||
So, for the record, I don't think the llvm.org binaries have sensible defaults on OS X. I get an error compiling a hello world program because it can't locate stdio.h.
| Reporter | ||
Comment 7•9 years ago
|
||
I'm now on High Sierra using Xcode 9.0.
The clang/clang++ that comes with Xcode does not seem to be usable for --enable-clang-plugin builds. However, Ted's tip from comment 4 seems to fix things wih the clang binaries from either llvm.org or homebrew. More specifically:
The 5.0.0 "Clang for macOS" prebuilt binaries from http://releases.llvm.org/download.html seem to work fine with the following lines added to my .mozconfig:
export CC="clang+llvm-5.0.0-x86_64-apple-darwin/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
export CXX="clang+llvm-5.0.0-x86_64-apple-darwin/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
The 5.0.0 binaries that are installed by homebrew also work fine for me if I add the following to my .mozconfig:
export CC="/usr/local/Cellar/llvm/5.0.0/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
export CXX="/usr/local/Cellar/llvm/5.0.0/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
Adding or omitting:
ac_add_options --enable-macos-target=10.13
doesn't seem to have any affect on the success or failure of the build.
Updated•8 years ago
|
Product: Core → Firefox Build System
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•