New issue
Advanced search Search tips

Issue 710840 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 710841
Owner: ----
Closed: Nov 2017
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

ARM

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.
 

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

Oops, I meant to title this issue as "ARM Chromium host-only tools fail to link due to pkg_config issue". Since I can't amend it, I've re-created the issue in  http://crbug.com/710841  with the correct title. Please close/delete this issue.
Mergedinto: 710841
Status: Duplicate (was: Unconfirmed)

Sign in to add a comment