* arm-none-eabi-toolchain: stdlib.h not found
@ 2023-10-07 11:44 Stefan
0 siblings, 0 replies; 5+ messages in thread
From: Stefan @ 2023-10-07 11:44 UTC (permalink / raw)
To: ekaitz, help-guix
Hi Ekaitz!
I tried to reproduce your problem, and indeed it produces the same error
you are encountering.
$ guix shell arm-none-eabi-toolchain
[env]$ ls
a.c
[env]$ cat a.c
#include <cstdlib>
void operator delete(void* p) {std::free(p);}
int main() {return 0;}
[env]$ arm-none-eabi-g++ -x c++ 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.
Then I tried it with my self build toolchain
gcc12-cross-newlib-arm-none-eabi-toolchain-12.2.0¹, which works as expected:
$ arm-none-eabi-g++ -x c++ -c a.c
$ ls
a.c a.o
$ arm-none-eabi-g++ -x c++ a.c -lg -lrdpmon
$ ls
a.c a.o a.out
$ file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
statically linked, with debug_info, not stripped
Bye
Stefan
¹ https://lists.gnu.org/archive/html/guix-devel/2023-10/msg00014.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arm-none-eabi-toolchain: stdlib.h not found
@ 2024-09-06 21:32 Rutherther
0 siblings, 0 replies; 5+ messages in thread
From: Rutherther @ 2024-09-06 21:32 UTC (permalink / raw)
To: ekaitz, help-guix
Hello Ekaitz,
the issue here is that the CROSS_CPLUS_INCLUDE_PATH contains
the C include path first, but cstdlib is using #include_next "stdlib.h".
Since stdlib.h is previous to cstdlib in include paths, stdlib.h is not
found as "next". As a workaround, change the order in this variable.
Another issue you might have is the libstdc++ not being linked properly,
that might be because currently it outputs to /lib inside of package
output instead of arm-none-eabi/lib. You might try adding the $GUIX_ENVIRONMENT/lib
into your CROSS_LIBRARY_PATH as a workaround.
Regards,
Rutherther
^ permalink raw reply [flat|nested] 5+ messages in thread
* arm-none-eabi-toolchain: stdlib.h not found
@ 2023-09-05 18:09 Ekaitz Zarraga
2023-09-26 22:28 ` Ekaitz Zarraga
0 siblings, 1 reply; 5+ messages in thread
From: Ekaitz Zarraga @ 2023-09-05 18:09 UTC (permalink / raw)
To: help-guix\@gnu.org
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arm-none-eabi-toolchain: stdlib.h not found
2023-09-05 18:09 Ekaitz Zarraga
@ 2023-09-26 22:28 ` Ekaitz Zarraga
2023-09-26 22:35 ` Ekaitz Zarraga
0 siblings, 1 reply; 5+ messages in thread
From: Ekaitz Zarraga @ 2023-09-26 22:28 UTC (permalink / raw)
To: Ekaitz Zarraga; +Cc: help-guix\\@gnu.org
------- 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!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: arm-none-eabi-toolchain: stdlib.h not found
2023-09-26 22:28 ` Ekaitz Zarraga
@ 2023-09-26 22:35 ` Ekaitz Zarraga
0 siblings, 0 replies; 5+ messages in thread
From: Ekaitz Zarraga @ 2023-09-26 22:35 UTC (permalink / raw)
To: Ekaitz Zarraga; +Cc: help-guix\\@gnu.org
ElenQ Technology
------- Original Message -------
On Tuesday, September 26th, 2023 at 22:28, Ekaitz Zarraga <ekaitz@elenq.tech> wrote:
>
> ------- 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!
Oh! Too fast!
It was a different problem!
```
Ekaitz@tuxedo ~/projects/rp2040/TESTS/RANDOM [env]$ arm-none-eabi-g++ -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 a.c
In file included from a.c:1:0:
/gnu/store/6zcm3xq6d3a0j6pnjd09b3zj1c9qbmrl-profile/arm-none-eabi/include/c++/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
```
The problem is with C++ only.
With C, as per the previous email, I managed to pass the preprocessing step, but in C++ it doesn't!
It doesn't really matter if I play with the -I flag.
It just doesn't work :(
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-06 22:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-07 11:44 arm-none-eabi-toolchain: stdlib.h not found Stefan
-- strict thread matches above, loose matches on Subject: below --
2024-09-06 21:32 Rutherther
2023-09-05 18:09 Ekaitz Zarraga
2023-09-26 22:28 ` Ekaitz Zarraga
2023-09-26 22:35 ` Ekaitz Zarraga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).