github / github/codeql-cli-binaries
Building sgx-lkl under codeql fails.
- 主要言語
- 言語のデータがありません
- スター
- 1k
- フォーク
- 184
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
This is based on the following LGTM ticket: https://discuss.lgtm.com/t/error-loading-shared-library-ld-linux-x86-64-so-2-no-such-file-or-directory-needed-by-opt-dist-tools-lib64trace-so/2944/4
Build [sgx-lkl](https://github.com/lsds/sgx-lkl.git) as follows:
```sh
sudo apt-get install make gcc g++ bc python xutils-dev bison flex libgcrypt20-dev libjson-c-dev automake autopoint autoconf pkgconf libtool libcurl4-openssl-dev libprotobuf-dev libprotobuf-c-dev protobuf-compiler protobuf-c-compiler libssl-dev
git clone https://github.com/lsds/sgx-lkl.git
cd sgx-lkl
git submodule init
git submodule update --recursive
~/codeql-releases/codeql-2.2.2/codeql/codeql database create /tmp/db-sgx-lkl -l cpp -c "make"
```
After a while the build fails:
```
[2020-06-15 11:15:28] [build] checking for C compiler default output file name... a.out
[2020-06-15 11:15:28] [build-err] configure: error: in `/home/mgretton/git-repos/sgx-lkl/third_party/popt':
[2020-06-15 11:15:28] [build-err] configure: error: cannot run C compiled programs.
[2020-06-15 11:15:28] [build-err] If you meant to cross compile, use `--host'.
[2020-06-15 11:15:28] [build-err] See `config.log' for more details.
[2020-06-15 11:15:28] [build-err] make[1]: *** [Makefile:74: /home/mgretton/git-repos/sgx-lkl/build/cryptsetup/lib/libpopt.a] Error 1
[2020-06-15 11:15:28] [build-err] make[1]: unlink: /home/mgretton/git-repos/sgx-lkl/third_party/popt: Is a directory
[2020-06-15 11:15:28] [build] checking whether the C compiler works... rm /home/mgretton/git-repos/sgx-lkl/third_party/popt
[2020-06-15 11:15:28] [build] make[1]: Leaving directory '/home/mgretton/git-repos/sgx-lkl/third_party'
[2020-06-15 11:15:28] [build-err] make: *** [Makefile:41: /home/mgretton/git-repos/sgx-lkl/build/cryptsetup/lib/libcryptsetup.a] Error 2
[2020-06-15 11:15:28] [ERROR] Spawned process exited abnormally (code 2; tried to run: [/home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/preload_tracer, make])
A fatal error occurred: Exit status 2 from command: [make]
```
Looking in the appropriate `config.log` (third_party/popt/config.log) has the following error message:
```
configure:3186: checking for C compiler default output file name
configure:3208: /home/mgretton/git-repos/sgx-lkl/build/host-musl/bin/musl-gcc -O3 -fPIC -Wl,--dynamic-linker=/home/mgretton/git-repos/sgx-lkl/build/host-musl/lib/libc.so conftest.c >&5
configure:3212: $? = 0
configure:3250: result: a.out
configure:3269: checking whether the C compiler works
configure:3279: ./a.out
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/lib64trace.so)
Error relocating /home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/lib64trace.so: __strdup: symbol not found
Error relocating /home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/lib64trace.so: __libc_dlopen_mode: symbol not found
Error relocating /home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/lib64trace.so: __libc_dlsym: symbol not found
Error relocating /home/mgretton/codeql-releases/codeql-2.2.2/codeql/tools/linux64/lib64trace.so: _dl_argv: symbol not found
configure:3283: $? = 127
configure:3290: error: in `/home/mgretton/git-repos/sgx-lkl/third_party/popt':
configure:3294: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
```
This is a tracing issue.
コントリビューションガイド
調査の方向性
記載されている CodeQL データベース作成コマンドで失敗を再現し、third_party/popt/config.log を調査してください。make、musl-gcc でビルドされたテストプログラム、CodeQL の tools/linux64/preload_tracer および lib64trace.so の間の相互作用を追跡してください。CodeQL 上で sgx-lkl のビルドがダイナミックリンカーまたはリロケーションのエラーなしに完了すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- build-system, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100