KyleMayes / clang-sys

Rust bindings for libclang.
Apache License 2.0
128 stars 65 forks source link

Build on alpine with libclang-static fail #148

Open EKTehtris opened 1 year ago

EKTehtris commented 1 year ago

Error

/clang-sys # cargo test --features static --no-default-features
   Compiling clang-sys v1.4.0 (/clang-sys)
warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
    --> src/lib.rs:2127:47
     |
2127 |     pub fn clang_getFileTime(file: CXFile) -> time_t;
     |                                               ^^^^^^
     |
     = note: `#[warn(deprecated)]` on by default

warning: `clang-sys` (lib) generated 1 warning
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/tmp/rustcZAcHQ7/symbols.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.1wc9ng8btiinuq9o.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.3bnpumoiz0e6scgl.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.3fpw69u86qcjyp7f.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.447f4776iaq3tnhr.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.55qmso6intxsz3gj.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.5ggpgaynl5e2xqhz.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.il1th7jkklc6zb1.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.2tdl84ujna8c5501.rcgu.o" "-Wl,--as-needed" "-L" "/clang-sys/target/debug/deps" "-L" "/usr/lib" "-L" "/usr/lib/llvm13/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lclang" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAPINotes" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangARCMigrate" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAST" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangASTMatchers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAnalysis" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangApplyReplacements" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangBasic" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangChangeNamespace" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangCrossTU" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDaemon" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDaemonTweaks" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDependencyScanning" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDirectoryWatcher" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDoc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDriver" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDynamicASTMatchers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangEdit" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFormat" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFrontendTool" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangHandleCXX" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangHandleLLVM" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIncludeFixer" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIncludeFixerPlugin" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIndex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIndexSerialization" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangInterpreter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangLex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangMove" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangParse" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangQuery" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangReorderFields" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangRewrite" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangRewriteFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangSema" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangSerialization" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerCheckers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerCore" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTesting" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidy" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAbseilModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAlteraModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAndroidModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyBoostModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyBugproneModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyCERTModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyConcurrencyModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyCppCoreGuidelinesModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyDarwinModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyFuchsiaModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyGoogleModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyHICPPModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLLVMLibcModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLLVMModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLinuxKernelModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMPIModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMain" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMiscModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyModernizeModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyObjCModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyOpenMPModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPerformanceModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPlugin" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPortabilityModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyReadabilityModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyUtils" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyZirconModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTooling" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingASTDiff" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingCore" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingInclusions" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingRefactoring" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingSyntax" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTransformer" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangdRemoteIndex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangdSupport" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lLLVM-13" "-lffi" "-lncursesw" "-lstdc++" "-lz" "-Wl,-Bstatic" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-017c8ab61086c9cf.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-ca4b0676f04ee152.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-b9e7e9486e54b0b7.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-4699ddd1200b2696.rlib" "/clang-sys/target/debug/deps/liblibc-a04de9cb2e98946c.rlib" "/clang-sys/target/debug/deps/libglob-474a0096fbbd4338.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-d8469a8a88e1181d.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-a72d27463816fa59.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-42162405da81aa40.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-5077d86ff4d107bf.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-72e991df97b0a9d1.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-840873116d6ee190.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-c2ca0f634125144e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-aa809fc1ca878bb9.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-4a473812daa68502.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-649d582e34087941.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-3d8936b20048d70b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-fa4926e307193668.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-9cf3b8e9f3b2db27.rlib" "-lunwind" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-721cb731c0549885.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-e351b3dbffffd8e4.rlib" "-lc" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-a80e0174fd85aad8.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-176eaaaaf656231b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-5a1e39ffa5673337.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-7c4df512e1aa59e0.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixer.cpp.o): in function `void std::vector<clang::find_all_symbols::SymbolInfo, std::allocator<clang::find_all_symbols::SymbolInfo> >::_M_realloc_insert<llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&>(__gnu_cxx::__normal_iterator<clang::find_all_symbols::SymbolInfo*, std::vector<clang::find_all_symbols::SymbolInfo, std::allocator<clang::find_all_symbols::SymbolInfo> > >, llvm::StringRef&&, clang::find_all_symbols::SymbolInfo::SymbolKind&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)':
          IncludeFixer.cpp:(.text._ZNSt6vectorIN5clang16find_all_symbols10SymbolInfoESaIS2_EE17_M_realloc_insertIJN4llvm9StringRefENS2_10SymbolKindERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS_ISt4pairINS2_11ContextTypeESE_ESaISI_EEEEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_[_ZNSt6vectorIN5clang16find_all_symbols10SymbolInfoESaIS2_EE17_M_realloc_insertIJN4llvm9StringRefENS2_10SymbolKindERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS_ISt4pairINS2_11ContextTypeESE_ESaISI_EEEEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_]+0xc0): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixer.cpp.o): in function `clang::include_fixer::IncludeFixerSemaSource::getIncludeFixerContext(clang::SourceManager const&, clang::HeaderSearch&, llvm::ArrayRef<clang::find_all_symbols::SymbolInfo>) const [clone .localalias]':
          IncludeFixer.cpp:(.text._ZNK5clang13include_fixer22IncludeFixerSemaSource22getIncludeFixerContextERKNS_13SourceManagerERNS_12HeaderSearchEN4llvm8ArrayRefINS_16find_all_symbols10SymbolInfoEEE+0x1e4): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(YamlSymbolIndex.cpp.o): in function `clang::include_fixer::YamlSymbolIndex::createFromFile(llvm::StringRef) [clone .localalias]':
          YamlSymbolIndex.cpp:(.text._ZN5clang13include_fixer15YamlSymbolIndex14createFromFileEN4llvm9StringRefE+0x9c): undefined reference to `clang::find_all_symbols::ReadSymbolInfosFromYAML(llvm::StringRef)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixerContext.cpp.o): in function `clang::include_fixer::(anonymous namespace)::createQualifiedNameForReplacement(llvm::StringRef, llvm::StringRef, clang::find_all_symbols::SymbolInfo const&)':
          IncludeFixerContext.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_133createQualifiedNameForReplacementEN4llvm9StringRefES3_RKNS_16find_all_symbols10SymbolInfoE+0x56): undefined reference to `clang::find_all_symbols::SymbolInfo::getQualifiedName[abi:cxx11]() const'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

warning: `clang-sys` (lib test) generated 1 warning (1 duplicate)
error: could not compile `clang-sys` due to previous error; 1 warning emitted
/clang-sys # 

How to reproduce

Install alpine 3.16 64bits (you can also use docker: docker run -it --rm alpine:3.16 sh)

apk update
apk add clang-static llvm-dev zlib-dev libffi-dev ncurses-dev gcc g++ git rustup 
rustup-init -y
source $HOME/.cargo/env
git clone https://github.com/KyleMayes/clang-sys
cd clang-sys
cargo test --features static --no-default-features

Setup

localhost:~# uname -a
Linux localhost 5.15.74-0-lts #1-Alpine SMP Sat, 15 Oct 2022 18:26:49 +0000 x86_64 Linux

localhost:~# c++ --version
c++ (Alpine 11.2.1_git20220219) 11.2.1 20220219
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

localhost # cc --version
cc (Alpine 11.2.1_git20220219) 11.2.1 20220219
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

localhost:~# clang --version
Alpine clang version 13.0.1
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: /usr/bin

GDB

/clang-sys # gdb --args cargo test --features static --no-default-features
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cargo...
(No debugging symbols found in cargo)
(gdb) run
Starting program: /root/.cargo/bin/cargo test --features static --no-default-features
warning: Error disabling address space randomization: Operation not permitted
process 5947 is executing new program: /root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/cargo
[New LWP 5951]
warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
    --> src/lib.rs:2127:47
     |
2127 |     pub fn clang_getFileTime(file: CXFile) -> time_t;
     |                                               ^^^^^^
     |
     = note: `#[warn(deprecated)]` on by default

   Compiling clang-sys v1.4.0 (/clang-sys)
[New LWP 5952]
warning: `clang-sys` (lib) generated 1 warning
[Detaching after fork from child process 5953]10: clang-sys(test)                                                                                   
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/tmp/rustcFrErDc/symbols.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.1wc9ng8btiinuq9o.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.3bnpumoiz0e6scgl.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.3fpw69u86qcjyp7f.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.447f4776iaq3tnhr.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.55qmso6intxsz3gj.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.5ggpgaynl5e2xqhz.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.il1th7jkklc6zb1.rcgu.o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751.2tdl84ujna8c5501.rcgu.o" "-Wl,--as-needed" "-L" "/clang-sys/target/debug/deps" "-L" "/usr/lib" "-L" "/usr/lib/llvm13/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lclang" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAPINotes" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangARCMigrate" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAST" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangASTMatchers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangAnalysis" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangApplyReplacements" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangBasic" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangChangeNamespace" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangCrossTU" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDaemon" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDaemonTweaks" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDependencyScanning" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDirectoryWatcher" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDoc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDriver" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangDynamicASTMatchers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangEdit" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFormat" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangFrontendTool" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangHandleCXX" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangHandleLLVM" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIncludeFixer" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIncludeFixerPlugin" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIndex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangIndexSerialization" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangInterpreter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangLex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangMove" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangParse" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangQuery" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangReorderFields" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangRewrite" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangRewriteFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangSema" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangSerialization" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerCheckers" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerCore" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangStaticAnalyzerFrontend" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTesting" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidy" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAbseilModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAlteraModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyAndroidModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyBoostModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyBugproneModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyCERTModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyConcurrencyModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyCppCoreGuidelinesModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyDarwinModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyFuchsiaModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyGoogleModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyHICPPModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLLVMLibcModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLLVMModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyLinuxKernelModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMPIModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMain" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyMiscModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyModernizeModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyObjCModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyOpenMPModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPerformanceModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPlugin" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyPortabilityModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyReadabilityModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyUtils" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTidyZirconModule" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTooling" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingASTDiff" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingCore" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingInclusions" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingRefactoring" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangToolingSyntax" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangTransformer" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangdRemoteIndex" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-lclangdSupport" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lLLVM-13" "-lffi" "-lncursesw" "-lstdc++" "-lz" "-Wl,-Bstatic" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-017c8ab61086c9cf.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-ca4b0676f04ee152.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-b9e7e9486e54b0b7.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-4699ddd1200b2696.rlib" "/clang-sys/target/debug/deps/liblibc-a04de9cb2e98946c.rlib" "/clang-sys/target/debug/deps/libglob-474a0096fbbd4338.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-d8469a8a88e1181d.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-a72d27463816fa59.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-42162405da81aa40.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-5077d86ff4d107bf.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-72e991df97b0a9d1.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-840873116d6ee190.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-c2ca0f634125144e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-aa809fc1ca878bb9.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-4a473812daa68502.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-649d582e34087941.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-3d8936b20048d70b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-fa4926e307193668.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-9cf3b8e9f3b2db27.rlib" "-lunwind" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-721cb731c0549885.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-e351b3dbffffd8e4.rlib" "-lc" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-a80e0174fd85aad8.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-176eaaaaf656231b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-5a1e39ffa5673337.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-7c4df512e1aa59e0.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/clang-sys/target/debug/deps/clang_sys-a30cf8190f086751" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixer.cpp.o): in function `void std::vector<clang::find_all_symbols::SymbolInfo, std::allocator<clang::find_all_symbols::SymbolInfo> >::_M_realloc_insert<llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&>(__gnu_cxx::__normal_iterator<clang::find_all_symbols::SymbolInfo*, std::vector<clang::find_all_symbols::SymbolInfo, std::allocator<clang::find_all_symbols::SymbolInfo> > >, llvm::StringRef&&, clang::find_all_symbols::SymbolInfo::SymbolKind&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)':
          IncludeFixer.cpp:(.text._ZNSt6vectorIN5clang16find_all_symbols10SymbolInfoESaIS2_EE17_M_realloc_insertIJN4llvm9StringRefENS2_10SymbolKindERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS_ISt4pairINS2_11ContextTypeESE_ESaISI_EEEEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_[_ZNSt6vectorIN5clang16find_all_symbols10SymbolInfoESaIS2_EE17_M_realloc_insertIJN4llvm9StringRefENS2_10SymbolKindERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS_ISt4pairINS2_11ContextTypeESE_ESaISI_EEEEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_]+0xc0): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixer.cpp.o): in function `clang::include_fixer::IncludeFixerSemaSource::getIncludeFixerContext(clang::SourceManager const&, clang::HeaderSearch&, llvm::ArrayRef<clang::find_all_symbols::SymbolInfo>) const [clone .localalias]':
          IncludeFixer.cpp:(.text._ZNK5clang13include_fixer22IncludeFixerSemaSource22getIncludeFixerContextERKNS_13SourceManagerERNS_12HeaderSearchEN4llvm8ArrayRefINS_16find_all_symbols10SymbolInfoEEE+0x1e4): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(YamlSymbolIndex.cpp.o): in function `clang::include_fixer::YamlSymbolIndex::createFromFile(llvm::StringRef) [clone .localalias]':
          YamlSymbolIndex.cpp:(.text._ZN5clang13include_fixer15YamlSymbolIndex14createFromFileEN4llvm9StringRefE+0x9c): undefined reference to `clang::find_all_symbols::ReadSymbolInfosFromYAML(llvm::StringRef)'
          /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libclangIncludeFixer.a(IncludeFixerContext.cpp.o): in function `clang::include_fixer::(anonymous namespace)::createQualifiedNameForReplacement(llvm::StringRef, llvm::StringRef, clang::find_all_symbols::SymbolInfo const&)':
          IncludeFixerContext.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_133createQualifiedNameForReplacementEN4llvm9StringRefES3_RKNS_16find_all_symbols10SymbolInfoE+0x56): undefined reference to `clang::find_all_symbols::SymbolInfo::getQualifiedName[abi:cxx11]() const'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

warning: `clang-sys` (lib test) generated 1 warning (1 duplicate)
[LWP 5952 exited]
error: could not compile `clang-sys` due to previous error; 1 warning emitted

Thread 2 "cargo" received signal SIGUSR1, User defined signal 1.
[Switching to LWP 5951]
0x00007fee0685da13 in syscall () from /lib/ld-musl-x86_64.so.1
(gdb) bt
#0  0x00007fee0685da13 in syscall () from /lib/ld-musl-x86_64.so.1
#1  0x7fffffffffffffff in ?? ()
#2  0x00007fee00000030 in ?? ()
#3  0x00007fedf8b6e700 in ?? ()
#4  0x00007fedf8b6e6c0 in ?? ()
#5  0x0000000000000000 in ?? ()

Related to https://github.com/rust-lang/rust-bindgen/issues/2333