New issue
Advanced search Search tips

Issue 876604 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug
Build-Toolchain



Sign in to add a comment

lddtree generated wrappers don't work with symlinks

Project Member Reported by manojgupta@chromium.org, Aug 22

Issue description

Most likely caused by https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1166926

While the generated wrapper may be working for SimpleChrome, This is breaking other uses of the toolchain.

To repro:
$ gsutil.py cp gs://chromiumos-sdk/2018/08/x86_64-cros-linux-gnu-2018.08.21.014238.tar.xz .
$ tar -Jxvf x86_64-cros-linux-gnu-2018.08.21.014238.tar.xz .
$ ln -s usr/bin/clang clang
$ ./clang # Fails to run
./clang-7.elf: error while loading shared libraries: ./clang-7.elf: cannot open shared object file: No such file or directory

This is blocking toolchain import for other use cases.

 
Let me revert the patch.
Status: Assigned (was: Untriaged)
I'm considering to use python in shell wrapper to get relativized path for resolved symlink path.
I am not sure if dependency on python is wise.
Using $(readlink -f $0) would find the exact file. And it can be used then instead of  of $0 in the lddtree.
#3, but I want to keep relativeness of path and readlink in chroot does not support --relative-to. So I cannot rely on it.

Other option will be
* implement shell function doing python's os.path.relpath
* Check existence of elf without resolving symlink, and give up to use relative path if it is not there. This will work in simple chrome case at least currently.

#4, Ah, I can use readlink without -f option too. That tells us relative path of symlink.
I come up other idea to check whether realpath supports --relative-to or not.
In simple chrome build, I believe, realpath has --relative-to option so I'd like to re-land below patch below with always using absolute path fallback in case --relative-to is not available in build package.

https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1086958
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/b97eba7fb2c0a3c5ad9e3831c6f87dca1fde59c5

commit b97eba7fb2c0a3c5ad9e3831c6f87dca1fde59c5
Author: Takuto Ikuta <tikuta@chromium.org>
Date: Mon Sep 03 15:50:36 2018

lddtree: resolve symlinked compiler path

This is retry of
https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1166926

I confirmed this works as following with a debug line to show ${base}.elf

(sdk daisy R70-11005.0.0) tikuta@tikuta ~/chromium/src $ ln -s build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7 clang
(sdk daisy R70-11005.0.0) tikuta@tikuta ~/chromium/src $ ./clang
${base}.elf: './build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7.elf'
clang-7: error: no input files

Before patch 1166926, it ran like below
(sdk daisy R70-11005.0.0) tikuta@tikuta ~/chromium/src $ ./clang
${base}.elf: '/usr/local/google/home/tikuta/chromium/src/build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7.elf'
clang-7: error: no input files

I confirmed this can build base_unittests on daisy and amd64-generic.
$ cros tryjob -g 1195164 chromiumos-sdk-tryjob
Tryjob submitted!
To view your tryjobs, visit:
  https://cros-goldeneye.corp.google.com/chromeos/healthmonitoring/buildDetails?buildbucketId=8936880129223909840

BUG=chromium:846610,  chromium:876604 
Change-Id: I577a99f75e0d19d9757940965e551b589314463d
Reviewed-on: https://chromium-review.googlesource.com/1195164
Commit-Ready: Takuto Ikuta <tikuta@chromium.org>
Tested-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>

[modify] https://crrev.com/b97eba7fb2c0a3c5ad9e3831c6f87dca1fde59c5/third_party/lddtree.py

manojgupta@, fix landed, when will next toolchain roll happen?
It is automatic once the chromiumos-sdk builder finishes.
Status: Fixed (was: Assigned)
Fix was rolled in
https://chromium-review.googlesource.com/c/chromium/src/+/1212447

Sign in to add a comment