This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Add back HandleLLVMOptions for out of tree builds
ClosedPublic

Authored by martell on May 31 2017, 7:38 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

martell created this revision.May 31 2017, 7:38 PM
EricWF accepted this revision.Jun 2 2017, 1:39 PM

Thank you.

This revision is now accepted and ready to land.Jun 2 2017, 1:39 PM
This revision was automatically updated to reflect the committed changes.
martell added a comment.EditedJun 3 2017, 4:26 PM

Just to be clear this causes a bunch of problems for my use case

Run Build Command:"/usr/local/bin/ninja" "cmTC_a0bd6"
[1/2] Building CXX object CMakeFiles/cmTC_a0bd6.dir/CMakeCXXCompilerABI.cpp.obj
[2/2] Linking CXX executable cmTC_a0bd6.exe
FAILED: cmTC_a0bd6.exe 
: && /Users/martell/llvm/usr/bin/x86_64-w64-mingw32-clang++ -v CMakeFiles/cmTC_a0bd6.dir/CMakeCXXCompilerABI.cpp.obj -o cmTC_a0bd6.exe -Wl,--out-implib,libcmTC_a0bd6.dll.a -Wl,--major-image-version,0,--minor-image-version,0   && :
clang version 5.0.0 (trunk 304663) (llvm/trunk 304665)
Target: x86_64--windows-gnu
Thread model: posix
InstalledDir: /Users/martell/llvm/usr/bin
 "/Users/martell/llvm/usr/bin/lld" -flavor gnu -m i386pep -Bdynamic -o cmTC_a0bd6.exe /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crt2.o /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crtbegin.o -L/Users/martell/llvm/usr/x86_64-w64-mingw32/lib -L/Users/martell/llvm/usr/lib -L/Users/martell/llvm/usr/x86_64-w64-mingw32/sys-root/mingw/lib CMakeFiles/cmTC_a0bd6.dir/CMakeCXXCompilerABI.cpp.obj --out-implib libcmTC_a0bd6.dll.a --major-image-version 0 --minor-image-version 0 -lc++ -lmingw32 /Users/martell/llvm/usr/lib/clang/5.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crtend.o
error: Unable to find library -lc++

I need to specifically define to even get this far.

-DLLVM_NO_OLD_LIBSTDCXX=TRUE
-DCXX_SUPPORTS_CXX11=TRUE

Not something I think I should have to do to bootstrap a cross compiler.
Can you tell me everything you specifically need from HandleLLVMOptions so I can extract that into libcxxabi's cmake modules in a followup commit.

EricWF added a comment.Jun 4 2017, 6:57 PM

Your use case isn't the only use case that exists, far from it.

I don't want to be duplicating LLVM modules we should just be using directly

Your use case isn't the only use case that exists, far from it.

I don't want to be duplicating LLVM modules we should just be using directly

I think bootstrapping a cross compiler by cross building libc++abi and libc++ is a pretty generic use case.
Pulling in all of LLVM's cmake modules depends on top of libc++abi hinders cmake detection when cross building libc++abi standalone.

You said before that we needed this for the sanitizer.
Do you know why libc++ doesn't need to import this?

EricWF added a comment.Jun 7 2017, 2:15 AM

Your use case isn't the only use case that exists, far from it.

I don't want to be duplicating LLVM modules we should just be using directly

I think bootstrapping a cross compiler by cross building libc++abi and libc++ is a pretty generic use case.
Pulling in all of LLVM's cmake modules depends on top of libc++abi hinders cmake detection when cross building libc++abi standalone.

Then fix LLVM. The in-tree build should act the same as the out-of-tree build.

sbc100 added a subscriber: sbc100.Jan 12 2018, 3:46 PM

Sorry to revive a very old issue, but this change also breaks my WebAssembly build. libcxx doesn't include this and therefor works fine, its only libcxxabi that breaks.. and if I remove this line it works.

What options does this file add? And does libcxxabi really need them? If so, presumbly we should add this line in libcxx too?

My problem is that HandleLLVMOptions seems to add a lot of compiler and system check.... seemingly more than are required to build libcxxabi. It seems like by including this line we are maybe needlessly restricting the set of compilers/environments on which it can be built.

martell added a comment.EditedJan 17 2018, 12:23 PM

My problem is that HandleLLVMOptions seems to add a lot of compiler and system check.... seemingly more than are required to build libcxxabi. It seems like by including this line we are maybe needlessly restricting the set of compilers/environments on which it can be built.

Hey Sam, this was my issue also, In rL304374 I did a refactor on the cmake usage in libcxxabi.
I removed include(HandleLLVMOptions OPTIONAL) which made the change a FC rather then a NFC so I re added this line.
Eric said that this is still needed for out of tree builds, beyond that I don't know any more details as I have never used llvm in this way.

Err, I mean Sam, Sorry.

sbc100 added a subscriber: phosek.Mar 29 2019, 10:07 AM

Looks like this was recently fixed by @phosek in rL354284

Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2019, 10:07 AM
Herald added a subscriber: christof. · View Herald Transcript