← 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 (launchpad)
Number
#2026734
Type
issue
State
open
Author
~mertkirpici
Labels
—
Created
Updated
Closed
—

Current evaluation

Runtime GCC in a snap cannot link because libc_nonshared.a is unresolved; an exact repro and bind-file workaround exist, but the issue remains unlabeled and untriaged.

Suggested action: needs triage

Reason: The report provides Snapcraft 7.4.3, the exact `gcc $SNAP/test.c` reproduction, the missing-file linker error, and a working layout workaround. However, it has no labels, assignee, or substantive maintainer response, and determining whether the fix belongs in the base, toolchain packaging, or documented layout guidance still requires triage.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 17 Complexity: 55 Confidence: 87 Actionability: 82

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

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 17
Complexity: 55
Confidence: 87
Actionability: 82
needs triage Runtime GCC in a snap cannot link because libc_nonshared.a is unresolved; an exact repro and bind-file workaround exist, but the issue remains unlabeled and untriaged.
stealth/space-bunny-alpha
Impact: 48
Quick Win: 13
Complexity: 62
Confidence: 86
Actionability: 74
needs triage Runtime GCC inside a snap cannot link because libc_nonshared.a is absent; the report has an exact repro and bind-file workaround but remains unlabeled and untriaged.
stealth/space-bunny-alpha
Impact: 55
Quick Win: 16
Complexity: 40
Confidence: 73
Actionability: 48
needs triage Bundled GCC cannot link inside the snap because ld looks for libc_nonshared.a at a host-only absolute path; binding it from the snap works around a runtime compiler break.
qwen3.6-35b-a3b-mtp-q6
Impact: 20
Quick Win: 12
Staleness: 85
Complexity: 40
Confidence: 65
Support Request: 75
close not a bug User reports linker error for libc_nonshared.a when compiling inside snap environment; found workaround using snapcraft layout
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 40
close stale Compilation fails inside snap environment due to missing libc_nonshared.a. Issue has been inactive for over three years with a documented workaround in snapcraft.yaml.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 85
Support Request: 20
close stale Compilation error in snap environment due to missing libc_nonshared.a. Reported over 3 years ago with no maintainer response or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 30
Confidence: 85
Support Request: 70
close stale Linker fails to find libc_nonshared.a when compiling inside a snap environment. Author provided a snapcraft layout workaround. Issue has seen no maintainer interaction in over three years.

Update history

Date Change
created

Related issues

No related issues found above the similarity threshold.