New issue
Advanced search Search tips

Issue 773887 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocked on:
issue 822036



Sign in to add a comment

Support multiple versions of llvm in chroot

Project Member Reported by manojgupta@chromium.org, Oct 11 2017

Issue description

Currently only a single llvm/clang version is supported in ChromeOS chroot. Often it is desirable to have the older versions available for various reasons. 
1. If some package does not work with latest llvm but worked with an older version, we can use older llvm to build that package instead of rolling back.
2. Many times, It is easier to experiment or test builds if old/new versions of compiler are present in same chroot.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 17 2017

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

commit 945010ffbe3d16a718c3484b01b0936c10061820
Author: Manoj Gupta <manojgupta@google.com>
Date: Tue Oct 17 20:02:50 2017

llvm: Update host wrapper clang detection.

clang host wrapper is using a hardcoded /usr/bin/clang location
for the clang binary. Change this to use the clang binary in the wrapper's
installed directory. This makes it possible to put clang binary + wrapper in
a location other than /usr/bin.

BUG=chromium:773887
TEST=Wrapper calls clang from the installed directory.

Change-Id: I21ed49acea027293b1ef75d7943ce0980953cd83
Reviewed-on: https://chromium-review.googlesource.com/721463
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[rename] https://crrev.com/945010ffbe3d16a718c3484b01b0936c10061820/sys-devel/llvm/llvm-5.0_pre305632_p20170806-r8.ebuild
[modify] https://crrev.com/945010ffbe3d16a718c3484b01b0936c10061820/sys-devel/llvm/files/clang_host_wrapper.body

Components: Infra

Comment 3 by mmoss@chromium.org, Jan 2 2018

Components: -Infra Infra>Client>ChromeOS
[It appears that a bunch of old cros issues bulk-added the "Infra" component recently, but they should probably be "Infra>Client>ChromeOS".]
Components: -Infra>Client>ChromeOS
Components: Tools>ChromeOS-Toolchain
Thinking of following approach:
1. Installing an older llvm using a separate slot+prefix
2. Add a wrapper-only option to invoke this clang.
Blockedon: 822036
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 23 2018

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

commit 00a6378121f3c00e9046758fc1a4ed9e7e104df3
Author: Manoj Gupta <manojgupta@google.com>
Date: Fri Mar 23 21:50:56 2018

llvm: Cleanup some unused USE flags.

clang, static-analyzer, lld, kernel_Darwin and gold use flags are
not used for building llvm in Chrome OS. Drop them and remove the
related code to clean up the ebuild.

BUG=chromium:773887
TEST=Files in $(equery f sys-devel/llvm) is unchanged.

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

[rename] https://crrev.com/00a6378121f3c00e9046758fc1a4ed9e7e104df3/sys-devel/llvm/llvm-7.0_pre326829_p20180318-r1.ebuild
[rename] https://crrev.com/00a6378121f3c00e9046758fc1a4ed9e7e104df3/sys-devel/clang/clang-7.0_pre326829_p20180318-r1.ebuild

Project Member

Comment 9 by bugdroid1@chromium.org, Mar 31 2018

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

commit 2cc9bbc5bd186428fd5467e83f2ab9e523584df9
Author: Manoj Gupta <manojgupta@google.com>
Date: Sat Mar 31 08:56:31 2018

llvm: Update wrappers for multiple llvm installations.

Currently only one version of llvm is installed in the chroot.
Update the host and target wrappers to support using a llvm
installation in a custom location.
A new wrapper option "-Xclang-path=" is added to specify the location
of the custom clang installation.

Any package that needs to use a different clang than the default
should specify this option.

BUG=chromium:773887
TEST=Chromiumos-sdk, kevin, peppy tryjobs passed.

Change-Id: If865d3ce843a0490c855d29484f469ce4fcbb94b
Reviewed-on: https://chromium-review.googlesource.com/982397
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>

[rename] https://crrev.com/2cc9bbc5bd186428fd5467e83f2ab9e523584df9/sys-devel/gcc/gcc-4.9.2-r185.ebuild
[modify] https://crrev.com/2cc9bbc5bd186428fd5467e83f2ab9e523584df9/sys-devel/gcc/files/sysroot_wrapper.body
[modify] https://crrev.com/2cc9bbc5bd186428fd5467e83f2ab9e523584df9/sys-devel/llvm/files/clang_host_wrapper.body
[rename] https://crrev.com/2cc9bbc5bd186428fd5467e83f2ab9e523584df9/sys-devel/llvm/llvm-7.0_pre326829_p20180318-r5.ebuild

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/4a3dce09b5295b0d21129ec68660b96dfb3776e5

commit 4a3dce09b5295b0d21129ec68660b96dfb3776e5
Author: Manoj Gupta <manojgupta@google.com>
Date: Fri Aug 03 04:50:23 2018

toolchain-utils: Add a tool to create llvm-extra ebuild.

llvm-extra ebuild is a slotted llvm compiler ebuild
that can be installed in parallel to the regualr llvm compiler.
Use of llvm-extra package is to provide an alternate clang in case
the normal clang compiler binary can't be used.

e.g. After a llvm upgrade, some package foo is miscompiled.
To avoid the miscompilation, we can use llvm-extra ebuild to install
the previous clang.

To use the clang installed by llvm-extra, modify the CFLAGS and
LDFLAGS to pass the patch of the clang binary installed by llvm-extra
package.
e.g. append-flags -Xclang-path=/usr/llvm-extra/version/clang
     append-ldflags -Xclang-path=/usr/llvm-extra/version/clang

This CL only adds the tool that can generate the llvm-extra
ebuilds from a given llvm ebuild.

BUG=chromium:773887
TEST= ./create_llvm_extra.sh /path/to/llvm/llvm-7.0_pre331547_p20180529-r8.ebuild
worked. A new llvm-extra ebuild was generated.

Change-Id: I7e3e20a2740f5e7135dbcd252cc271945c6ddd34
Reviewed-on: https://chromium-review.googlesource.com/1161213
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[add] https://crrev.com/4a3dce09b5295b0d21129ec68660b96dfb3776e5/llvm_extra/create_llvm_extra.sh
[add] https://crrev.com/4a3dce09b5295b0d21129ec68660b96dfb3776e5/llvm_extra/create_ebuild_file.py

the filesystem conventions we use for all other cross-compilers are:

* /usr/$CTARGET/ - sysroot for $CTARGET
* /usr/$CHOST/$CTARGET/ - tools that run on $CHOST and target $CTARGET
* /usr/$CHOST/... - tools that run on $CHOST and target $CHOST
* /usr/lib/gcc/($CTARGET|$CHOST)/ - gcc libs that target $CTARGET

we don't carve out project-specific dirs directly under /usr.  llvm is a bit diff from GNU toolchains in that it's a single build (vs configuring+building the same package with diff CTARGET values).  so imo, we should be using /usr/$(get_libdir)/llvm/<version>/ to hold slotted packages instead of /usr/llvm-<version>/.  or if you want the tools to be completely standalone, /opt/llvm/<version>/ or /opt/llvm-<version>/ would work too.
Sure, moving the paths /usr/$(get_libdir)/llvm/<version>/ or opt/llvm-<version>/ to would be fine. 
Status: Assigned (was: Untriaged)
This issue has an owner, a component and a priority, but is still listed as untriaged or unconfirmed. By definition, this bug is triaged. Changing status to "assigned". Please reach out to me if you disagree with how I've done this.

Sign in to add a comment