Menu

#261 Unable to build with capnproto 0.7.0

Mercurial tip
open
nobody
None
5
2020-04-24
2018-08-30
David Runge
No

I'm currently unable to compile 3.1.1 using capnproto 0.7.0:

g++ -c -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -std=c++14 -DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS -I/usr/in
clude/sord-0 -I/usr/include/serd-0 -I/usr/include/serd-0 -pthread -pthread -D_REENTRANT -I/usr/include/raptor2 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fsta
ck-protector-strong -fno-plt -fPIC -std=gnu++11 -Wall -W -D_REENTRANT -DHAVE_BZ2 -DHAVE_FFTW3 -DHAVE_FFTW3F -DHAVE_SNDFILE -DHAVE_LIBSAMPLERATE -DHAVE_RUBBERBA
ND -DHAVE_SORD -DHAVE_SERD -DHAVE_CAPNP -DHAVE_LIBLO -DHAVE_PORTAUDIO -DHAVE_JACK -DHAVE_LIBPULSE -DHAVE_LRDF -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_MAD -DHAVE_ID
3TAG -DHAVE_X11 -DHAVE_PIPER -DHAVE_PLUGIN_CHECKER_HELPER -DDYNAMIC_JACK -D__LINUX_ALSASEQ__ -D__LINUX_ALSA__ -DUSE_SORD -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_XM
L_LIB -DQT_CORE_LIB -I. -I. -Ibqvec -Ibqvec/bqvec -Ibqfft -Ibqresample -Ibqaudioio -Ibqaudioio/bqaudioio -Ipiper-cpp -Ichecker -Ichecker/checker -Idataquay -Id
ataquay/dataquay -Isvcore -Isvcore/data -Isvcore/plugin/api/alsa -Isvgui -Isvapp -Ivamp-plugin-sdk -isystem /usr/include/qt -isystem /usr/include/qt/QtNetwork 
-isystem /usr/include/qt/QtXml -isystem /usr/include/qt/QtCore -Io -I/usr/lib/qt/mkspecs/linux-g++ -o o/PiperVampPluginFactory.o svcore/plugin/PiperVampPluginF
actory.cpp                                                                                                                                                     
In file included from /usr/include/kj/memory.h:28,                                                                                                             
                 from /usr/include/kj/array.h:28,                                                                                                              
                 from /usr/include/kj/string.h:29,                                                                                                             
                 from /usr/include/capnp/common.h:33,                                                                                                         
                 from /usr/include/capnp/raw-schema.h:28,                                                                                                      
                 from /usr/include/capnp/generated-header-support.h:30,
                 from piper-cpp/vamp-capnp/piper.capnp.h:6,                                                                                                    
                 from piper-cpp/vamp-capnp/VampnProto.h:35,                                                                                                    
                 from piper-cpp/vamp-client/qt/../CapnpRRClient.h:45,                                                                                          
                 from piper-cpp/vamp-client/qt/PiperAutoPlugin.h:40,                                                                                           
                 from svcore/plugin/PiperVampPluginFactory.cpp:31:                                                                                             
/usr/include/kj/common.h:36:4: error: #error "This code requires C++14. Either your compiler does not support it or it is not enabled."                        
   #error "This code requires C++14. Either your compiler does not support it or it is not enabled."                                                          
    ^~~~~                                                                                                                                                      
/usr/include/kj/common.h:39:6: error: #error "Pass -std=c++14 on the compiler command line to enable C++14."
     #error "Pass -std=c++14 on the compiler command line to enable C++14."                                                                                    
      ^~~~~                                                                                                                                                    
make[1]: *** [Makefile.base:3434: o/PiperVampPluginFactory.o] Error 1

I'm a little unfamiliar with qmake, but I assume that an export CXXFLAGS+=" -std=c++14 before should fix this, but it doesn't.

Any help would be greatly appreciated.

Discussion

  • Chris Cannam

    Chris Cannam - 2018-08-31

    Yes, this is unfortunate. In the next release I will probably update the whole build to C++14 but it's a bit annoying to have that forced by one dependency.

    The C++11 standard is specified a few times in different qmake files, I'm afraid, so there isn't one single place to override it. A shell command like this will do it (in the top level of the SV build tree)

    for x in *.pr* config* Makefile* ; do perl -i -p -e 's/c\+\+11/c++14/g' "$x" ; done
    
     
    • Chris Cannam

      Chris Cannam - 2018-08-31

      In the next release I will probably update the whole build to C++14

      Ah, except I think it isn't supported in the Ubuntu 14.04 that is used both by Travis CI and for my own AppImage builds. That's a problem - will have to think about this.

      (Obviously it makes sense that C++14 wasn't already supported in 2014. The compiler might possibly have the features it needs identified by some development version or GNU standard though, will check.)

       

      Last edit: Chris Cannam 2018-08-31
  • David Runge

    David Runge - 2018-08-31

    Okay. I assumed I could just globally export CXXFLAGS+=" -std=c++14" or something similar. Guess that wouldn't be picked up everywhere.
    However, the following worked for me:

    sed -e 's/c++11/c++14/g' -i *.pr* configure.ac* svcore/svcore.pro svapp/svapp.pro checker/*.pr* svgui/svgui.pro {bqaudioio,piper-cpp}/Makefile piper-cpp/vamp-client/qt/test.pro piper-cpp/ext/json11/Makefile dataquay/{lib.pro,tests/tests.pro}

    btw: Travis also supports newer systems and compilers!

     
    • Chris Cannam

      Chris Cannam - 2018-08-31

      It does? Trusty (14.04) is the most recent listed at https://docs.travis-ci.com/user/reference/overview/.

      The gcc-4.8 found in 14.04 definitely doesn't support the C++14 features needed by Cap'n Proto 0.7. I did experiment with installing a newer compiler from the Ubuntu compilers PPA; this works, although it also requires a newer Qt/qmake than the default for 14.04, which doesn't know about the c++14 config option yet.

      However, the real show-stopper is that I actually want to target the 14.04 and CentOS 7 era of distros as the baseline for my current AppImage builds. If I build with gcc-4.9, even on 14.04, I then get ABI version mismatches when running on CentOS 7. (I know not many people want to run SV on CentOS, but I'm treating it as the Red Hat equivalent of 14.04 LTS for a compatibility check.) Therefore, I need to retain the ability to compile as C++11.

      What I ended up doing was to add a test in configure for whether gcc (if that is what you are using) is recent enough to recognise -std=c++14. If it is, then C++14 is emitted as the config default. If it isn't, then configure assumes you will just have to use an older version of Cap'n Proto, and builds as C++11. So the AppImage and Travis builds continue to do the latter, but the default on most machines is the former.

      This will still break if you happen to be using a C++14-capable compiler with a version of Qt that is too old to recognise the necessary qmake config flag for C++14. I'm not sure whether that is a common enough case to be worth checking for.

       
  • David Runge

    David Runge - 2018-08-31

    Oh, you're right. 14.04 still seems to be their latest (sadly).
    Hm, would probably be great to be able to test against c++14 and making this more easily accessible.

    I have latest Qt5 (5.11.1) and gcc 8.2 (what's in Arch Linux' official repositories atm), so this should've been picked up as c++14 all along? It seems not all of the subprojects and parts are actually really configured to re-use it properly though (without sed'ing that into all the files - or at least the piper-cpp stuff - it won't build).

     
  • David Runge

    David Runge - 2020-04-24

    This ticket can be closed. sonic-visualiser 4.0.1 builds both against capnproto 0.7.0 and 0.8.0

     

Log in to post a comment.