New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 747638 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Fuchsia
Pri: 3
Type: Bug



Sign in to add a comment

tot clang broken for fuchsia

Project Member Reported by thakis@chromium.org, Jul 22 2017

Issue description

I'm rolling clang (https://chromium-review.googlesource.com/c/582074/). The Fuchsia bot is red: https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.linux%2Ffuchsia%2F88%2F%2B%2Frecipes%2Fsteps%2Fcompile__with_patch_%2F0%2Fstdout :

FAILED: obj/third_party/boringssl/boringssl/dtls_method.o 
/b/c/goma_client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/boringssl/boringssl/dtls_method.o.d -DV8_DEPRECATION_WARNINGS -DDCHECK_ALWAYS_ON=1 -DNO_TCMALLOC -DDISABLE_NACL -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"308728-1\" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DSYSROOT_VERSION=5b6bc0cc84b7962fa04c3b5c215115cb58369177 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_NO_STATIC_INITIALIZER -DOPENSSL_SMALL -D_XOPEN_SOURCE=700 -DOPENSSL_NO_ASM -I../.. -Igen -I../../third_party/boringssl/src/include -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics --target=x86_64-fuchsia -m64 -march=x86-64 -O2 -fno-ident -fdata-sections -ffunction-sections -fomit-frame-pointer -g1 --sysroot=../../third_party/fuchsia-sdk/sysroot/x86_64-fuchsia -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-auto-raw-pointer -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Werror -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -std=c++11 -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -c ../../third_party/boringssl/src/ssl/dtls_method.cc -o obj/third_party/boringssl/boringssl/dtls_method.o
In file included from ../../third_party/boringssl/src/ssl/dtls_method.cc:57:
In file included from ../../third_party/boringssl/src/include/openssl/ssl.h:145:
../../third_party/boringssl/src/include/openssl/base.h:355:10: fatal error: 'memory' file not found
#include <memory>
         ^~~~~~~~
1 error generated.

This is likely due to

r307856 | phosek | 2017-07-12 18:14:41 -0400 (Wed, 12 Jul 2017) | 14 lines

Reland "[Driver] Update Fuchsia driver path handling"

Several improvements to the Fuchsia driver:

* Search for C++ library headers and libraries in directories that
are part of the toolchain distribution rather than sysroot.

* Use LLVM support utlities to construct paths to make sure the driver
is also usable on Windows for cross-compiling.

* Change the driver to inherit directly from ToolChain rather than
Generic_GCC since we don't need any of the GCC related multilib logic.

Differential Revision: https://reviews.llvm.org/D35328


Since we don't have a tot fuchsia build, and since fuchsia is only an fyi bot, and since rolling clang is already fiendishly difficult, I will land this roll despite it breaking the fuchsia bots. Maybe add -isystem path/in/sysroot/path/to/libc++/headers, or something like that. phosek, I'm giving this to you, you likely know how this is supposed to work.

Maybe there's some compiler flag change we can do to unbreak it after the fact or something.

(We thought we wouldn't need a clang/tot fuchsia bot since we thought the tot linux bots should mostly cover it. But the last 2 rolls (including this one) did break the chrome/fuchsia build, so we should set up a clang tot fuchsia bot.)
 

Comment 2 by phosek@chromium.org, Jul 22 2017

Cc: jam...@chromium.org mcgrathr@chromium.org
Yes, r307856 is the likely culprit. What has changed is that Fuchsia Clang driver is now looking for C++ runtime in <toolchain_dir>/lib/<x86_64|aarch64>-fuchsia e.g. headers should be in <toolchain_dir>/lib/<x86_64|aarch64>-fuchsia/include/c++/v1, we no longer ship these as part of sysroot, instead they're part of the toolchain.

Comment 3 by thakis@chromium.org, Jul 22 2017

What does "part of the toolchain" mean? In the clang package?

Comment 4 by phosek@chromium.org, Jul 22 2017

We build an entire toolchain, not just clang. What goes into the toolchain is controlled by https://fuchsia.googlesource.com/third_party/clang/+/master/cmake/caches/Fuchsia-stage2.cmake#52, that includes runtimes which includes C++ runtimes for x86_64-fuchsia and aarch64-fuchsia targets.

Comment 5 by thakis@chromium.org, Jul 22 2017

Right, but I think we don't use that toolchain in chrome, right?

Comment 6 by phosek@chromium.org, Jul 22 2017

AFAIK no, so we you plan to continue using your clang, we need to figure how to make it work. Since you also have your own build of libc++, libc++abi and libunwind, you could just use that as you suggested, I think it should just work.

Comment 7 by thakis@chromium.org, Jul 22 2017

The suggestion from comment 1 (https://chromium-review.googlesource.com/c/582074/9) fails like so: http://build.chromium.org/p/tryserver.chromium.linux/builders/fuchsia/builds/92

FAILED: crypto_unittests 
python "../../build/toolchain/gcc_link_wrapper.py" --output="./crypto_unittests" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -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=lld --target=x86_64-fuchsia -resource-dir ../../third_party/fuchsia-sdk/toolchain_libs/clang/6.0.0 -Wl,-z,stack-size=0x800000 -nodefaultlibs -m64 -Werror -Wl,-O1 -Wl,--gc-sections --sysroot=../../third_party/fuchsia-sdk/sysroot/x86_64-fuchsia -o "./crypto_unittests" -Wl,--start-group @"./crypto_unittests.rsp"  -Wl,--end-group   -lmxio -lmagenta -lunwind -lc -lm -llaunchpad 
/b/c/b/linux/src/out/Release/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: __udivti3
>>> referenced by div.c:173 (../../third_party/boringssl/src/crypto/fipsmodule/bn/div.c:173)
>>>               bcm.o:(BN_div) in archive obj/third_party/boringssl/libboringssl.a
/b/c/b/linux/src/out/Release/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: __umodti3
>>> referenced by div.c:645 (../../third_party/boringssl/src/crypto/fipsmodule/bn/div.c:645)
>>>               bcm.o:(BN_is_prime_fasttest_ex) in archive obj/third_party/boringssl/libboringssl.a
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)

That's because we pass -nodefaultlibs in https://cs.chromium.org/chromium/src/build/config/c%2B%2B/BUILD.gn?q=c%5C%2B%5C%2B/build.gn&sq=package:chromium&dr to suppress linking of libc++ from the default location, but that then also disables linking in third_party/fuchsia-sdk/toolchain_libs/clang/6.0.0/lib/fuchsia/libclang_rt.builtins-x86_64.a Since the builtins lib has an arch-specific name, manually adding that to the link line in .gn is pretty annoying too.

So the options are to either manually add that even though it's annoying with the arch, or to -isystem the libc++ headers from the SDK (at third_party/fuchsia-sdk/sysroot//x86_64-fuchsia/include/c++/v1/ -- hmm that looks arch-specific too :-/). I guess I'll try the first option first.

(We should probably give clang a -nodefaultlibs++ flag that only disables the c++ standard library, then we could remove https://cs.chromium.org/chromium/src/build/config/c%2B%2B/BUILD.gn?type=cs&q=nodefaultlib+file:%5C.gn&sq=package:chromium&l=32 too. But that doesn't help with the current roll.)

Comment 8 by thakis@chromium.org, Jul 22 2017

Owner: thakis@chromium.org
Status: Started (was: Unconfirmed)
After quite a bit of back and forth, Fuchsia seems to be building again with patch set 16 of https://chromium-review.googlesource.com/c/582074 . It's pretty hacky, but hey.

Some advance notice and a way to be able to adapt to these changes asynchronously (e.g. so that we could first update compilers, then switch to the new way in a separate commit, and then update compilers again -- meaning there'd have to be a switch to opt in/out for the new behavior) would be very appreciated going forward. Clang rolls require wild flailing way too often, and I would've liked to go to bed a few hours ago. Also, the CL description of r307856 doesn't say _why_ searching for C++ library headers and libraries in directories that are part of the toolchain distribution rather than sysroot is an improvement.

Comment 9 by phosek@chromium.org, Jul 22 2017

It should be an improvement because Fuchsia developers will no longer have to build C++ libraries themselves which is what they had to do in the past. This turned out to be very painful multi-stage process (build Magenta's sysroot using Make, build C++ libraries using CMake, build Fuchsia using GN). Since C++ libraries are also part of LLVM and they're developed together with the rest of LLVM, I think it's cleaner if they're shipped together, this how official Clang distribution works.

This change should have been transparent for anyone using Fuchsia's Clang toolchain, but unfortunately turned out to be breaking for people using their own Clang build like Chromium, I apologize about that. I agree that we need a better channel for communicating these kind of changes. One thing I can do is CC you on any change that might be potentially affecting Chromium in Phabricator.
Just mailing me isn't sufficient; we have about 5 people doing clang rolls in a lose rotation. Maybe you could email clang@chromium.org. Also, I think most of us at least skim cfe-commits, so if you do a breaking change, it helps if you explicitly point that out in the commit message. But ideally, as said above, when you do a breaking change, provide a flag to opt out of that change and leave that flag around for a month or so. Then we can update our compiler, then migrate to the New Way asynchronously with compiler updates (by adding the opt-out flag when we roll and then removing it later), and then remove that flag again once we've migrated.
Project Member

Comment 11 by bugdroid1@chromium.org, Jul 24 2017

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

commit 1c688af81fcfa4c072dcca79e698641839e8a42f
Author: Nico Weber <thakis@chromium.org>
Date: Mon Jul 24 11:25:28 2017

Roll clang 307486:308728.

Ran `tools/clang/scripts/upload_revision.py 308728`.

This changes the clang version from 5.0.0 to 6.0.0, so simplify
some things that dealt with both numbers.

This changes clang to no longer look for libc++ headers in the
Fuchsia SDK.  To keep things building, use "our" libc++, like
on linux (use_custom_libcxx).  This in turn means we pass
-nodefaultlibs to the linker, which sadly also disables the
automatic linking of clang_rt.builtins, so do that manually now.
(In exchange, we no longer need to pass in -resource-dir.)

This makes -Wformat fire in Google Toolbox for Mac in iOS builds,
so disable -Wformat in that config for now.

Bug:  746303 , 746505 , 747638 , 747643 , 724204 

Change-Id: I6196a2a173a1b4871f22d0ce92436d0197fd7845
Reviewed-on: https://chromium-review.googlesource.com/582074
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488946}
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/build/config/c++/BUILD.gn
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/build/config/c++/c++.gni
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/build/config/fuchsia/BUILD.gn
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/build/toolchain/toolchain.gni
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/third_party/google_toolbox_for_mac/BUILD.gn
[modify] https://crrev.com/1c688af81fcfa4c072dcca79e698641839e8a42f/tools/clang/scripts/update.py

Status: Fixed (was: Started)

Sign in to add a comment