[llvm-bugs] [Bug 52082] New: libc++abi 13.0 still depends on "libgcc_s.so" even when it's built with "-DLIBCXXABI_USE_COMPILER_RT=ON"

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 5 08:13:43 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52082

            Bug ID: 52082
           Summary: libc++abi 13.0 still depends on "libgcc_s.so" even
                    when it's built with "-DLIBCXXABI_USE_COMPILER_RT=ON"
           Product: libc++abi
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: zin.kosmos.1190 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

## 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" (
https://clang.llvm.org/docs/Toolchain.html#compiler-rt-llvm), 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"
(https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-project-13.0.0.src.tar.xz)
and "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).
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)
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211005/d9246c58/attachment.html>


More information about the llvm-bugs mailing list