← Back to issue list

ld throws libc_nonshared.a: No such file or directory when run inside snap environment

View original Launchpad issue

Metadata

Project
snapcraft
Number
#2026734
Type
issue
State
open
Author
~mertkirpici
Labels
Created
2023-07-10 14:18:01.532627+00:00
Updated
2023-07-10 14:18:01.990403+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

I was trying to snap an application which has a feature to create a virtual environments and I was facing an error trying to compile the netifaces module during the venv creation. I traced that problem further and found that, during the configuration phase, the netifaces package tries to compile small programs[0] to discover the capabilities of the environment it is running in. Which was seemingly not working properly. When I tried to compile the program manually, I discovered the error: /snap/demo/x1/usr/bin/ld: cannot find /usr/lib/x86_64-linux-gnu/libc_nonshared.a: No such file or directory collect2: error: ld returned 1 exit status I tried to use the GCC_EXEC_PATH and LIBRARY_PATH but couldn't manage to get it work. The workaround I found was to use: ``` layout: /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libc_nonshared.a: bind-file: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libc_nonshared.a ``` in the snapcraft.yaml. I am attaching the snapcraft yaml that reproduces the issue, I am testing using snapcraft v7.4.3. Reproducing steps: sudo snap install ./demo_0.1_amd64.snap --dangerous snap run --shell demo.demo gcc $SNAP/test.c [0] https://github.com/al45tair/netifaces/blob/release_0_11_0/setup.py#L139

Evaluation history

No evaluation history available.