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

FaustLive/faust2jaqt compilation problems with gcc 8.1+ and Qt 5.10+ #295

Closed
agraef opened this issue Mar 8, 2019 · 3 comments
Closed

Comments

@agraef
Copy link
Collaborator

agraef commented Mar 8, 2019

There is a problem with compiling Faust dsps using faust2jaqt, as well as compiling FaustLive, when using the latest gcc and Qt versions. I'm currently running gcc 8.2 and Qt 5.12 on Arch, but it seems that the issue has been around for a while now, at least since gcc 8.1 and Qt 5.10.

Here's what I get when I compile any Faust dsp source (using the latest faust from git) with faust2jaqt:

$ faust2jaqt subtractive.dsp 
In file included from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
                 from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
                 from /usr/include/c++/8.2.1/string:52,
                 from /usr/include/c++/8.2.1/bits/locale_classes.h:40,
                 from /usr/include/c++/8.2.1/bits/ios_base.h:41,
                 from /usr/include/c++/8.2.1/ios:42,
                 from /usr/include/c++/8.2.1/ostream:38,
                 from /usr/include/c++/8.2.1/iostream:39,
                 from subtractive_tmp.cpp:47:
/usr/include/c++/8.2.1/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:917: subtractive_tmp.o] Error 1

Similarly, when compiling FaustLive (latest from git, running make in the Build directory):

$ make
Faust libraries changed: check that Resources/application.qrc is uptodate.
make unix
make[1]: Entering directory '/home/ag/Scratch/faustlive/Build'
mkdir fldir
cd fldir && qmake .. 
Info: creating stash file /home/ag/Scratch/faustlive/Build/fldir/.qmake.stash
Project MESSAGE: Using Faust libs from /usr/lib
Project MESSAGE: Using Faust incl from /usr/include
Project MESSAGE: Generates FaustLive version 2.5.1
Project MESSAGE: Uses dynamic link for Faust libs
Project MESSAGE: Jack included
make -C fldir -j 4
make[2]: Entering directory '/home/ag/Scratch/faustlive/Build/fldir'
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -W -D_REENTRANT -fPIC -DVERSION=\"2.5.1\" -DAPP_VERSION=\"2.0\" -DLLVM_VERSION=\"7.0.1\" -DHTTPCTRL -DQRCODECTRL -DJACK -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../Build -I. -I../../Build -I../../src/Audio -I../../src/MainStructure -I../../src/MenusAndDialogs -I../../src/Network -I../../src/Utilities -isystem /usr/include -isystem /usr/local/include -I../../src/Audio/JA -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Itmp -isystem /usr/include/libdrm -I/usr/lib/qt/mkspecs/linux-g++ -o tmp/main.o ../../src/Utilities/main.cpp
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -W -D_REENTRANT -fPIC -DVERSION=\"2.5.1\" -DAPP_VERSION=\"2.0\" -DLLVM_VERSION=\"7.0.1\" -DHTTPCTRL -DQRCODECTRL -DJACK -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../Build -I. -I../../Build -I../../src/Audio -I../../src/MainStructure -I../../src/MenusAndDialogs -I../../src/Network -I../../src/Utilities -isystem /usr/include -isystem /usr/local/include -I../../src/Audio/JA -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Itmp -isystem /usr/include/libdrm -I/usr/lib/qt/mkspecs/linux-g++ -o tmp/utilities.o ../../src/Utilities/utilities.cpp
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -W -D_REENTRANT -fPIC -DVERSION=\"2.5.1\" -DAPP_VERSION=\"2.0\" -DLLVM_VERSION=\"7.0.1\" -DHTTPCTRL -DQRCODECTRL -DJACK -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../Build -I. -I../../Build -I../../src/Audio -I../../src/MainStructure -I../../src/MenusAndDialogs -I../../src/Network -I../../src/Utilities -isystem /usr/include -isystem /usr/local/include -I../../src/Audio/JA -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Itmp -isystem /usr/include/libdrm -I/usr/lib/qt/mkspecs/linux-g++ -o tmp/AudioCreator.o ../../src/Audio/AudioCreator.cpp
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -W -D_REENTRANT -fPIC -DVERSION=\"2.5.1\" -DAPP_VERSION=\"2.0\" -DLLVM_VERSION=\"7.0.1\" -DHTTPCTRL -DQRCODECTRL -DJACK -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../Build -I. -I../../Build -I../../src/Audio -I../../src/MainStructure -I../../src/MenusAndDialogs -I../../src/Network -I../../src/Utilities -isystem /usr/include -isystem /usr/local/include -I../../src/Audio/JA -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Itmp -isystem /usr/include/libdrm -I/usr/lib/qt/mkspecs/linux-g++ -o tmp/AudioFader_Implementation.o ../../src/Audio/AudioFader_Implementation.cpp
In file included from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
                 from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
                 from /usr/include/c++/8.2.1/string:52,
                 from ../../src/Audio/AudioCreator.h:16,
                 from ../../src/Audio/AudioCreator.cpp:13:
/usr/include/c++/8.2.1/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
In file included from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
                 from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
                 from /usr/include/c++/8.2.1/string:52,
                 from ../../src/Utilities/utilities.h:4,
                 from ../../src/Utilities/utilities.cpp:3:
/usr/include/c++/8.2.1/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
In file included from /usr/include/c++/8.2.1/ext/string_conversions.h:41,
                 from /usr/include/c++/8.2.1/bits/basic_string.h:6400,
                 from /usr/include/c++/8.2.1/string:52,
                 from /usr/include/c++/8.2.1/bits/locale_classes.h:40,
                 from /usr/include/c++/8.2.1/bits/ios_base.h:41,
                 from /usr/include/c++/8.2.1/ios:42,
                 from /usr/include/c++/8.2.1/ostream:38,
                 from /usr/include/c++/8.2.1/iostream:39,
                 from ../../src/Utilities/main.cpp:12:
/usr/include/c++/8.2.1/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1353: tmp/AudioCreator.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:1345: tmp/utilities.o] Error 1
make[2]: *** [Makefile:1342: tmp/main.o] Error 1
make[2]: Leaving directory '/home/ag/Scratch/faustlive/Build/fldir'
make[1]: *** [Makefile:35: unix] Error 2
make[1]: Leaving directory '/home/ag/Scratch/faustlive/Build'
make: *** [Makefile:28: all] Error 2

In either case, compiling against Qt4 works fine, and with Qt5 I can make the errors go away when adding the setting QMAKE_CFLAGS_ISYSTEM=-I to each qmake command (following the advice at machinekit/QtQuickVcp#278).

This issue seems to be for real, and not just some local misconfiguration on my system. Just google for cstdlib:75:15: fatal error: stdlib.h: No such file or directory, it's all over the place, so many people using Arch and other systems with recent gcc and Qt versions are running into this. As the issue cited above indicates, developers are patching their sources to deal with it.

The root cause seems to be that qmake now spits out -isystem options instead of -I for their includes (anything on INCLUDEPATH), for whatever reason. If an application uses INCLUDEPATH and includes system directories in there (specifically /usr/include), as faust2jaqt and FaustLive do, this wreaks havoc on gcc's system include paths so that g++ doesn't find stuff in /usr/include any more if the g++ system headers use #include_next to include the headers. So it's probably a bad interaction between Qt 5.10+ and either gcc itself or the g++ system headers. Using QMAKE_CFLAGS_ISYSTEM=-I with qmake works around the issue.

The question is what to do about it. Maybe we're supposed to stop using INCLUDEPATH in the way we do? Can anyone with more insight on the latest Qt developments shed some light on this?

If there's no immediate solution other than the suggested workaround, should we handle this upstream or should we rely on package maintainers to work around the issue? (That would be me and David in the case of Arch.) The thing is, if we just ignore this issue upstream, then it will come around to bite us on mainstream Linux distros rather sooner than later, so I think that we need to figure out what's really going on here and act on it in some way.

@agraef
Copy link
Collaborator Author

agraef commented Mar 8, 2019

Here's my suggested fix for faust2jaqt:

--- /usr/bin/faust2jaqt 2019-03-08 10:44:06.000000000 +0100
+++ faust2jaqt  2019-03-08 12:54:26.787644378 +0100
@@ -169,7 +169,7 @@
     (
            cd "$TMP"
            $QMAKE -project "QT += widgets printsupport network" "CONFIG+=warn_off" "$CLANGOPT" "INCLUDEPATH+=$CUR" "INCLUDEPATH+=$FAUSTINC /opt/local/include" "QMAKE_CXXFLAGS=$CXXFLAGS -Wno-unused-parameter $FAUSTTOOLSFLAGS" "LIBS+=$ARCHLIB $SOUNDFILELIBS $OSCLIBS $HTTPLIBS" "HEADERS+=$FAUSTINC/faust/gui/QTUI.h" "RESOURCES+= $FAUSTINC/faust/gui/Styles/Grey.qrc" "$OSCDEFS" "$HTTPDEFS" "$QRDEFS" "$POLYDEFS" "$MIDIDEFS" "$SOUNDFILEDEFS"
-           $QMAKE $SPEC
+           $QMAKE $SPEC QMAKE_CFLAGS_ISYSTEM=-I
         make
     ) > /dev/null || exit

This seems to work fine with both Qt4 and Qt 5.12, but I haven't tested it for any earlier version of Qt5 or any other gcc version than 8.2.

Similarly, the following does the trick for FaustLive:

diff --git a/Build/Makefile b/Build/Makefile
index c6ea50d..bb41095 100644
--- a/Build/Makefile
+++ b/Build/Makefile
@@ -52,10 +52,10 @@ windows:
        @echo Proceed manually.
 
 qmake:
-       cd $(OUTDIR) && qmake .. $(SPEC)
+       cd $(OUTDIR) && qmake .. $(SPEC) QMAKE_CFLAGS_ISYSTEM=-I
 
 $(OUTDIR)/Makefile : $(OUTDIR) FaustLive.pro
-       cd $(OUTDIR) && qmake .. $(SPEC)
+       cd $(OUTDIR) && qmake .. $(SPEC) QMAKE_CFLAGS_ISYSTEM=-I
        
 $(OUTDIR) :
        mkdir $(OUTDIR)

@sletz
Copy link
Member

sletz commented Mar 11, 2019

Should be fixed in a36d7df

@agraef
Copy link
Collaborator Author

agraef commented Mar 13, 2019

Looking good, thanks!

@agraef agraef closed this as completed Mar 13, 2019
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

2 participants