Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 761220 - sys-devel/gcc: with >=dev-util/ccache-4.0: x86_64-pc-linux-gnu-g++: /var/tmp/portage/sys-devel/gcc-8.4.0-r1/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by x86_64-pc-linux-gnu-g++)
Summary: sys-devel/gcc: with >=dev-util/ccache-4.0: x86_64-pc-linux-gnu-g++: /var/tmp/...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 766707 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-12-22 06:52 UTC by Mihai Moldovan
Modified: 2021-02-14 08:50 UTC (History)
5 users (show)

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


Attachments
emerge --info (emerge-info,20.19 KB, text/plain)
2020-12-22 06:52 UTC, Mihai Moldovan
Details
gcc-build-logs.tar.bz2 (gcc-build-logs.tar.bz2,725.87 KB, application/x-bzip)
2020-12-22 06:54 UTC, Mihai Moldovan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Moldovan 2020-12-22 06:52:33 UTC
Created attachment 679173 [details]
emerge --info

Since dev-util/ccache 4.0, building older versions of sys-devel/gcc than the one dev-util/ccache was built with fails.

Example: dev-util/ccache built with sys-devei/gcc:9.3.0: building sys-devel/gcc:8.4.0 fails.

Build logs and emerge --info output attached.

The takeaway is that:

  - dev-util/ccache >= 4.0 now links against libstdc++
  - sys-devel/gcc seems to compile a few files during src_install
  - it thinks it's in stage3 and using the newly built compiler binary, but instead uses the system compiler
  - preloads the just-built (older) libstdc++ library
  - crashes while executing ccache, which uses newer symbols/features.

Thanks to Sergei Trofimovich for pointing all that out.

Now, one way to work around that issue is to disable ccache, obviously. Another way is to rebuild ccache so that it links a static libstdc++ version.

The proper way to fix that, however, is to
  - either stop gcc to rebuild the packages in src_install (why would this be necessary in the first place?)
  - or, failing that, make that src_install building use the newly bootstrapped compiler instead of the (possible ccache-wrapped) system compiler, for which the preloaded libstdc++ would be fitting.
Comment 1 Mihai Moldovan 2020-12-22 06:54:50 UTC
Created attachment 679176 [details]
gcc-build-logs.tar.bz2

Builds logs, tar'd and compressed by portage.
Comment 2 Sergei Trofimovich gentoo-dev 2020-12-22 07:49:25 UTC
libtool usually relinks binaries against new RPATH when tools get installed. 

LD_LIBRARY_PATH injection breaks not only ccache but also linkers with c++ plugins injected as seen in bug #644772. I think it has to be solved upstream (if possible at all).
Comment 3 Mihai Moldovan 2020-12-22 08:16:45 UTC
Right.

I created a new report because the failure and cause is (slight) different from the the one in #644772.

Crucially, THIS can be fixed by fixing the gcc build system to NOT rebuild stuff at "make install" time, which sounds like a bug to begin with.

The binaries being created there should already be around, but something must detect they are outdated and hence trying to rebuild them. This shouldn't be the case.

Fixing that might also fix the other issues mentioned in the other bug report, but I'm not sure about this. Highly depends on where it fails there. If it's within src_compile, making src_install not compile stuff, like it should, won't help there.
Comment 4 Sergei Trofimovich gentoo-dev 2020-12-22 19:43:34 UTC
You can try to write a patch, but I'll repeat my suspiction:

libtool usually relinks binaries against new RPATH when tools get installed.
Comment 5 Moshy 2021-01-17 09:48:42 UTC
I think 742281 is a DUP of this
Comment 6 Moshy 2021-01-17 09:53:34 UTC
gcc prior to 8 appears to be EOL upstream (as of 2011-01-17) so that approach seems infeasible
Comment 7 Sergei Trofimovich gentoo-dev 2021-01-17 12:45:12 UTC
(In reply to Moshy from comment #5)
> I think 742281 is a DUP of this

Most likely not.

(In reply to Moshy from comment #6)
> gcc prior to 8 appears to be EOL upstream (as of 2011-01-17) so that
> approach seems infeasible

Are you sure you are posting update to the correct bug?
Comment 8 Moshy 2021-01-19 21:41:14 UTC
In reply to comment 7:

I probably misread which package you were referring to by "upstream".

As for bug #742281, in the absence of build.log, the same result was encountered, except instead of gcc 8.4.0 failing to build, it was gcc 6.5.0, but with the same link error of GLIBCXX_3.4.26 not found, so the cause is likely same.
Comment 9 Sergei Trofimovich gentoo-dev 2021-01-20 14:08:13 UTC
(In reply to Moshy from comment #8)
> In reply to comment 7:
> 
> I probably misread which package you were referring to by "upstream".

gcc.

> As for bug #742281, in the absence of build.log, the same result was
> encountered, except instead of gcc 8.4.0 failing to build, it was gcc 6.5.0,
> but with the same link error of GLIBCXX_3.4.26 not found, so the cause is
> likely same.

Maybe, or maybe not. It's hard to say without build.log or emerge --info.
Comment 10 Sergei Trofimovich gentoo-dev 2021-01-23 19:25:21 UTC
*** Bug 766707 has been marked as a duplicate of this bug. ***