You are not logged in.
Hello
Please,
while testing a package from PKGBUILD with makepkg,
in "make check"
(it builds normally with the --nocheck option, check and tests do not always run fine...)
I had this error message:
gcc 12.1.2-2 and stdlib.h for a c++ program
...
/usr/include/c++/12.2.1/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
75 | #include_next <stdlib.h>
| ^~~~~~~~~~
compilation terminated.
...
make: *** [Makefile:242: check-tcl-examples] Error 2
==> ERROR: A failure occurred in check().
Aborting...
impossible to find "stdlib.h" in /usr/include/c++/12.2.1/
nor a package with it !
A search of stdlib.h find many of "stdlib.h"
find /usr -name stdlib.h
had found many stdlib.h : which one is the good one, or is there a good one ?
/usr/share/klee-uclibc/usr/include/stdlib.h
/usr/share/manul/dbi_clients_src/pin/pin-3.6-97554-g31f0a167d-gcc-linux/extras/crt/include/stdlib.h
/usr/share/manul/dbi_clients_src/pin/pin-3.6-97554-g31f0a167d-gcc-linux/extras/stlport/include/stdlib.h
/usr/share/pin/extras/crt/include/stdlib.h
/usr/share/pin/extras/stlport/include/stdlib.h
...
and probably none is the good one, I mean the same as needed...
What seem important for this problem is
less /usr/include/c++/12.2.1/cstdlib
is here:
#if !_GLIBCXX_HOSTED
// The C standard does not require a freestanding implementation to
// provide <stdlib.h>. However, the C++ standard does still require
// <cstdlib> -- but only the functionality mentioned in
// [lib.support.start.term].
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
namespace std
{
extern "C" void abort(void) throw () _GLIBCXX_NORETURN;
extern "C" int atexit(void (*)(void)) throw ();
extern "C" void exit(int) throw () _GLIBCXX_NORETURN;
#if __cplusplus >= 201103L
# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
extern "C" int at_quick_exit(void (*)(void)) throw ();
# endif
# ifdef _GLIBCXX_HAVE_QUICK_EXIT
extern "C" void quick_exit(int) throw() _GLIBCXX_NORETURN;
# endif
#endif
} // namespace std
#else
// Need to ensure this finds the C library's <stdlib.h> not a libstdc++
// wrapper that might already be installed later in the include search path.
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include <bits/std_abs.h>
So the important thinks are:
1) to unset _GLIBCXX_HOSTED to avoid running the #else directive
_GLIBCXX_HOSTED
2) or find the good <stdlib.h> mentioned in
#include_next
like written here:
// Need to ensure this finds the C library's <stdlib.h> not a libstdc++
// wrapper that might already be installed later in the include search path.
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
Any idea ?
Thanks by advance !
Last edited by Kissarch (2023-03-04 12:46:19)
Kiss (Keep It Simple Stupid) + Arch (since 2009) + Foss (Free Open Source Software)
Offline
What package is this? The problem is most likely the include path which can be impacted by a wide range of compiler flags.
Also, why is this thread's title include [unsolved]?
Last edited by Trilby (2023-03-04 12:49:42)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
impossible to find "stdlib.h" in /usr/include/c++/12.2.1/
nor a package with it !
$ pacman -Ql gcc | grep stdlib.h
gcc /usr/include/c++/12.2.1/stdlib.h
gcc /usr/include/c++/12.2.1/tr1/stdlib.h
$
Looks like something is very wrong with your gcc installation .
please post
pacman -Qkk gcc
Incase that doesn't show errros with gcc, answer trilby's questions.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Lone_Wolf, that's not the stdlib.h that is being included there. That line is including c stdlin or glibc's /usr/include/stdlib.h.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline