Page MenuHomePhabricator

[libcxxabi] Remove strict dependency on llvm-config.
ClosedPublic

Authored by danalbert on Aug 21 2014, 4:49 PM.

Details

Summary

Depending on llvm-config allows for a few nice things (auto-detecting LLVM source tree, version numbers, etc), but it's makes bootstrapping a pain. Keep the llvm-config features around, but also fall back to being able to configure based on -DLLVM_MAIN_SRC_DIR=path/to/llvm.

Diff Detail

Event Timeline

danalbert updated this revision to Diff 12812.Aug 21 2014, 4:49 PM
danalbert retitled this revision from to [libcxxabi] Remove strict dependency on llvm-config..
danalbert updated this object.
danalbert edited the test plan for this revision. (Show Details)
danalbert added reviewers: jroelofs, loladiro.
danalbert added a subscriber: Unknown Object (MLST).
loladiro edited edge metadata.Aug 21 2014, 6:16 PM

Seems to work fine for me, modulo having to set -std=c++11 manually in the CXXFLAGS, which is automatically set in libcxx and could be here too.

One issue is that, if there is a llvm-config executable in the path, it tried to use that, which I want to prevent (this happened to me while trying to rebuild with different options - libcxxabi wasn't installed anymore, but llvm-config depending on it still was).

Also, for some reason passing in CMAKE_SHARED_LINKER_FLAGS didn't work. Any idea why?

Never mind, it just put it in a different place that I expected it to. Fixed by using LIBCXXABI_CXX_ABI_LIBRARIES instead.

In D5016#5, @loladiro wrote:

One issue is that, if there is a llvm-config executable in the path, it tried to use that, which I want to prevent (this happened to me while trying to rebuild with different options - libcxxabi wasn't installed anymore, but llvm-config depending on it still was).

Well, if there's an invalid llvm-config on your system, you should probably remove llvm-config :) I think I can probably just reorder the if/elseif and get the behavior you want though, but that might cause issues with rerunning cmake on an already configured directory.

In D5016#4, @loladiro wrote:

Seems to work fine for me, modulo having to set -std=c++11 manually in the CXXFLAGS, which is automatically set in libcxx and could be here too.

Interesting. Outside the realm of this patch, but I'll fix that too.

Well, if there's an invalid llvm-config on your system, you should probably remove llvm-config :) I think I can probably just reorder the if/elseif and get the behavior you want though, but that might cause issues with rerunning cmake on an already configured directory.

It's only invalid while rebuilding libcxxabi though, it'll work again just fine after ;)

Interesting. Outside the realm of this patch, but I'll fix that too.

Thanks!

danalbert updated this revision to Diff 12871.Aug 22 2014, 6:17 PM
danalbert edited edge metadata.
  • Fix a few issues with the last commit.

Can't test because the machine I was testing on is currently rebuilding it's file system. But from reading the commit LGTM.

Keno, PTAL. I've fixed the following things in this revision:

  • Allow the user to specify a specific LLVM tree even if llvm-config is on their system.
  • Had accidentally removed LLVM_BINARY_DIR for llvm-config path, preventing it from finding the cmake files.
  • Fixed behavior for re-running cmake in already configured directory.

I've verified that either path works (even under a re-run of cmake) and can correctly find the cmake files, build and run LIT.

If everything works for you, please approve and I'll commit it.

In D5016#12, @loladiro wrote:

Can't test because the machine I was testing on is currently rebuilding it's file system. But from reading the commit LGTM.

I'm in no hurry. Just let me know when you get a chance. Thanks!

It ran though fine the first time, but I tried reconfiguring and I got:

cd libcxxabi-build && \
        cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/home/kfischer/julia-test/usr -DLLVM_PATH:PATH=/home/kfischer/julia-test/deps/llvm-svn -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/kfischer/julia-test/usr ../llvm-svn/projects/libcxxabi -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DLIBCXXABI_CXX_ABI_LIBRARIES="" -DCMAKE_CXX_FLAGS="-fno-stack-protector -cxxlib-nostd -static-intel -std=c++11"
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= clang
CMAKE_CXX_COMPILER= clang++

-- The C compiler identification is 
-- The CXX compiler identification is
-- Check for working C compiler: /home/kfischer/clang/bin/clang
-- Check for working C compiler: /home/kfischer/clang/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/kfischer/clang/bin/clang++
-- Check for working CXX compiler: /home/kfischer/clang/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:49 (message):
  llvm-config not found and LLVM_MAIN_SRC_DIR not defined
``
any ideas?

I think you need to not specify -DCMAKE_C(XX)?_COMPILER on the second run.
Cmake doesn't let you change compiler after the first run. Even though
you're configuring it as the same compiler, it might just reject those
options on a rerun.

loladiro accepted this revision.Aug 25 2014, 9:29 PM
loladiro edited edge metadata.

That's unfortunate, but I guess nothing to do with this patch. LGTM.

This revision is now accepted and ready to land.Aug 25 2014, 9:29 PM
danalbert closed this revision.Aug 26 2014, 1:59 PM

Submitted as r216482.