Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 795405 - sys-libs/llvm-libunwind failed compiling due to CMake Error
Summary: sys-libs/llvm-libunwind failed compiling due to CMake Error
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-11 13:43 UTC by Errelin
Modified: 2022-01-27 07:05 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info without any other command line arguments (emerge--info.txt,5.36 KB, text/plain)
2021-06-11 13:43 UTC, Errelin
Details
emerge --info for sys-libs/llvm-libunwind (emerge --info '=sys-libsllvm-libunwind-12.0.0gentoo'.txt,6.28 KB, text/plain)
2021-06-12 03:22 UTC, Errelin
Details
build.log of llvm-libunwind (sys-libsllvm-libunwind-12.0.0tempbuild.log,4.87 KB, text/plain)
2021-06-12 03:23 UTC, Errelin
Details
CMake Error log a required (CMakeError.log,7.60 KB, text/plain)
2021-06-12 03:53 UTC, Errelin
Details
CMake Output log as required (CMakeOutput.log,1.38 KB, text/plain)
2021-06-12 03:54 UTC, Errelin
Details
The complete build.log of llvm-libunwind (var-tmp-portage-sys-libsllvm-libunwind-12.0.0-temp-build.log,4.87 KB, text/plain)
2021-06-12 03:57 UTC, Errelin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Errelin 2021-06-11 13:43:17 UTC
Created attachment 715260 [details]
emerge --info without any other command line arguments

while trying to do a normal @world update by issuing the command:
    
    emerge -aquvD @world
    
The emerging process was disrupptted at llvm-libunwind. I first tried to ask for help on Gentoo forum. After enabling llvm-libunwind USE flag globally in my make.conf (because otherwise sys-libs/libunwind will be used and cause conflict with the already installed sys-libs/llvm-libunwind), I still got the same error. 

I tried `emerge -aquvDU @world --keep-going`, and this time, only dev-lang/clang got compiled successfully, still no luck with llvm-libunwind as well as libcxxabi.

emerge --info (also attached)
http://dpaste.com/E5MYCSJFP 
(expires at around 6:00PM 6/12/2021)

emerge --info '=sys-libs/llvm-libunwind-12.0.0::gentoo'
https://dpaste.com/F8965FWKL
(expires at around 6:00PM 6/12/2021)

build.log
https://dpaste.com/F8965FWKL
(expires at around 6:00PM 6/12/2021)
Comment 1 Marco Scardovi (scardracs) 2021-06-11 13:57:42 UTC
Have you checked if you have sys-libs/libunwind installed (which is the provider of linunwind.so)?

Also please post all 3 logs as text because expiring link, as name suggest, can expire
Comment 2 Marco Scardovi (scardracs) 2021-06-11 14:06:20 UTC
Please do not follow my previous statement. Libunwind is not required for llvm-libunwind.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-06-11 16:13:48 UTC
@telans, could you look at it?  We probably need to override unwindlib back here.
Comment 4 James Beddek 2021-06-11 21:53:39 UTC
I'm fairly sure this is because -unwindlib=libunwind is being manually passed (is it? not in emerge --info). This is sort of the issue the abi_x86_32 USE change was intended to fix. I can replicate by trying to build abi_x86_32 and adding -rtlib=compiler-rt -unwindlib=libunwind to flags. We should be filtering it out I bet.
Comment 5 Errelin 2021-06-12 03:22:16 UTC
Created attachment 715377 [details]
emerge --info for sys-libs/llvm-libunwind

I can see that "ABI_X86=64 -32" is there, but when emerging, the 32 flag will be turned on. It is a bit confusing.
Comment 6 Errelin 2021-06-12 03:23:45 UTC
Created attachment 715380 [details]
build.log of llvm-libunwind

Since I passed 'q'(uite) to emerge, only the failed part of the log was returned to me. If the full log is needed, please let me know. Many thanks.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-12 03:26:37 UTC
(In reply to Errelin from comment #6)
> Created attachment 715380 [details]
> build.log of llvm-libunwind
> 
> Since I passed 'q'(uite) to emerge, only the failed part of the log was
> returned to me. If the full log is needed, please let me know. Many thanks.

You should be able to attach:

>See also "/var/tmp/portage/sys-libs/llvm-libunwind-12.0.0/work/llvm-libunwind->12.0.0_build-abi_x86_32.x86/CMakeFiles/CMakeOutput.log".
>See also "/var/tmp/portage/sys-libs/llvm-libunwind-12.0.0/work/llvm-libunwind->12.0.0_build-abi_x86_32.x86/CMakeFiles/CMakeError.log".
> * The complete build log is located at '/var/tmp/portage/sys-libs/llvm-libunwind->12.0.0/temp/build.log'.
Comment 8 Errelin 2021-06-12 03:53:51 UTC
Created attachment 715383 [details]
CMake Error log a required
Comment 9 Errelin 2021-06-12 03:54:21 UTC
Created attachment 715386 [details]
CMake Output log as required
Comment 10 Errelin 2021-06-12 03:57:53 UTC
Created attachment 715389 [details]
The complete build.log of llvm-libunwind

I think I failed to make myself clear in the previous attachment comment.

By passing the 'q' (quiet) to emerge, it will only report when the building fails. I also find the build.log only contains the error message. Usually, without the 'q' option, build.log is quite long. 

Anyway, this build.log was created with 'q' option passed. Thanks for your help.
Comment 11 Errelin 2021-06-12 03:58:36 UTC
Hello Marco Scardovi and Theo Anderson,

Thank you both for looking into this. Not sure who should I reply to, so I decided to add a comment.

I just uploaded all the three logs as attachments to avoid the auto expiration.

As to the libunwind, it has not been installed on my machine yet. 
Yesterday, when I tried to upgrade clang, emerge told me that libunwind (not installed) would be pulled in, but llvm-libunwind (installed) is in conflict with it.

So I did two things:
1. masked libunwind in package.mask;
2. enabled llvm-libunwind USE flag globally in make.conf;

But no matter how many times I tried, I just got the same error.

Theo Anderson mentioned the ABI_X86=32 flag. I did notice that it was the first time for this flag to appear when I emerge, though I'm on a multilib profile and this should be expected.

But also interesting is that:
1. only clang related pkgs such as libcxxabi, libcxx, llvm-libunwind have newly switched on this flag, and they failed compiling for some reason.
2. emerge info shows that this flag is indeed excluded for llvm-libunwind.

Really appreciate your help.
Comment 12 James Beddek 2021-06-12 10:22:59 UTC
Alright so this was a bit of an oversight on my part when enabling abi_x86_32 for these packages w.r.t people who either have:

1) emerged/updated clang with [default-compiler-rt] before any of the llvm libs with abi_x86_32 since the changes were made in tree

2) [default-libcxx] enabled on clang before this change. That causes `unable to find library -lc++` in a similar fashion to what we see here with -lunwind.

Lets say you already have sys-devel/clang[default-libcxx,default-compiler-rt] up to date without the llvm libraries updated. In order to fix this without manual intervention the following needs to happen:

1) sys-libs/llvm-libunwind emerged overriding flags to -unwindlib=libgcc -stdlib=libstdc++

2) sys-libs/libcxx{,abi} emerged overriding flags to -stdlib=libstdc++

I just don't see how this would be possible to specify as a one-off within an ebuild. The good news is that these issues won't happen on a fresh install or with clang[-default-libcxx,-default-compiler-rt] (but that doesn't help here).

The quick (ish) fix for you Errelin should be for you to compile "libcxx libcxxabi llvm-libunwind" with gcc so that the 32-bit libs are installed, then rebuild them again with clang if you wanted.

Please let me know if that works. I don't think there's an automatic way to solve this unfortunately. Thanks!
Comment 13 Errelin 2021-06-13 02:24:13 UTC
(In reply to Theo Anderson from comment #12)
> Alright so this was a bit of an oversight on my part when enabling
> abi_x86_32 for these packages w.r.t people who either have:
> 
> 1) emerged/updated clang with [default-compiler-rt] before any of the llvm
> libs with abi_x86_32 since the changes were made in tree
> 
> 2) [default-libcxx] enabled on clang before this change. That causes `unable
> to find library -lc++` in a similar fashion to what we see here with
> -lunwind.
> 
> Lets say you already have
> sys-devel/clang[default-libcxx,default-compiler-rt] up to date without the
> llvm libraries updated. In order to fix this without manual intervention the
> following needs to happen:
> 
> 1) sys-libs/llvm-libunwind emerged overriding flags to -unwindlib=libgcc
> -stdlib=libstdc++
> 
> 2) sys-libs/libcxx{,abi} emerged overriding flags to -stdlib=libstdc++
> 
> I just don't see how this would be possible to specify as a one-off within
> an ebuild. The good news is that these issues won't happen on a fresh
> install or with clang[-default-libcxx,-default-compiler-rt] (but that
> doesn't help here).
> 
> The quick (ish) fix for you Errelin should be for you to compile "libcxx
> libcxxabi llvm-libunwind" with gcc so that the 32-bit libs are installed,
> then rebuild them again with clang if you wanted.
> 
> Please let me know if that works. I don't think there's an automatic way to
> solve this unfortunately. Thanks!

Hi Theo,

Thank you so much for the detailed explanation. It makes good sense. 

I followed your quick fix instructions and it took me just a few minutes on my machine. Yes, this works very well and all the three libs (llvm-libunwind, libcxx{,abi}) have been compiled without any problems, first with gcc, then with clang itself, smoothly.

I'm not sure how to mark this thread "solved" or it could only be done by you maintainers. If anything I need to do as required, please let me know. Really appreciate your time and help. :)