How to fix "clang: not found" when cross-compiling for 32-bit Linux

2,463 views
Skip to first unread message

Marshall Greenblatt

unread,
Mar 10, 2016, 5:01:15 PM3/10/16
to chromium-dev, s...@chromium.org, Alexander Potapenko
Hi All,

I'm attempting to build 32-bit Chromium on Linux at M49 using an Ubuntu 14.04 64-bit host and the following commands:

$ export GYP_DEFINES="disable_nacl=1 use_sysroot=1 host_arch=x86_64 target_arch=ia32"
$ gclient runhooks
$ ninja -C out/Release chrome

I'm getting build errors like the following:

/bin/sh: 1: ../../third_party/llvm-build/Release+Asserts/bin/clang: not found
/bin/sh: 1: ../../third_party/llvm-build/Release+Asserts/bin/clang++: not found

I've seen a comment [1] from the pre-sysroot days that suggests setting $CC_host, $CXX_host, $CC and $CXX, however it's not immediately clear to me how these values should be set when using the default "debian_wheezy_i386-sysroot" sysroot. Similarly, I've seen threads [2] that suggest setting clang=0 via GYP_DEFINES, however using gcc instead of clang seems likely to open a whole other can of worms.

What is the recommended way to fix this problem when using the default sysroot?

Thanks,

Nico Weber

unread,
Mar 10, 2016, 5:03:24 PM3/10/16
to Marshall Greenblatt, chromium-dev, Sam Clegg, Alexander Potapenko
Is the error true? Does third_party/llvm-build/Release+Asserts/bin/clang exist on your machine? (It should.)

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Marshall Greenblatt

unread,
Mar 10, 2016, 5:07:11 PM3/10/16
to Nico Weber, chromium-dev, Sam Clegg, Alexander Potapenko
On Thu, Mar 10, 2016 at 5:01 PM, Nico Weber <tha...@chromium.org> wrote:
Is the error true? Does third_party/llvm-build/Release+Asserts/bin/clang exist on your machine? (It should.)

I can't log into the machine directly, but based on the output it should exist:

________ running '/usr/bin/python src/tools/clang/scripts/update.py --if-needed' in '/var/lib/work/chromium_git/chromium'
Updating Clang to 255169-1...
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build
Downloading prebuilt clang
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts
clang 255169-1 unpacked

I'm thinking that perhaps the failed command is being run from inside the sysroot, and that the path does not exist from the perspective of the sysroot, but I'm not sure how to verify that.

Marshall Greenblatt

unread,
Mar 10, 2016, 5:19:49 PM3/10/16
to Nico Weber, chromium-dev, Sam Clegg, Alexander Potapenko
On Thu, Mar 10, 2016 at 5:06 PM, Marshall Greenblatt <magree...@gmail.com> wrote:
On Thu, Mar 10, 2016 at 5:01 PM, Nico Weber <tha...@chromium.org> wrote:
Is the error true? Does third_party/llvm-build/Release+Asserts/bin/clang exist on your machine? (It should.)

I can't log into the machine directly, but based on the output it should exist:

________ running '/usr/bin/python src/tools/clang/scripts/update.py --if-needed' in '/var/lib/work/chromium_git/chromium'
Updating Clang to 255169-1...
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build
Downloading prebuilt clang
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts
clang 255169-1 unpacked

I'm thinking that perhaps the failed command is being run from inside the sysroot, and that the path does not exist from the perspective of the sysroot, but I'm not sure how to verify that.

Hmm... I'm not able to reproduce the 32-bit build error on a local VM, and the 64-bit remote build succeeded without issue using the same setup (but different build machine and different GYP_DEFINES). I'll re-trigger the 32-bit build to see if perhaps it was a transient error and update this thread.

Nico Weber

unread,
Mar 10, 2016, 5:20:34 PM3/10/16
to Marshall Greenblatt, chromium-dev, Sam Clegg, Alexander Potapenko
Hm, the gyp defines are I think the config our 32-bit builder uses, and that seems to work fine. Maybe some configuration problem?

Marshall Greenblatt

unread,
Mar 10, 2016, 6:43:24 PM3/10/16
to Nico Weber, chromium-dev, Sam Clegg, Alexander Potapenko
On Thu, Mar 10, 2016 at 5:19 PM, Marshall Greenblatt <magree...@gmail.com> wrote:
On Thu, Mar 10, 2016 at 5:06 PM, Marshall Greenblatt <magree...@gmail.com> wrote:
On Thu, Mar 10, 2016 at 5:01 PM, Nico Weber <tha...@chromium.org> wrote:
Is the error true? Does third_party/llvm-build/Release+Asserts/bin/clang exist on your machine? (It should.)

I can't log into the machine directly, but based on the output it should exist:

________ running '/usr/bin/python src/tools/clang/scripts/update.py --if-needed' in '/var/lib/work/chromium_git/chromium'
Updating Clang to 255169-1...
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build
Downloading prebuilt clang
Creating directory /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts
clang 255169-1 unpacked

I'm thinking that perhaps the failed command is being run from inside the sysroot, and that the path does not exist from the perspective of the sysroot, but I'm not sure how to verify that.

Hmm... I'm not able to reproduce the 32-bit build error on a local VM, and the 64-bit remote build succeeded without issue using the same setup (but different build machine and different GYP_DEFINES). I'll re-trigger the 32-bit build to see if perhaps it was a transient error and update this thread.

I verified that the files exist on the build machine:

$ ls -al /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts/bin

total 70372
drwxrwxr-x 2 buildagent buildagent     4096 Dec 10 02:03 .
drwxrwxr-x 4 buildagent buildagent     4096 Mar 10 22:40 ..
-rwxrwxr-x 1 buildagent buildagent 68137624 Dec 10 02:03 clang
lrwxrwxrwx 1 buildagent buildagent        5 Mar 10 22:40 clang++ -> clang
lrwxrwxrwx 1 buildagent buildagent        5 Mar 10 22:40 clang-cl -> clang
-rwxrwxr-x 1 buildagent buildagent  3910064 Dec 10 02:03 llvm-symbolizer

And I added make_clang_dir=/var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts to GYP_DEFINES just to make sure the path was correct. However, I'm still getting the same error (now with the absolute path):

/bin/sh: 1: /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++: not found

Any suggestions on what I should try next?

Thanks,
Marshall

Nico Weber

unread,
Mar 10, 2016, 6:47:36 PM3/10/16
to Marshall Greenblatt, chromium-dev, Sam Clegg, Alexander Potapenko
Can you manually run that file on the bot? Maybe the executable can't load on that system for some reason?

Marshall Greenblatt

unread,
Mar 10, 2016, 7:27:21 PM3/10/16
to Nico Weber, chromium-dev, Sam Clegg, Alexander Potapenko
On Thu, Mar 10, 2016 at 6:46 PM, Nico Weber <tha...@chromium.org> wrote:
Can you manually run that file on the bot? Maybe the executable can't load on that system for some reason?

Aha! That exposed the problem:

$ ldd /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang
not a dynamic executable

$ file /var/lib/work/chromium_git/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang
ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=5f401ff9144bdf87c5c82962b9f51324871e2129, stripped

I didn't realize that my host VM was configured as i386 instead of amd64. Thanks for helping me work though my user error :)
Reply all
Reply to author
Forward
0 new messages