I was trying to build Chrome with libc++ on ChromeOS and the build failed because of failure in linking v8_snapshot/mksnaphot
https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/13811
Build logs:
https://luci-logdog.appspot.com/v/?s=chromeos%2Fbb%2Fchromiumos.tryserver%2Frelease%2F13811%2F%2B%2Frecipes%2Fsteps%2FBuildPackages__afdo_use_%2F0%2Fstdout
From the build logs, the failure is because linker had "-m32" option in command line. As a result, it couldn't libc++ libraries.
chromeos-chrome-62.0.3187.0_rc-r1: [2/6432] LINK v8_snapshot/mksnapshot
chromeos-chrome-62.0.3187.0_rc-r1: FAILED: v8_snapshot/mksnapshot
chromeos-chrome-62.0.3187.0_rc-r1: python "../../../../../../../home/chrome-bot/chrome_root/src/build/toolchain/gcc_link_wrapper.py" --output="v8_snapshot/mksnapshot" -- x86_64-pc-linux-gnu-clang++ -pie -Wl,--fatal-warnings -Wl,--build-id=sha1 -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/chrome-bot/chrome_root/src/third_party/binutils/Linux_x64/Release/bin
====================
-m32
====================
-Wl,-rpath-link=v8_snapshot -Wl,--disable-new-dtags -Wl,-O1 -Wl,--gc-sections -o "v8_snapshot/mksnapshot" -Wl,--start-group @"v8_snapshot/mksnapshot.rsp" -Wl,--end-group -ldl -lpthread -lrt
chromeos-chrome-62.0.3187.0_rc-r1: ../../../../../../../home/chrome-bot/chrome_root/src/third_party/binutils/Linux_x64/Release/bin/ld.gold: warning: skipping incompatible /usr/lib/libc++.so while searching for c++
chromeos-chrome-62.0.3187.0_rc-r1: ../../../../../../../home/chrome-bot/chrome_root/src/third_party/binutils/Linux_x64/Release/bin/ld.gold: error: cannot find -lc++
Interestingly, libc++ build with amd64 board is fine so this issue is limited to building arm32 (ChromeOS) on x86_64 host.
Is there a reason for passing -m32 to the host linker when building v8_snapshot/mksnapshot?
Comment 1 by thakis@chromium.org
, Aug 17 2017