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

Issue 723354 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Cannot build static binary with libc++

Project Member Reported by bcf@chromium.org, May 17 2017

Issue description

Adding the '-static' option causes compilation to fail.

% cat ~/src/scratch/test.cc
#include <iostream>

int main() {
  std::cout << "hello\n";
  return 0;
}

# libstdc++ works as expected
% ./prebuilt/toolchain/armv7a/bin/armv7a-cros-linux-gnueabi-clang++ -static ~/src/scratch/test.cc
% readelf -d a.out

There is no dynamic section in this file.

# libc++ fails
% ./prebuilt/toolchain/armv7a/bin/armv7a-cros-linux-gnueabi-clang++ --stdlib=libc++ -static ~/src/scratch/test.cc

/usr/local/google/home/bcf/src/master1/prebuilt/toolchain/armv7a/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/ld.gold.real.elf: error: /usr/local/google/home/bcf/src
/master1/prebuilt/toolchain/armv7a/usr/bin/../lib/gcc/armv7a-cros-linux-gnueabi/4.9.x/libgcc_eh.a(libunwind.o): multiple definition of '_Unwind_RaiseException
...
 

Comment 1 by bcf@chromium.org, May 17 2017

Note: I encountered this with armv7a SDK version 2017.05.12.083215
Owner: yunlian@chromium.org
This seems to be unwinder issue. It uses libunwind.a and both libgcc_eh.a and hence causes the problem.
I tried to build libcxxabi and libcxx without llvm-libunwind and it links. I will upload the patch later today.
Project Member

Comment 3 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/24f3fe9b1dacae64cc82a16c838a25bf3175865d

commit 24f3fe9b1dacae64cc82a16c838a25bf3175865d
Author: Yunlian Jiang <yunlian@google.com>
Date: Fri May 19 01:07:53 2017

libcxx: remove USE=libunwind.

It seems llvm-libunwind and libgcc has some symbol conflict. To
workaournd that, we should remove the libunwind dependency from
libcxx and libcxxabi.

BUG= chromium:723354 
TEST=armv7a-cros-linux-gnueabi-clang++ -static a.cc --stdlib=libc++
     armv7a-cros-linux-gnueabi-clang++ a.cc --stdlib=libc++

Change-Id: I98f9f2acbe776e118de76fe24ac4b0ab23e6ea73
Reviewed-on: https://chromium-review.googlesource.com/508050
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Bailey Forrest <bcf@chromium.org>

[rename] https://crrev.com/24f3fe9b1dacae64cc82a16c838a25bf3175865d/sys-libs/libcxx/libcxx-4.0.0-r2.ebuild
[rename] https://crrev.com/24f3fe9b1dacae64cc82a16c838a25bf3175865d/sys-libs/libcxxabi/libcxxabi-4.0.0-r2.ebuild

Cc: bcf@chromium.org
Labels: OS-Chrome
bcf@ Can you verify if the latest SDK builds fixed the problem?

Comment 5 by bcf@chromium.org, May 24 2017

I verified this is fixed on 2017.05.23.115240
Status: Verified (was: Untriaged)

Sign in to add a comment