New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 822036 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Build-Toolchain

Blocking:
issue 773887



Sign in to add a comment

Chrome OS gcc env.d config might be incorrect

Project Member Reported by manojgupta@chromium.org, Mar 14 2018

Issue description

$ cat /etc/env.d/gcc/config-x86_64-pc-linux-gnu
CURRENT=x86_64-pc-linux-gnu-4.9.2

But gcc  paths are using 4.9.x (not 4.9.2).  So the expect value of CURRENT should be CURRENT=x86_64-pc-linux-gnu-4.9.x

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.x/gcc.real
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.x/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.9.2-r183/work/gcc-4.9.2/gcc-4.9/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.x --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.x --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/include --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/include/g++-v4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.x/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.x/info --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.9.x/python --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --enable-languages=c,c++ --enable-__cxa_atexit --disable-canonical-system-headers --enable-checking=release --enable-linker-build-id --with-bugurl=http://code.google.com/p/chromium-os/issues/entry --with-pkgversion=4.9.2_cos_gg_4.9.2-r183-2cdcfd30c27f0d836cc477f2ae9f456287fd6b1b_4.9.2-r183 --disable-libatomic --enable-multilib --enable-libgomp --disable-libcilkrts --disable-libitm --disable-libmudflap --disable-libquadmath --disable-libssp --enable-frame-pointer --enable-shared --enable-threads=posix
Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (4.9.2_cos_gg_4.9.2-r183-2cdcfd30c27f0d836cc477f2ae9f456287fd6b1b_4.9.2-r183)


This is creating an issue with gcc libraries detection. clang has special code to find gcc libraries but that code assumes that version specified in the files at /etc/env.d/gcc/config-$tuple 
matches the installation in /usr/lib/gcc/$tuple/version/.

https://github.com/llvm-mirror/clang/blob/ad1fef448d93b30ccb0afd9b77b01aab97b3f45b/lib/Driver/ToolChains/Gnu.cpp#L2227 

To repro this issue, llvm must be installed in a subdirectory of /usr e.g. PREFIX=/usr/llvm-version0 
 
Note: I suspect that Chrome OS installation might be correct and upstream Gentoo related code should be modified to read the /etc/env.d/gcc/$CURRENT file and find LDPATH from there.
Cc: mgo...@gentoo.org
Note the comment from Michał:
        // Note: Strictly speaking, we should be reading
        // /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
        // contain anything new or especially useful to us.

I don't know about Gentoo upstream but this looks like a requirement on Chrome OS.

Michał, What do you think? I have a local patch for this but prefer to send it tp llvm upstream if you agree.

Comment 4 by mgo...@gentoo.org, Mar 15 2018

I have to admit I just went the easy way, as it was enough to make the things work for Gentoo and I didn't want to implement file contents parsing. If you implemented the more complete logic, please submit it upstream by all means, and I'll be happy to test it on Gentoo and review it for you.
Owner: manojgupta@chromium.org
Sent for review at https://reviews.llvm.org/D45233
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/4ddd3e6bbac8c1b0c53a646641286de7809505a9

commit 4ddd3e6bbac8c1b0c53a646641286de7809505a9
Author: Manoj Gupta <manojgupta@google.com>
Date: Thu Apr 12 17:01:06 2018

llvm: Find gcc libraries for multiple llvm installs.

If clang binary is not installed in /usr/bin, it can't find the
GCC libraries installed by crossdev in /usr/lib/gcc since
clang only looks in InstallDir/.. by default.
Fix this by passing --gcc-toolchain argument.

Does not impact current llvm used.

BUG= chromium:822036 
TEST=/usr/temp/bin/clang -target $TARGET -v can find gcc libraries.

Change-Id: I58e6799bdbce28aa7f81a089eba27a8563da3ce6
Reviewed-on: https://chromium-review.googlesource.com/1008909
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/4ddd3e6bbac8c1b0c53a646641286de7809505a9/sys-devel/gcc/files/sysroot_wrapper.body
[rename] https://crrev.com/4ddd3e6bbac8c1b0c53a646641286de7809505a9/sys-devel/llvm/llvm-7.0_pre326829_p20180318-r11.ebuild
[rename] https://crrev.com/4ddd3e6bbac8c1b0c53a646641286de7809505a9/sys-devel/gcc/gcc-4.9.2-r186.ebuild
[modify] https://crrev.com/4ddd3e6bbac8c1b0c53a646641286de7809505a9/sys-devel/llvm/files/clang_host_wrapper.body

Status: Verified (was: Untriaged)
Closing after latest llvm roll.

Sign in to add a comment