Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Regression: Can't build compiler_rt on OS X with bootstrapped clang #25458

Closed Quuxplusone closed 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR25459
Status RESOLVED WONTFIX
Importance P normal
Reported by Nico Weber (nicolasweber@gmx.de)
Reported on 2015-11-09 12:37:12 -0800
Last modified on 2015-11-09 13:52:50 -0800
Version unspecified
Hardware PC All
CC chris.bieneman@gmail.com, chris.bieneman@me.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
cd /tmp
svn co --force https://llvm.org/svn/llvm-project/compiler-rt/trunk@252468
compiler-rt
mkdir compiler-rt-build && cd compiler-rt-build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -
DLLVM_ENABLE_THREADS=OFF -
DCMAKE_C_COMPILER=/Users/thakis/src/chromefetch/src/third_party/llvm-
build/Release+Asserts/bin/clang -
DCMAKE_CXX_COMPILER=/Users/thakis/src/chromefetch/src/third_party/llvm-
build/Release+Asserts/bin/clang++ -DSANITIZER_MIN_OSX_VERSION="10.7" -
DLLVM_CONFIG_PATH=/Users/thakis/src/chromefetch/src/third_party/llvm-
build/Release+Asserts/bin/llvm-config ../compiler-rt
ninja

Fails with

[1624/1624] Generating ../macho_embedded/libclang_rt.soft_static.a
FAILED: cd /Users/thakis/src/chromefetch/src/third_party/llvm-build/compiler-
rt/lib/builtins && /Applications/CMake.app/Contents/bin/cmake -E make_directory
/Users/thakis/src/chromefetch/src/third_party/llvm-build/compiler-rt/lib/darwin
&& lipo -output /Users/thakis/src/chromefetch/src/third_party/llvm-
build/compiler-rt/lib/darwin/libclang_rt.osx.a -create
error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
no input files specified
fatal error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
Usage:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo
[input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-
output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-
remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family
<arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type>
<file_name>] ...
FAILED: cd /Users/thakis/src/chromefetch/src/third_party/llvm-build/compiler-
rt/lib/builtins && /Applications/CMake.app/Contents/bin/cmake -E make_directory
/Users/thakis/src/chromefetch/src/third_party/llvm-build/compiler-rt/lib/darwin
&& lipo -output /Users/thakis/src/chromefetch/src/third_party/llvm-
build/compiler-rt/lib/darwin/libclang_rt.cc_kext.a -create
error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
no input files specified
fatal error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
Usage:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo
[input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-
output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-
remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family
<arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type>
<file_name>] ...
ninja: build stopped: subcommand failed.
Failed: ['/usr/bin/python', 'tools/clang/scripts/update.py', '--bootstrap', '--
force-local-build', '--run-tests', '--no-stdin-hack']

I think the problem is that cmake decides that there are no supported arches:

-- Got ld supported ARCHES: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m
armv7k armv7m armv7em
-- Toolchain supported arches:
armv6;armv7;armv7s;arm64;i386;x86_64;x86_64h;armv6m;armv7k;armv7m;armv7em
-- Finding valid architectures for osx...
-- OSX supported arches:
-- Finding valid architectures for 10.4...
-- OSX 10.4 supported arches: i386;x86_64
-- Finding valid architectures for iossim...
-- iOS Simulator supported arches:
-- Compiler-RT supported architectures:
-- Configuring done
-- Generating done
-- Build files have been written to:
/Users/thakis/src/chromefetch/src/third_party/llvm-build/compiler-rt

In the last working build (r247874, sadly 2 months old by now) that section
looks like so instead:

-- Got ld supported ARCHES: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m
armv7m armv7em
-- Toolchain supported arches:
armv6;armv7;armv7s;arm64;i386;x86_64;x86_64h;armv6m;armv7m;armv7em
-- Finding valid architectures for osx...
-- OSX supported arches: i386;x86_64
-- Finding valid architectures for iossim...
-- iOS Simulator supported arches: i386;x86_64
-- Compiler-RT supported architectures: i386;x86_64;i386;x86_64
-- Looking for rpc/xdr.h
-- Looking for rpc/xdr.h - not found
-- Looking for tirpc/rpc/xdr.h
-- Looking for tirpc/rpc/xdr.h - not found
-- Configuring done
Quuxplusone commented 9 years ago

Probably r249054 or r249056?

Quuxplusone commented 9 years ago

Or 244948 – it only sets DARWIN_osx_ARCHS if MACOSX_VERSION_MIN_FLAG isn't defined which looks wrong.

(I'm guessing this bug only happens with MACOSX_VERSION_MIN_FLAG set)

Quuxplusone commented 9 years ago

Yea... Don't set that. We should really make building with the version min flag a hard error. If you really want to set the version min you should be setting SANITIZER_MIN_OSX_VERSION.

Quuxplusone commented 9 years ago

Oh, that revision is old enough that our previous build has it, so that's not it. We are setting SANITIZER_MIN_OSX_VERSION, not MACOSX_VERSION_MIN_FLAG, I got confused by the similar name of the two flags.

Quuxplusone commented 9 years ago
Happens without -DSANITIZER_MIN_OSX_VERSION too. If I add this debug output:

Index: cmake/Modules/CompilerRTDarwinUtils.cmake
===================================================================
--- cmake/Modules/CompilerRTDarwinUtils.cmake   (revision 247874)
+++ cmake/Modules/CompilerRTDarwinUtils.cmake   (working copy)
@@ -71,6 +71,7 @@
                 COMPILE_DEFINITIONS "-v -arch ${arch}" ${DARWIN_${os}_CFLAGS}
                 CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${arch_linker_flags}"
                 OUTPUT_VARIABLE TEST_OUTPUT)
+    message(${TEST_OUTPUT})
     if(${CAN_TARGET_${os}_${arch}})
       list(APPEND working_archs ${arch})

then the error messages look like

Run Build Command:"/Users/thakis/src/depot_tools/ninja"
"cmTryCompileExec9199632"
[1/2] Building CXX object CMakeFiles/cmTryCompileExec9199632.dir/src.cpp.o
FAILED: /Users/thakis/src/chromefetch/src/third_party/llvm-
build/Release+Asserts/bin/clang++    -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-v -arch armv6 -stdlib=libc++ -mmacosx-version-min=10.9 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-o CMakeFiles/cmTryCompileExec9199632.dir/src.cpp.o -c
/Users/thakis/src/chromefetch/src/crttest/compiler-rt-build/CMakeFiles/src.cpp
clang version 3.8.0 (trunk 252468)
Target: arm-apple-darwin14.5.0
Thread model: posix
InstalledDir: /Users/thakis/src/chromefetch/src/third_party/llvm-
build/Release+Asserts/bin
 "/Volumes/MacintoshHD2/src/chromefetch/src/third_party/llvm-build/Release+Asserts/bin/clang-3.8" -cc1 -triple armv6k-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -main-file-name src.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -target-cpu arm1176jzf-s -target-feature +soft-float-abi -target-abi apcs-gnu -mfloat-abi soft -target-linker-version 253.3 -v -dwarf-column-info -coverage-file /Volumes/MacintoshHD2/src/chromefetch/src/crttest/compiler-rt-build/CMakeFiles/CMakeTmp/CMakeFiles/cmTryCompileExec9199632.dir/src.cpp.o -resource-dir /Volumes/MacintoshHD2/src/chromefetch/src/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Volumes/MacintoshHD2/src/chromefetch/src/crttest/compiler-rt-build/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fallow-half-arguments-and-returns -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fsjlj-exceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTryCompileExec9199632.dir/src.cpp.o -x c++ /Users/thakis/src/chromefetch/src/crttest/compiler-rt-build/CMakeFiles/src.cpp
clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target x86_64-apple-
darwin14.5.0
ignoring nonexistent directory
"/Volumes/MacintoshHD2/src/chromefetch/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Volumes/MacintoshHD2/src/chromefetch/src/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.8.0/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks (framework directory)
End of search list.
/Users/thakis/src/chromefetch/src/crttest/compiler-rt-
build/CMakeFiles/src.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.
ninja: build stopped: subcommand failed.

The bin/clang we use isn't in an installed directory  -- we run install later
and copy over libc++ headers into the package we build, but it's not around yet
when we build compiler_rt.

This used to work, let me check if we changed out scripts (likely, as the
<iostream> check in compiler-rt's CMakeFiles isn't very new). Might just be
user error.
Quuxplusone commented 9 years ago

Aha, we used to use system clang for building compiler_rt, but you told us to not do this, so now we're using the just-build clang (http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151005/303674.html). That's what's causing this.

Quuxplusone commented 9 years ago

...looks like Xcode 7's clang can build compiler-rt again, so we can switch back to system clang.

Quuxplusone commented 9 years ago

(why don't we build libcxx as part of the clang build, so that the headers exist? Because the libcxx tests don't pass in bootstrap builds, see bug 24068.