Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cstdlib:75:15: fatal error: stdlib.h: No such file or directory #278

Open
l29ah opened this issue Aug 11, 2018 · 7 comments
Open

cstdlib:75:15: fatal error: stdlib.h: No such file or directory #278

l29ah opened this issue Aug 11, 2018 · 7 comments

Comments

@l29ah
Copy link
Contributor

l29ah commented Aug 11, 2018

Trying to build QtQuickVcp using gcc-7.3.0, getting a bunch of such errors:

x86_64-pc-linux-gnu-g++ -c -O2 -pipe -march=nehalem -mtune=ivybridge -w -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -I. -Ibuild/cpp -isystem /usr/include -I/usr/lib64/qt5/mkspecs/linux-g++ -o emcclass.pb.o build/cpp/machinetalk/protobuf/emcclass.pb.cc
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/ext/string_conversions.h:41:0,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/bits/basic_string.h:6349,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/string:52,
                 from build/cpp/machinetalk/protobuf/types.pb.h:7,
                 from build/cpp/machinetalk/protobuf/types.pb.cc:4:
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~

Removing -isystem /usr/include from the compiler args fixes it.

@ArcEye
Copy link
Contributor

ArcEye commented Aug 12, 2018

This occurs throughout Qt in later versions with newer compilers.

The way to fix it is to edit mkspecs/common/gcc-base.conf

Change QMAKE_CFLAGS_ISYSTEM = -isystem
to QMAKE_CFLAGS_ISYSTEM = -I (capital i)

I have been doing this since Qt 5.10.0 at least

@l29ah
Copy link
Contributor Author

l29ah commented Aug 12, 2018

Thanks! I found out it's simpler to just call qmake 'QMAKE_CFLAGS_ISYSTEM=-I'.

l29ah added a commit to l29ah/booboo that referenced this issue Aug 12, 2018
@ArcEye
Copy link
Contributor

ArcEye commented Aug 12, 2018

If I don't fix it at source, I am liable to waste time the next time it occurs, remembering what I did to fix it last 😝

@insangi
Copy link

insangi commented Aug 2, 2019

@ArcEye and @l29ah
This post helped me get rid of stdlib.h issue.
Do you mind helping me I am trying to make QT for tx1 using GCC. I am getting this error at the end. Please help me solve this. Thank you

/Downloads/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:1179: recipe for target '../../lib/libQt5Core.so.5.14.0' failed
make[2]: *** [../../lib/libQt5Core.so.5.14.0] Error 1
make[2]: Leaving directory '/home/ibrahim/Downloads/qtbase/src/corelib'
Makefile:198: recipe for target 'sub-corelib-make_first' failed
make[1]: *** [sub-corelib-make_first] Error 2
make[1]: Leaving directory '/home/ibrahim/Downloads/qtbase/src'
Makefile:50: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2

@ekubay
Copy link

ekubay commented Feb 15, 2020

hi guys where can I find this "QMAKE_CFLAGS_ISYSTEM = -isystem"
to QMAKE_CFLAGS_ISYSTEM = -I (capital i)
please help me

@surajmahangade
Copy link

surajmahangade commented Jun 13, 2020

@ekubay
Run
sudo find / -name "gcc-base.conf"
as @ArcEye mentioned change file in this location mkspecs/common/

@vishnuu95
Copy link

I had the same problem recently. I believe the issue was due to multiple gcc versions. A easy fix was to navigate to c++/8/ folder and replace all #include_next with #include . The files stdlib.h are present in the same directory itself and hence #include does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants