github / github/codeql-cli-binaries

Building sgx-lkl under codeql fails.

Aberta
#34 2 comentários 0 reações 0 responsáveis Ver no GitHub
bug CLI
Linguagem predominante
Sem dados de linguagem
Estrelas
1k
Forks
184
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Reproduza a falha com o comando listado de criação do banco de dados do CodeQL e inspecione third_party/popt/config.log. Rastreie a interação entre make, o programa de teste compilado com musl-gcc e o tools/linux64/preload_tracer e o lib64trace.so do CodeQL. Considera-se concluído quando o build do sgx-lkl for concluído no CodeQL sem erros do vinculador dinâmico ou de relocação.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
c
Domínio
build-system, tooling
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.