faustlive icon indicating copy to clipboard operation
faustlive copied to clipboard

fails to build with Qt5 if faust is installed into /usr

Open umlaeute opened this issue 6 years ago • 1 comments

This is on a Debian system with faust-2.15.11: faust binaries (faust, and the faust2... generators) are installed into /usr/bin, faust-headers are installed into /usr/include/faust/; e.g. /usr/include/faust/dsp/libfaust.h)

Building faustlive with QT5 results in a build failure:

$ cd Build
$ mkdir flbuild
$ cd flbuild
$ QT_SELECT=5 qmake ..
Info: creating stash file .../faustlive/Build/flbuild/.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.2
Project MESSAGE: Uses dynamic link for Faust libs
Project MESSAGE: Jack included
$ make
g++ -c -pipe -std=c++11 -O2 -Wall -W -D_REENTRANT -fPIC -DVERSION=\"2.5.2\" -DAPP_VERSION=\"2.0\" -DLLVM_VERSION=\"8.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/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -Itmp -isystem /usr/include/libdrm -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o tmp/main.o ../../src/Utilities/main.cpp
In file included from /usr/include/c++/9/ext/string_conversions.h:41,
                 from /usr/include/c++/9/bits/basic_string.h:6493,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from ../../src/Utilities/main.cpp:12:
/usr/include/c++/9/cstdlib:75:15: fatal error: stdlib.h: Datei oder Verzeichnis nicht gefunden
   75 | #include_next <stdlib.h>
      |               ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:818: tmp/main.o] Fehler 1
$

afaict, the issue is, that faust -includedir (correctly) returns /usr/include, which sets FAUSTINC (in FaustLive.pro) to /usr/include. FAUSTINC is then added to INCLUDEPATH in https://github.com/grame-cncm/faustlive/blob/fdb68d1e54af44cd9cbbf846cef1737c5a2feca4/Build/FaustLive.pro#L63

qmake-qt5 will then take this to generate a Makefile containing (linebreaks inserted for readabilty):

INCPATH       = \
    -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/x86_64-linux-gnu/qt5 \
    -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets \
    -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui \
    -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork \
    -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore \
    -Itmp \
    -isystem /usr/include/libdrm \
    -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++

Now the problem is the line -isystem /usr/include which prevents gcc from finding the relevant headers.

There's a gcc-bug about this, but it was rejected with:

Then they [who add -isystem to their build-flags] should stop (mis)using -isystem, since it's clearly documented to affect the order directories are searched: [...]

There's also a qmake-bug about the issue.

I have no idea how to fix this on the FaustLive side (I'm a very casual qmake user), but i think the ideal solution would be to somehow tell qmake to use -I instead of -isystem for any of the paths declared in INCLUDEPATH.

My current workaround is to juse remove $$FAUSTINC from the INCLUDEPATH, which works because /usr/include is included anyhow, but that might not be acceptable for FaustLive in general.

umlaeute avatar Sep 20 '19 09:09 umlaeute

Another workaround i just found, is setting the QMAKE_CFLAGS_ISYSTEM variable to an empty string, which forces qmake to use -I instead of -isystem and thus making the build succeed:

$ QT_SELECT=5 qmake .. QMAKE_CFLAGS_ISYSTEM="
[...]
$ make
[...]
$ echo $?
0
$

I don't know whether this could/should be set globally in Build/FaustLive.pro.

umlaeute avatar Sep 20 '19 09:09 umlaeute