Difficulty accessing libc6-dev headers from Nim language snap


Nim by default compiles to C and then calls gcc to compile to binary.

I have a Nim nightly build bundled in a snap here.

I am hitting a roadblock when it comes to building an application to binaries. Thank you in advance for your assistance.

tl;dr Nim cannot seem to reach necessary libc6-dev headers inside the snap.

I would appreciate some advice on how to proceed.

To reproduce:

1. snap refresh
2. snap install nim-lang-nightly --edge
3. echo 'echo "hello world"' > hello.nim
4. nim-lang-nightly.nim c -r hello.nim

What happens:

Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: hello [Processing]
Hint: gcc -c   -I/snap/nim-lang-nightly/34/lib -I/root -o /root/snap/nim-lang-nightly/34/.cache/nim/hello_d/stdlib_io.nim.c.o /root/snap/nim-lang-nightly/34/.cache/nim/hello_d/stdlib_io.nim.c [Exec]
In file included from /snap/nim-lang-nightly/34/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:7:0,
                 from /snap/nim-lang-nightly/34/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:34,
                 from /snap/nim-lang-nightly/34/lib/nimbase.h:257,
                 from /root/snap/nim-lang-nightly/34/.cache/nim/hello_d/stdlib_io.nim.c:9:
/snap/nim-lang-nightly/34/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory

What should happen:

Hint: system [Processing]
Hint: hello [Processing]
Hint: gcc -c  -w  -I/usr/lib/nim -o /root/.cache/nim/hello_d/hello.c.o /root/.cache/nim/hello_d/hello.c [Exec]
Hint: gcc -c  -w  -I/usr/lib/nim -o /root/.cache/nim/hello_d/stdlib_system.c.o /root/.cache/nim/hello_d/stdlib_system.c [Exec]
Hint:  [Link]
Hint: operation successful (12381 lines compiled; 0.475 sec total; 16.309MiB peakmem; Debug Build) [SuccessX]
Hint: /root/hello  [Exec]
hello world

What I think is happening:

Nim cannot reach headers installed by libc6-dev.

What I have attempted:

What I have not attempted:

  • Copying the needed headers into my snap and then making sure my PATH is set correctly in the snap to the copied libraries. I couldn’t find much on setting path inside the snap and I wanted to post this to get guidance before trying this.


  • Original nim_lang_snap bug report.
  • Nim forum discussion.
  • I received a report that the Rust compiler had similar issues, though I could not reproduce, and that this was an issue for R as well, but i did not attempt to build an R snap.
  • Nim can also compile to C++ and Javascript and use other compilers, but for now I am focusing on getting gcc to work.
1 Like

whelp @popey @ogra
can you help with snaping Nim language?