unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* 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

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).