Yes, this is a aspect of the larger problem that clang bootstrap doesn't work for a cross-compiler. The build (mostly?) assumes that host==target during the build of clang itself, and then if you want another architecture also, you run a second build of the target libraries, and manually merge the trees.
If you think about compiler-rt as being compiled for the target rather than the host, the problem you describe here is exactly the same one, and we have been getting lucky.
At the moment, the blaze builds of clang do exactly the procedure described above, so this hasn't been a terrible problem for Google, but I do think it is something that should be fixed (I'm working on another aspect of compiler-rt bringup at the moment, so won't solve this in the immediate future.)
gnu systems have a make variable, "CC_FOR_TARGET" that addresses this problem. I imagine llvm should adopt a similar mechanism inside cmake.
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
David,
This is an area that has had a lot of development over the last two years.
There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.
1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
On Mar 8, 2017, at 3:08 PM, Hal Finkel <hfi...@anl.gov> wrote:
On 03/08/2017 04:55 PM, Chris Bieneman via llvm-dev wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
Why is this not the default?
David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
2) The new way, is to place compiler-rt under LLVM/runtimes. In this path the build system will automatically build with the just-built compiler. This path also splits compiler-rt into two separate build steps, one that configures and builds the builtins with the just-built compiler, and a second that configures and builds the sanitizer libraries.
On Mar 8, 2017, at 3:16 PM, David Blaikie <dbla...@gmail.com> wrote:On Wed, Mar 8, 2017 at 2:55 PM Chris Bieneman <be...@apple.com> wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.I thought the BUILD_EXTERNAL variables were for use when projects were not embedded within the llvm source tree (mostly in use by Takumi's flat buildbots that checout the top-level project without embedding, say, clang or compiler-rt within the llvm source tree)?
2) The new way, is to place compiler-rt under LLVM/runtimes. In this path the build system will automatically build with the just-built compiler. This path also splits compiler-rt into two separate build steps, one that configures and builds the builtins with the just-built compiler, and a second that configures and builds the sanitizer libraries.
Huh, OK - could someone remove the legacy format, then? If it's a trap.
That said, I tried putting compiler-rt in runtimes instead of projects and I got a bunch of cmake errors starting with:CMake Error at /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/lib/cmake/llvm/AddLLVM.cmake:1174 (add_dependencies):The dependency target "GotsanRuntimeCheck" of target "check-runtimes" doesnot exist.Call Stack (most recent call first):CMakeLists.txt:110 (add_lit_target)
Any ideas?
On Mar 8, 2017, at 3:14 PM, Chris Bieneman via llvm-dev <llvm...@lists.llvm.org> wrote:On Mar 8, 2017, at 3:08 PM, Hal Finkel <hfi...@anl.gov> wrote:
On 03/08/2017 04:55 PM, Chris Bieneman via llvm-dev wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
Why is this not the default?Two reasons. (1) It is buggy, and nobody fixed the issues because (2) the long-term plan is to not support building compiler-rt (or any other runtime library) under llvm/projects. The goal is to migrate entirely to llvm/runtimes where the support is more complete.
On Mar 8, 2017, at 3:16 PM, David Blaikie <dbla...@gmail.com> wrote:On Wed, Mar 8, 2017 at 2:55 PM Chris Bieneman <be...@apple.com> wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.I thought the BUILD_EXTERNAL variables were for use when projects were not embedded within the llvm source tree (mostly in use by Takumi's flat buildbots that checout the top-level project without embedding, say, clang or compiler-rt within the llvm source tree)?You are confusing this with the similarly named LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR variables.
2) The new way, is to place compiler-rt under LLVM/runtimes. In this path the build system will automatically build with the just-built compiler. This path also splits compiler-rt into two separate build steps, one that configures and builds the builtins with the just-built compiler, and a second that configures and builds the sanitizer libraries.
Huh, OK - could someone remove the legacy format, then? If it's a trap.I'm not sure the new path is fully supported in every workflow, so removing it seems like a not great idea at the moment.
That said, I tried putting compiler-rt in runtimes instead of projects and I got a bunch of cmake errors starting with:CMake Error at /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/lib/cmake/llvm/AddLLVM.cmake:1174 (add_dependencies):The dependency target "GotsanRuntimeCheck" of target "check-runtimes" doesnot exist.Call Stack (most recent call first):CMakeLists.txt:110 (add_lit_target)
Any ideas?I have never encountered that issue. It looks like the tsan test code is out of sync. If you go into tsan/test/CMakeLists.txt and on Line 2 add this to the if statement "AND TARGET GotsanRuntimeCheck" that should fix the issue.
On Mar 8, 2017, at 3:14 PM, Chris Bieneman via llvm-dev <llvm...@lists.llvm.org> wrote:On Mar 8, 2017, at 3:08 PM, Hal Finkel <hfi...@anl.gov> wrote:
On 03/08/2017 04:55 PM, Chris Bieneman via llvm-dev wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
Why is this not the default?Two reasons. (1) It is buggy, and nobody fixed the issues because (2) the long-term plan is to not support building compiler-rt (or any other runtime library) under llvm/projects. The goal is to migrate entirely to llvm/runtimes where the support is more complete.From a compiler developers point of view I wanted to stress that we at least should keep the option not to do it, as in my experience development workflow heavily slows down if you have to wait around for compiler-rt to rebuild after every small change you make to the compiler.
Of course I agree that we should switch the default to something that uses the just-built compiler so people unaware of these issues get the safe and correct thing.- Matthias
On Mar 8, 2017, at 4:44 PM, David Blaikie <dbla...@gmail.com> wrote:On Wed, Mar 8, 2017 at 3:52 PM Matthias Braun via llvm-dev <llvm...@lists.llvm.org> wrote:On Mar 8, 2017, at 3:14 PM, Chris Bieneman via llvm-dev <llvm...@lists.llvm.org> wrote:On Mar 8, 2017, at 3:08 PM, Hal Finkel <hfi...@anl.gov> wrote:
On 03/08/2017 04:55 PM, Chris Bieneman via llvm-dev wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.
Why is this not the default?Two reasons. (1) It is buggy, and nobody fixed the issues because (2) the long-term plan is to not support building compiler-rt (or any other runtime library) under llvm/projects. The goal is to migrate entirely to llvm/runtimes where the support is more complete.From a compiler developers point of view I wanted to stress that we at least should keep the option not to do it, as in my experience development workflow heavily slows down if you have to wait around for compiler-rt to rebuild after every small change you make to the compiler.If that's a valid option, I'd be open to it - it does really slow down the dev cycle & it's one of the reasons I often end up moving compiler-rt out/not building it anymore.
I'm not sure if that's an option at the moment - if it is, I'd love to know how to do that & it might at least unblock my use case anyway, even if there's still a need for a broader fix.
On Mar 8, 2017, at 4:42 PM, David Blaikie <dbla...@gmail.com> wrote:On Wed, Mar 8, 2017 at 3:23 PM Chris Bieneman <be...@apple.com> wrote:On Mar 8, 2017, at 3:16 PM, David Blaikie <dbla...@gmail.com> wrote:On Wed, Mar 8, 2017 at 2:55 PM Chris Bieneman <be...@apple.com> wrote:David,This is an area that has had a lot of development over the last two years.There are two supported ways in the LLVM build system to build compiler-rt with the just-built compiler.1) The legacy way is for if compiler-rt is under LLVM/projects. You can specify -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On, which will configure compiler-rt using the just-built clang after clang is built.I thought the BUILD_EXTERNAL variables were for use when projects were not embedded within the llvm source tree (mostly in use by Takumi's flat buildbots that checout the top-level project without embedding, say, clang or compiler-rt within the llvm source tree)?You are confusing this with the similarly named LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR variables.
Ah, right - indeed.2) The new way, is to place compiler-rt under LLVM/runtimes. In this path the build system will automatically build with the just-built compiler. This path also splits compiler-rt into two separate build steps, one that configures and builds the builtins with the just-built compiler, and a second that configures and builds the sanitizer libraries.
Huh, OK - could someone remove the legacy format, then? If it's a trap.I'm not sure the new path is fully supported in every workflow, so removing it seems like a not great idea at the moment.
That said, I tried putting compiler-rt in runtimes instead of projects and I got a bunch of cmake errors starting with:CMake Error at /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/lib/cmake/llvm/AddLLVM.cmake:1174 (add_dependencies):The dependency target "GotsanRuntimeCheck" of target "check-runtimes" doesnot exist.Call Stack (most recent call first):CMakeLists.txt:110 (add_lit_target)
Any ideas?I have never encountered that issue. It looks like the tsan test code is out of sync. If you go into tsan/test/CMakeLists.txt and on Line 2 add this to the if statement "AND TARGET GotsanRuntimeCheck" that should fix the issue.
Hrm - not sure which CMakeLists.txt you're referring to? In my runtimes/compiler-rt/lib/tsan/tests/CMakeLists.txt the first few lines are:
I'll try and reproduce later today. Is this Linux? Can you give me your CMake command line?
On Mar 10, 2017, at 4:25 PM, David Blaikie via llvm-dev <llvm...@lists.llvm.org> wrote:On Thu, Mar 9, 2017 at 3:00 PM Chris Bieneman <be...@apple.com> wrote:I'll try and reproduce later today. Is this Linux? Can you give me your CMake command line?
Excuse the delay, been busy setting up a new machine - also an opportunity to try clean cmake setups rather than my aging configurations that have a bunch of old stuff baked in and manual variables changed, etc. (& I do so wish that CMakeCache.txt had a comment at teh top describing the command that produced it like the config.log - that way I'd probably be more likely to copy/paste and modify the command line than hand editing the cache file)
There is a missing dependency of check-runtimes on test tools (FileCheck, not)
There is no top level check-asan target (as promised in the August
thread), even after runtimes-configure. There is one in the ninja file
under runtimes/runtimes-bins. Is that a regression?
On Fri, Mar 10, 2017 at 6:07 PM, Matthias Braun via llvm-dev