awslabs / awslabs/aws-lambda-cpp

Aws Lambda: C++ custom runtime - /usr/bin/ld: cannot find /usr/lib64/libc_nonshared.a

Aberta
#96 2 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
465
Forks
98
Merge médio
12h 47min
PRs com merge (30d)
3

Descrição

I am trying to add `g++` inside `AWS Lambda C++ custom runtime`.

Now `g++` requires `.so` (shared libraries) files as well as `.a` (static libraries).

For this, I installed g++ inside chroot directory (directory `gpp`) on the Amazon Linux machine.

Now, I created another directory that has `bin`, `usr`, `lib`, and `lib64` directories (taken from chroot directory). I created a zip of this directory, uploaded to s3 (as it is more than 50MB), and created a Lambda layer using this zip directory.

Now, after adding this `layer` in the `lambda` function, I am trying to run.
```
execl("/opt/usr/bin/g++48", "/opt/usr/bin/g++48", "-Wall", "/tmp/hello.cpp","-o", "/tmp/hello.o",
"-I/opt/gpp3/usr/include/", (char *) 0)
```

Using the above `g++` is able to find `shared libraries` as well as `header files` but it is not able to find the static library.

```
/usr/bin/ld: cannot find /usr/lib64/libc_nonshared.a
collect2: error: ld returned 1 exit status
```
`libc_nonshared.a` exists inside `/opt/gpp3/usr/lib64/` but it is searching in `/usr/lib64/`.

I tried providing full path in g++ command as `-L/opt/gpp3/usr/lib64/libc_nonshared.a` and
`-L/opt/gpp3/usr/lib64/libc_nonshared` and `-L/opt/gpp3/usr/lib64/`

But none of them works. Any help is deeply appreciated.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece com a invocação execl relatada e os caminhos das layers do AWS Lambda em /opt/gpp3; em seguida, investigue por que o linker procura em /usr/lib64 em vez do diretório da layer. Reproduza o comando g++48 e verifique se libc_nonshared.a é resolvido a partir de /opt/gpp3/usr/lib64; a issue estará concluída quando a compilação de exemplo for bem-sucedida no ambiente Lambda.

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

Avaliação

Stack de tecnologia
aws, cpp, linux
Domínio
build-system, cloud
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

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