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

Issue 907181 link

Starred by 3 users

Issue metadata

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



Sign in to add a comment

clang-format built against mismatched libraries for chromeos

Project Member Reported by zentaro@chromium.org, Nov 20

Issue description

Since sync'ing my Chrome OS repository yesterday. clang-format and anything that depends on it eg. repo upload fails with the below error

Per vapier@ in below thread "it's most likely due to the Chromium project building clang-format with newer gcc but our SDK only has gcc-4.9"

https://groups.google.com/a/google.com/forum/#!topic/chromeos-chatty-eng/E8tOUtSMzn0



/mnt/host/source/chromium/src/buildtools/linux64/clang-format: /lib64/libtinfo.so.5: no version information available (required by /mnt/host/source/chromium/src/buildtools/linux64/clang-format)
/mnt/host/source/chromium/src/buildtools/linux64/clang-format: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /mnt/host/source/chromium/src/buildtools/linux64/clang-format)
error: `/mnt/host/source/chromium/src/buildtools/linux64/clang-format -style=file -lines=1:57 -assume-filename=libtpmcrypto/tpm_crypto_impl.h` failed
clang-format failed:
return code: 2; command: /mnt/host/source/chromium/src/buildtools/clang_format/script/git-clang-format --binary /mnt/host/source/chromium/src/buildtools/linux64/clang-format --diff --style file 'HEAD^' HEAD --
cmd=['/mnt/host/source/chromium/src/buildtools/clang_format/script/git-clang-format', '--binary', '/mnt/host/source/chromium/src/buildtools/linux64/clang-format', '--diff', '--style', 'file', 'HEAD^', 'HEAD', '--']

Please report this to the clang team.

 
Cc: thakis@chromium.org nick@chromium.org
Components: Infra>Client>ChromeOS>Build Tools>ChromeOS-Toolchain
adding clang_format/OWNERS peeps for discussion

i don't know if the binary OS requirements have been documented beyond something like "recent Ubuntu TLS"
Right, it's "recent Ubuntu TLS".

Try updating your system?
the issue is with running it inside the CrOS SDK.  the CrOS toolchain has locked us to gcc-4.9, so upgrading it isn't an option for developers.
What does "running inside the cros sdk" mean? (I don't know anything about cros development) Is that like a chroot? Can you run the formatter outside the chroot?
yes, the CrOS SDK is a chroot we maintain. developers can run tools outside of the SDK. we don't normally dictate that things must be inside or outside because everyone has their preferred flow, and usually we can handle either env just fine.
Here's how we build clang-format: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/updating_clang_format_binaries.md#build-a-release_mode-clang_format-on-each-platform

If there's some way to update those instructions to build binaries that work better for you, patches are accepted :-) Rebuilding just the current linux binary with the new instructions shouldn't be a ton of work, if the new instructions are easy(ish).

It's all very manual at the moment, sadly.
would using -static-libgcc -static-libstdc++ be onerous ?
If we just need to pass those in CXXFLAGS and then things work, that'd be fine. Someone can either try building binaries following https://chromium.googlesource.com/chromium/src/+/HEAD/docs/updating_clang_format_binaries.md#build-a-release_mode-clang_format-on-each-platform (our current clang-format revision is 346566, and adding flags can be done via -DCMAKE_C_FLAGS=foo -DCMAKE_CXX_FLAGS=bar).
you should only need it at link time (LDFLAGS)
Labels: clang-format
Project Member

Comment 12 by bugdroid1@chromium.org, Dec 6

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/buildtools/+/7d88270de197ebe8b439ab5eb57a4a2a0bb810e0

commit 7d88270de197ebe8b439ab5eb57a4a2a0bb810e0
Author: Sam Maier <smaier@chromium.org>
Date: Wed Dec 05 20:05:06 2018

Added statically linked linux binary for clang-format

It naturally got a bit bigger: 1957400B now compared to 1862936B before.

ldd clang-format:
linux-vdso.so.1 (0x00007ffdebff2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8fe0771000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8fe0557000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8fe034f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8fe014b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8fdfe47000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8fdfaa8000)


Bug:  907181 ,  911708 
Change-Id: Icf18ff6c5750bd37cd485b3f0e23f4f9f7922b1c

[modify] https://crrev.com/7d88270de197ebe8b439ab5eb57a4a2a0bb810e0/linux64/clang-format.sha1

Can you try again?
Project Member

Comment 15 by bugdroid1@chromium.org, Dec 6

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

commit 9b5c0a7e5bf7a73942ba783b6180f83a4d63b1e4
Author: Sam Maier <smaier@chromium.org>
Date: Thu Dec 06 17:35:46 2018

Rolling buildtools 04161ec8..7d88270d

Also updates docs on how to build clang-format.

Bug:  911708 ,  907181 
Change-Id: I55b3d9833b030fece1eb52c3b6b53492959582b2
Reviewed-on: https://chromium-review.googlesource.com/c/1365081
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614404}
[modify] https://crrev.com/9b5c0a7e5bf7a73942ba783b6180f83a4d63b1e4/DEPS
[modify] https://crrev.com/9b5c0a7e5bf7a73942ba783b6180f83a4d63b1e4/docs/updating_clang_format_binaries.md

Now it might work. zentaro, vapier: Could you sync and try again?
Owner: vapier@chromium.org
Status: Assigned (was: Untriaged)
we might have to roll depot_tools on the CrOS side first.  i'll take this for confirmation purposes.
Status: Fixed (was: Assigned)
looks like we should be set.  the logic is only in buildtools and CrOS uses the latest there too.
$ ./chromium/src/buildtools/linux64/clang-format --version
clang-format version 8.0.0 (trunk 346566)

thanks for the help.

Sign in to add a comment