<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55629>55629</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            libunwind fails to build on Debian Buster on a `error: undefined reference to 'pthread_rwlock_wrlock'`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libunwind,
            build-problem
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sylvestre
      </td>
    </tr>
</table>

<pre>
    Fails on arm64 & amd64
```
FAILED: /build/llvm-toolchain-snapshot-15~++20220521115334+295d032762ad/build-llvm/lib/libunwind.so.1.0 
: && "/build/llvm-toolchain-snapshot-15~++20220521115334+295d032762ad/build-llvm/./bin/clang" --target=aarch64-unknown-linux-gnu -fPIC -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/build/llvm-toolchain-snapshot-15~++20220521115334+295d032762ad/build-llvm/runtimes/runtimes-bins=build-llvm/runtimes/runtimes-bins -ffile-prefix-map=/build/llvm-toolchain-snapshot-15~++20220521115334+295d032762ad/= -no-canonical-prefixes -O3 -DNDEBUG  -Wl,-z,relro -Wl,--build-id -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold  -rtlib=compiler-rt --unwindlib=none -nostdlib++ -shared -Wl,-soname,libunwind.so.1 -o "/build/llvm-toolchain-snapshot-15~++20220521115334+295d032762ad/build-llvm/lib/libunwind.so.1.0" libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-EHABI.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-seh.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindLevel1.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindLevel1-gcc-ext.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-sjlj.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindRegistersRestore.S.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindRegistersSave.S.o   && :
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_iterate_dwarf_unwind_cache: error: undefined reference to 'pthread_rwlock_wrlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_iterate_dwarf_unwind_cache: error: undefined reference to 'pthread_rwlock_unlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function libunwind::DwarfFDECache<libunwind::LocalAddressSpace>::add(unsigned long, unsigned long, unsigned long, unsigned long): error: undefined reference to 'pthread_rwlock_wrlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function libunwind::DwarfFDECache<libunwind::LocalAddressSpace>::add(unsigned long, unsigned long, unsigned long, unsigned long): error: undefined reference to 'pthread_rwlock_unlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_remove_dynamic_fde: error: undefined reference to 'pthread_rwlock_wrlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_remove_dynamic_fde: error: undefined reference to 'pthread_rwlock_unlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_remove_dynamic_eh_frame_section: error: undefined reference to 'pthread_rwlock_wrlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function __unw_remove_dynamic_eh_frame_section: error: undefined reference to 'pthread_rwlock_unlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_arm64>::getFunctionName(char*, unsigned long, unsigned long*): error: undefined reference to 'dladdr'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_arm64>::setInfoBasedOnIPRegister(bool): error: undefined reference to 'pthread_rwlock_rdlock'
libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o:libunwind.cpp:function libunwind::DwarfFDECache<libunwind::LocalAddressSpace>::findFDE(unsigned long, unsigned long): error: undefined reference to 'pthread_rwlock_rdlock'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdWE1v2zgQ_TX2haBhS7FjH3xw_LEboNsUSYvFngSapCQ2FGmQlJ301--jZLtOscBmW2fTFDAkcUi_mTcczXC0tuJxumJKe2INYa4aXZBOMiKsEqOLTn_R6c86o_7-1wxXs-t3y0UnnWHdal0rLXDXelvRYK3mJVOGesM2vrSBDoady2UnucIv6SdJf5gMBoNhml5EwWQo-mlyOUqYOEDRCBTx1Lq91manjOh52xv0-mRvUKN7FM3sJMkLWtGLAmVw5ZqZAsoIpYG5QoZOumDM8XJ0QWtzb-zOUK1M_UALUxOaf7ie4-oD4_d042yQPFhHfXDWFIT-mVtXsYAH6Zx1wGoF1EteOxUeMWMsgGsvBeW2qpgREV9SKK8raeJ_BQuSBlVJQhfZ6ub24_Xqr-zu5tPtfAnE5GgFkLwEQlCcKhOk21ivgsJ2f9V_gnWU1aaomROwgG0RIGytNEyjRu6wiGkdlz4Ex54Yu2GOVRJKIN2BioyklSk8xpXyHo80VxI-VgZGMK2-SBcnVbXRiqtA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