help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arm-none-eabi-toolchain: stdlib.h not found


From: Ekaitz Zarraga
Subject: Re: arm-none-eabi-toolchain: stdlib.h not found
Date: Tue, 26 Sep 2023 22:28:32 +0000


------- Original Message -------
On Tuesday, September 5th, 2023 at 18:09, Ekaitz Zarraga <ekaitz@elenq.tech> 
wrote:


> Hi,
>
> If I guix shell to arm-none-eabi-toolchain:
>
> `Ekaitz@tuxedo ~/projects/TESTS$ guix shell arm-none-eabi-toolchain`
>
> arm-none-eabi-toolchain can't use cstdlib because:
>
> ```
> Ekaitz@tuxedo ~/projects/TESTS [env]$ cat a.c
> #include <cstdlib>
>
> void operator delete(void *p) { std::free(p); }
>
> Ekaitz@tuxedo ~/projects/TESTS [env]$ arm-none-eabi-g++ a.c
> In file included from a.c:1:0:
> /gnu/store/6bq6svar4b2mkp2k3laxqqs1nsxykrvf-profile/arm-none-eabi/include/c++/cstdlib:75:15:
>  fatal error: stdlib.h: No such file or directory
> #include_next <stdlib.h>
>
> ^~~~~~~~~~
> compilation terminated.
> Ekaitz@tuxedo ~/projects/TESTS [env]$
> `But:`
> Ekaitz@tuxedo ~/projects/TESTS [env]$ ls $CROSS_C_INCLUDE_PATH | grep stdlib
> stdlib.h
> ```
>
> Ideas?


Hi,

I dug a little bit further and I found a very interesting behavior:

Preprocessor doesn't work vanilla:

```
Ekaitz@tuxedo ~/projects/rp2040/TESTS/RANDOM [env]$ arm-none-eabi-cpp a.c
# 1 "a.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.c"
a.c:1:10: fatal error: cstdlib: No such file or directory
 #include <cstdlib>
          ^~~~~~~~~
compilation terminated.
```

We have CROSS_CPLUS_INCLUDE_PATH correctly set:

```
Ekaitz@tuxedo ~/projects/rp2040/TESTS/RANDOM [env]$ echo 
$CROSS_CPLUS_INCLUDE_PATH
/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include:/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++:/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi
```

If we insert exactly the same directories pointed by CROSS_CPLUS_INCLUDE_PATH 
manually to the preprocessor it works!

```
Ekaitz@tuxedo ~/projects/rp2040/TESTS/RANDOM [env]$ arm-none-eabi-cpp a.c 
-I/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include 
-I/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++ 
-I/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi
# 1 "a.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.c"
# 1 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib"
 1
# 39 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib"

# 40 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib"
 3

# 1 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/c++config.h"
 1 3
# 533 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/c++config.h"
 3
# 1 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/os_defines.h"
 1 3
# 534 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/c++config.h"
 2 3


# 1 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/cpu_defines.h"
 1 3
# 537 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/arm-none-eabi/bits/c++config.h"
 2 3
# 42 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib"
 2 3
# 75 
"/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib"
 3
...
```

Anyone has an idea of what I'm missing here and why isn't it just automagic?

It should just work, or am I superwrong?

Thanks!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]