# Can't link libguile header with gcc in guix shell

**URL:** <https://forum.systemcrafters.net/t/cant-link-libguile-header-with-gcc-in-guix-shell/1116>\
**Category:** Guix\
**Tags:** guile\
**Created:** [November 8, 2024, 3:15pm UTC](https://forum.systemcrafters.net/t/cant-link-libguile-header-with-gcc-in-guix-shell/1116 "2024-11-08T15:15:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mibes](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mibes](https://forum.systemcrafters.net/u/mibes)\
**Post date:** [November 8, 2024, 3:15pm UTC](https://forum.systemcrafters.net/t/cant-link-libguile-header-with-gcc-in-guix-shell/1116/1 "2024-11-08T15:15:25Z")

</div>

I am following the [GNU guile tutorial](http://gnu.ist.utl.pt/software/guile/docs/docs-1.8/guile-ref/Linking-Guile-into-Programs.html) and trying to write a c program that links guile.  
I want to compile it with gcc using guix shell. When running eg:

```sh
guix shell guile -- gcc -o simple-guile simple-guile.c \
`pkg-config --cflags --libs guile-3.0`

```

I get a no such file for `libguile.h`.

The beginning of the tutorial suggests that guile should be installed in `/usr/local/` but my (mis)understanding of guix is that rather than installing in `/usr/local/` it should be added `gnu/store` automatically (using eg `guix install`) and added to the include path automatically. Is this wrong?

If I check the `$C_INCLUDE_PATH` inside the guix shell has `/gnu/store/<hash>-profile/include/` which does not have the libguile.h inside. It also has the `.guix-home/profile/include` which also doesn’t have the header.

Outside the guix shell, I can find the header file at:

```auto
gnu/store/<different-hash>-guile-3.0.9/include/guile/3.0/libguile.h

```

How do I ensure gcc can access this header within a `guix shell`? (short of pointing it directly at the path above, which feels like I’m doing guix wrong)

---

<div class="post-metadata">

**Author:** ![mirkoh](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@mirkoh](https://forum.systemcrafters.net/u/mirkoh)\
**Post date:** [November 9, 2024, 5:10am UTC](https://forum.systemcrafters.net/t/cant-link-libguile-header-with-gcc-in-guix-shell/1116/2 "2024-11-09T05:10:00Z")

</div>

I’m not 100% sure but I think that you need to include some compiler in the guix shell command , gcc-toolchain for example. And I believe the same is true for info manuals, info-reader seems to be required.

---

<div class="post-metadata">

**Author:** ![mibes](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mibes](https://forum.systemcrafters.net/u/mibes)\
**Post date:** [November 9, 2024, 10:14pm UTC](https://forum.systemcrafters.net/t/cant-link-libguile-header-with-gcc-in-guix-shell/1116/3 "2024-11-09T22:14:11Z")

</div>

Thanks for the response. I asked on the `#guix` IRC and got things working as a result. Updating here in case it helps someone else:

The mistake in the guix shell command above is that the pkg-config call is happening outside the guix shell (of course, because in bash the `code in backticks` is executed and replaced with its result).

Instead start a guix shell with the required packages:

```sh
guix shell guile gcc-toolchain pkg-config

```

and then, inside the shell, call gcc with the nested call to pkg-config

```sh
gcc -o simple-guile simple-guile.c `pkg-config --cflags --libs guile-3.0`

```
