Cannot build static binary with libc++ |
||||
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
...
,
May 17 2017
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.
,
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
,
May 24 2017
bcf@ Can you verify if the latest SDK builds fixed the problem?
,
May 24 2017
I verified this is fixed on 2017.05.23.115240
,
May 24 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by bcf@chromium.org
, May 17 2017