New issue
Advanced search Search tips

Issue 710841 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Nov 5
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocking:
issue 595493



Sign in to add a comment

ARM Chromium host-only tools fail to link due to pkg_config issue

Project Member Reported by richard....@arm.com, Apr 12 2017

Issue description

https://crrev.com/6ee4f021659260c12c361bb78eb211c9ba69e8bf /  Issue 710006  both reveal a problem with building host targets in the CrOS sysroot. These programs (using gn templates like compiled_action) auto-generate code or accomplish similar tasks later on in Chromium's build process. The issue stems from the incorrect use of pkg_config when building these binaries. 
On all CrOS (e.g. elm), pkg_config is set to something like this via the 9999 chrome ebuild:

  pkg_config = "/build/elm/build/bin/pkg-config"

This means that looking for libraries (e.g. nss) when compiling ends up pulling in versions which exist in the board sysroot, rather than on the host:

  $ /build/elm/build/bin/pkg-config --cflags nss --libs
  -I/build/elm/usr/include/nss -I/build/elm/usr/include/nspr -L/build/elm/usr/lib -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 


As a result, doing `cros_workon start --board=elm chromeos-chrome` inside the sysroot and then compiling with `cd ~/chrome_root/src ; ninja -C ./c/Release host/transport_security_state_generator` fails with errors like

   FAILED: host/libcrcrypto.so host/libcrcrypto.so.TOC 
   python "/home/rtownsend/chrome_root/src/build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="host/libcrcrypto.so" --tocfile="host/libcrcrypto.so.TOC" --output="host/libcrcrypto.so"  -- x86_64-pc-linux-gnu-g++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=gold -B../../../../../../../home/rtownsend/chrome_root/src/third_party/binutils/Linux_x64/Release/bin -Wl,--icf=all -m64 -pthread -Wl,--gdb-index -L/build/elm/usr/lib -o "host/libcrcrypto.so" -Wl,-soname="libcrcrypto.so" @"host/libcrcrypto.so.rsp"
   ../../../../../../../home/rtownsend/chrome_root/src/third_party/binutils/Linux_x64/Release/bin/ld.gold: warning: skipping incompatible /build/elm/usr/lib/libpthread.so while searching for pthread
   ../../../../../../../home/rtownsend/chrome_root/src/third_party/binutils/Linux_x64/Release/bin/ld.gold: warning: skipping incompatible /build/elm/usr/lib/libdl.so while searching for dl
   ...<snip>...
   ../../../../../../../home/rtownsend/chrome_root/src/third_party/binutils/Linux_x64/Release/bin/ld.gold: error: treating warnings as errors


The same command works OK for an Intel board target like cyan, because all of the libraries in cyan's sysroot are the right architecture.

A possible way to fix it is to introduce another pkg_config variable which only affects host binaries (e.g. host_pkg_config). A CL implementing this will be uploaded shortly.
 
 
Cc: vapier@chromium.org

Comment 2 by vapier@chromium.org, Apr 12 2017

a sep pkg-config setting for the build is the correct answer

Comment 3 by richard....@arm.com, Apr 12 2017

OK, so I took an initial bash of this over at https://codereview.chromium.org/2818523002, but unfortunately it fails native Linux builds because build/config/linux/atk/BUILD.gn requires direct access to the pkg_config_args and it doesn't seem to be possible to retrieve variables created in a template scope back to a parent scope in GN. I think I've found a solution but I need to test it a bit more vigorously first.
Blocking: 595493
> I think I've found a solution but I need to test it a bit more vigorously first.

Any news?

I'd like to re-land the CL for  Issue 595493  soon, but I don't know how much about debugging the Chromium build setup.
Labels: Build-Tools-GN

Comment 6 by richard....@arm.com, Apr 19 2017

Current status is the patch is working, but I have to get it through internal review before it's uploaded. It should be ready within the next 24 hours.
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0dbb630385d7bd387348b00437e72b611287cb49

commit 0dbb630385d7bd387348b00437e72b611287cb49
Author: richard.townsend <richard.townsend@arm.com>
Date: Tue Apr 25 11:58:44 2017

Introduce host_pkg_config variable for cross-compilation

When cross-compiling in the ChromiumOS chroot, it's possible for
host-based compiled_actions targets to pick up libraries in the board
sysroot which causes linker warnings (converted to errors via
--fatal-warnings). To address this, introduce a host_pkg_config
variable, which can override pkg_config when building tools used on
the host as part of the build process.

BUG= 710841 

Review-Url: https://codereview.chromium.org/2818523002
Cr-Commit-Position: refs/heads/master@{#466947}

[modify] https://crrev.com/0dbb630385d7bd387348b00437e72b611287cb49/build/config/linux/pkg_config.gni

Project Member

Comment 8 by bugdroid1@chromium.org, Apr 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2b156ccc00ebdb53389dc59917f60cf1d1dde6ac

commit 2b156ccc00ebdb53389dc59917f60cf1d1dde6ac
Author: richard.townsend <richard.townsend@arm.com>
Date: Thu Apr 27 17:44:03 2017

base: remove -latomic in CrOS chroot

libbase is needed when using compiled_action targets (these are
helper programs compiled for use later in the build), but it doesn't
currently build for the host inside the CrOS sysroot because the
toolchain doesn't include the libatomic library. libbase does, however,
seem to compile without the -latomic flag.

TEST=Revert 5e671fffc45441c5dd3458871a8aa8f4a3f2e632, compile elm
BUG= 710006 ,  710841 

Review-Url: https://codereview.chromium.org/2823303003
Cr-Commit-Position: refs/heads/master@{#467721}

[modify] https://crrev.com/2b156ccc00ebdb53389dc59917f60cf1d1dde6ac/base/BUILD.gn

Project Member

Comment 9 by bugdroid1@chromium.org, Apr 28 2017

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

commit 00b062e732629c252673b4cba77a9206edf5cbce
Author: Mattias Nissler <mnissler@chromium.org>
Date: Fri Apr 28 10:14:39 2017

Revert "chromeos-chrome: add host_pkg_config for cross-compilation"

This reverts commit c27bea7ccb346760ee278b2d42ab3cd6188467c5.

Reason for revert: Likely the culprit for TestSimpleChromeWorkflow breakage in Chrome PFQ builders, see  http://crbug.com/716399 .

Original change's description:
> chromeos-chrome: add host_pkg_config for cross-compilation
> 
> This new build variable ensures that host-only compilation helpers
> aren't incorrectly linked against libraries in the current board
> sysroot.
> 
> BUG= chromium:710841 
> TEST=cbuildbot kevin-release
> 
> Change-Id: Ifc667fd55cfaa00e2721c7894684909b6bd08b46
> Reviewed-on: https://chromium-review.googlesource.com/483342
> Commit-Ready: Richard Townsend <richard.townsend@arm.com>
> Tested-by: Richard Townsend <richard.townsend@arm.com>
> Reviewed-by: Mike Frysinger <vapier@chromium.org>
> 

TBR=vapier@chromium.org,richard.townsend@arm.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= chromium:710841 ,  chromium:716399 

Change-Id: If877ffdca42ce697957d7a438e4675a9cf7541ee
Reviewed-on: https://chromium-review.googlesource.com/489948
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>

[modify] https://crrev.com/00b062e732629c252673b4cba77a9206edf5cbce/chromeos-base/chromeos-chrome/chromeos-chrome-9999.ebuild

Project Member

Comment 10 by bugdroid1@chromium.org, May 19 2017

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

commit 4c1d7a1988b201b16f0e51a6025c571db500a35a
Author: Richard Townsend <Richard.Townsend@arm.com>
Date: Fri May 19 20:57:37 2017

chromeos-chrome: add host_pkg_config for cross-compilation

This new build variable ensures that host-only compilation helpers
aren't incorrectly linked against libraries in the current board
sysroot.

BUG= chromium:710841 
TEST=cbuildbot kevin-release

Change-Id: I8859c516a8c39faece5821b4ba07207a779d4aa3
Reviewed-on: https://chromium-review.googlesource.com/508590
Commit-Ready: Richard Townsend <richard.townsend@arm.com>
Tested-by: Richard Townsend <richard.townsend@arm.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/4c1d7a1988b201b16f0e51a6025c571db500a35a/chromeos-base/chromeos-chrome/chromeos-chrome-9999.ebuild

Components: OS>Packages
 Issue 710840  has been merged into this issue.
Project Member

Comment 13 by sheriffbot@chromium.org, Nov 5

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment