<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - libc++abi 13.0 still depends on "libgcc_s.so" even when it's built with "-DLIBCXXABI_USE_COMPILER_RT=ON""
href="https://bugs.llvm.org/show_bug.cgi?id=52082">52082</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>libc++abi 13.0 still depends on "libgcc_s.so" even when it's built with "-DLIBCXXABI_USE_COMPILER_RT=ON"
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++abi
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zin.kosmos.1190@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>## Overview
When I build llvm project 13.0.0 (which includes libc++abi) using cmake with
"-DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON" options,
libc++abi still depends on "libgcc_s.so.1".
But according to the clang document "Assembling a Complete Toolchain" (
<a href="https://clang.llvm.org/docs/Toolchain.html#compiler-rt-llvm">https://clang.llvm.org/docs/Toolchain.html#compiler-rt-llvm</a>), libc++abi uses
compiler-rt rather than libgcc with the cmake options.
## System environment
OS: 5.11.0-37-generic #41~20.04.2-Ubuntu
cmake: version 3.21.3
ninja: 1.10.2
## Steps to Reproduce
1. Download "llvm-project-13.0.0.src.tar.xz"
(<a href="https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-project-13.0.0.src.tar.xz">https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-project-13.0.0.src.tar.xz</a>)
and "clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz" (
<a href="https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz">https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz</a>).
We use "clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04" to build
"llvm-project-13.0.0".
2. Extract "clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz" and set
path to the clang binary,
```
export
PATH=${path-to-clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04}/bin:${PATH}
```
3. Extract "llvm-project-13.0.0.src.tar.xz" and build it using cmake and ninja
```
mkdir build
cd build
CC=clang CXX=clang++ cmake -GNinja -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${PWD}/clang-nodeps
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libclc;libcxx;libcxxabi;libunwind;lld;lldb;mlir;openmp;parallel-libs;polly;pstl"
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON -DLIBCXXABI_USE_COMPILER_RT=ON
-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXX_USE_COMPILER_RT=ON
-DLIBUNWIND_USE_COMPILER_RT=ON ../llvm
cmake --build . --config Release --target install --parallel
```
4. Check dependencies using ldd
```
ldd ./clang-nodeps/lib/libc++abi.so
```
## Actual Result
ldd shows the libc++abi depends on "libgcc_s.so.1",
```
linux-vdso.so.1 (0x00007ffd94ec6000)
libunwind.so.1 => /home/sho/local/clang-nodeps/lib/libunwind.so.1
(0x00007f69c244a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f69c2413000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f69c2221000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f69c20d2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f69c20b7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f69c20af000)
/lib64/ld-linux-x86-64.so.2 (0x00007f69c249d000)
```
## Expected Result
This is the ldd result of libc++abi 12.0.1 which doesn't depend on
"libgcc_s.so.1",
```
linux-vdso.so.1 (0x00007ffe69de5000)
libunwind.so.1 => /home/sho/local/clang-nodeps/lib/libunwind.so.1
(0x00007f9bd8c08000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f9bd8bd1000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9bd89df000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9bd89d9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9bd8c5b000)
```</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>