ClickHouse / ClickHouse/sysroot

unable to find library -lc++, -lgcc_s

オープン
#24 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C
スター
42
フォーク
24
平均マージ
2日 2時間
マージ済み PR(30日)
1

説明

I think i could do something wrong but i wasn't familiar with cross building with clang before. What i did is downloaded this toolchain and libc++. I did not use compiler-rt and libunwind as i do not understand this. Then i executed following command:

clang++ hello.cpp --target=x86_64-v3-linux -isystem stdlib/include --sysroot=C:\cclang\sysroot\linux-x86_64 -s
tdlib=libc++ -fuse-ld="C:\cclang\clang\LLVM\bin\ld.lld" -v

and got the output:

clang version 17.0.5
Target: x86_64-v3-linux
Thread model: posix
InstalledDir: C:\cclang\clang\LLVM\bin
Found candidate GCC installation: C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu\9
Selected GCC installation: C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "C:\\cclang\\clang\\LLVM\\bin\\clang++.exe" -cc1 -triple x86_64-v3-linux -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v "-fcoverage-compilation-dir=C:\\cclang" -resource-dir "C:\\cclang\\clang\\LLVM\\lib\\clang\\17" -isystem stdlib/include -isysroot "C:\\cclang\\sysroot\\linux-x86_64" -internal-isystem "C:\\cclang\\clang\\LLVM\\lib\\clang\\17\\include" -internal-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/local/include" -internal-isystem "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/include/x86_64-linux-gnu" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/include" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/include" -fdeprecated-macro "-fdebug-compilation-dir=C:\\cclang" -ferror-limit 19 -fmessage-length=120 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o "C:\\Users\\Admin\\AppData\\Local\\Temp\\hello-f3784d.o" -x c++ hello.cpp
clang -cc1 version 17.0.5 based upon LLVM 17.0.5 default target x86_64-pc-windows-msvc
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/usr/local/include"
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/include"
#include "..." search starts here:
#include <...> search starts here:
 stdlib/include
 C:\cclang\clang\LLVM\lib\clang\17\include
 C:\cclang\sysroot\linux-x86_64/usr/include/x86_64-linux-gnu
 C:\cclang\sysroot\linux-x86_64/usr/include
End of search list.
 "C:\\cclang\\clang\\LLVM\\bin\\ld.lld" "--sysroot=C:\\cclang\\sysroot\\linux-x86_64" -pie --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../lib64\\Scrt1.o" "C:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64\\crti.o" "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9\\crtbeginS.o" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/lib" "-LC:\\cclang\\sysroot\\linux-x86_64/usr/lib" "C:\\Users\\Admin\\AppData\\Local\\Temp\\hello-f3784d.o" -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9\\crtendS.o" "C:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64\\crtn.o"
ld.lld: error: unable to find library -lc++
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lgcc_s
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

These libraries are seems removed out but the compiler still want link agains them.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告された clang++ コマンドとその詳細な ld.lld 呼び出しから始め、指定された sysroot とライブラリ検索パスがどのように解決されるかを確認します。libc++ と libgcc_s の想定される場所を、コマンドに表示されているパスと比較します。hello.cpp のクロスコンパイルが正常にリンクできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
build-system, compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。