github / github/codeql-cli-binaries

Building sgx-lkl under codeql fails.

Aperta
#34 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug CLI
Lingua principale
Nessun dato sulla lingua
Stelle
1k
Fork
184
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Reproduce the failure with the listed CodeQL database creation command and inspect third_party/popt/config.log. Trace the interaction between make, the musl-gcc-built test program, and CodeQL's tools/linux64/preload_tracer and lib64trace.so. Done means the sgx-lkl build completes under CodeQL without the dynamic-linker or relocation errors.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c
Ambito
build-system, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.