Compile error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile error

Effad
I have just tried to compile LibreCAD on a LinuxCNC installation, which is based on the (admittedly rather old) Ubuntu 10.04 LTS distribution.
I have found the hint in common.pri about custom.pro containing CXX_CPP11_FLAG, but the compilation still fails.

Here is what I did:
rli@cncsim:~/devel$ git clone https://github.com/LibreCAD/LibreCAD.git
Initialized empty Git repository in /home/rli/devel/LibreCAD/.git/
remote: Reusing existing pack: 28199, done.
remote: Total 28199 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (28199/28199), 54.27 MiB | 3.60 MiB/s, done.
Resolving deltas: 100% (21610/21610), done.
rli@cncsim:~/devel$ cd LibreCAD/
rli@cncsim:~/devel/LibreCAD$ echo "CXX_CPP11_FLAG = -std=c++0x" > custom.pro
rli@cncsim:~/devel/LibreCAD$ qmake librecad.pro 
rli@cncsim:~/devel/LibreCAD$ make
cd libraries/ && /usr/bin/qmake /home/rli/devel/LibreCAD/libraries/libraries.pro -unix -o Makefile
cd libraries/ && make -f Makefile 
make[1]: Betrete Verzeichnis '/home/rli/devel/LibreCAD/libraries'
...
g++ -c -pipe -std=c++0x -g -O2 -Wall -W -D_REENTRANT -I/usr/include/muParser -DQC_APPKEY="/LibreCAD" -DQC_APPNAME="LibreCAD" -DQC_COMPANYNAME="LibreCAD" -DQC_COMPANYKEY="LibreCAD" -DQC_VERSION="master" -DQC_DELAYED_SPLASH_SCREEN=1 -DHAS_BOOST=1 -DQC_SCMREVISION="2.0.2-24-ga25e73a" -DQC_APPDIR="librecad" -DQINITIMAGES_LIBRECAD=qInitImages_librecad -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I/usr/include/qt4/QtHelp -I/usr/include -I../../libraries/libdxfrw/src -I../../libraries/jwwlib/src -Icmd -Ilib/actions -Ilib/creation -Ilib/debug -Ilib/engine -Ilib/fileio -Ilib/filters -Ilib/gui -Ilib/information -Ilib/math -Ilib/modification -Ilib/scripting -Iactions -Imain -Iplugins -Iui -Iui/forms -I../res -I../../generated/librecad/moc -I../../generated/librecad/ui -o ../../generated/librecad/obj/rs_entitycontainer.o lib/engine/rs_entitycontainer.cpp
lib/engine/rs_entitycontainer.cpp: In member function ‘virtual void RS_EntityContainer::draw(RS_Painter*, RS_GraphicView*, double&)’:
lib/engine/rs_entitycontainer.cpp:1892: error: expected primary-expression before ‘[’ token
lib/engine/rs_entitycontainer.cpp:1892: error: expected primary-expression before ‘]’ token
lib/engine/rs_entitycontainer.cpp:1892: error: expected primary-expression before ‘const’
lib/engine/rs_entitycontainer.cpp:1892: error: expected primary-expression before ‘const’
lib/engine/rs_entitycontainer.cpp:1892: error: expected unqualified-id before ‘bool’
lib/engine/rs_entitycontainer.cpp:1904: error: expected initializer before ‘:’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected primary-expression before ‘}’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected ‘;’ before ‘}’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected primary-expression before ‘}’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected ‘)’ before ‘}’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected primary-expression before ‘}’ token
lib/engine/rs_entitycontainer.cpp:1907: error: expected ‘;’ before ‘}’ token
make[2]: *** [../../generated/librecad/obj/rs_entitycontainer.o] Fehler 1
make[2]: Verlasse Verzeichnis '/home/rli/devel/LibreCAD/librecad/src'
make[1]: *** [sub-src-make_default] Fehler 2
make[1]: Verlasse Verzeichnis '/home/rli/devel/LibreCAD/librecad'
make: *** [sub-librecad-make_default-ordered] Fehler 2
rli@cncsim:~/devel/LibreCAD$ 

I don't know if this is a specific C++11 syntax issue or if the compilation fails on more modern platforms too.

Best regards,
Robert
Reply | Threaded
Open this post in threaded view
|

Re: Compile error

dxli
your gcc version is too old.

you need gcc-4.7 or later
Reply | Threaded
Open this post in threaded view
|

Re: Compile error

LordOfBikes
Administrator
In reply to this post by Effad
I have build sucessfully with Ubuntu 12.04, gcc 4.6, with latest source. Therefore I added the CXX_CPP11_FLAG variable.

The error is caused by the use of [] lambda function in line 1892. This is supported since gcc 4.5 and c++0x compiler switch.

But I can't guarantee, that no other errors will arise with gcc 4.5.

Regards

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Compile error

dxli
Yes, looks like lambda is supported gcc-4.5 and up.

is it this compiler error due to "-std=c++11" being ignored by gcc <= 4.6?

LordOfBikes wrote
I have build sucessfully with Ubuntu 12.04, gcc 4.6, with latest source. Therefore I added the CXX_CPP11_FLAG variable.

The error is caused by the use of [] lambda function in line 1892. This is supported since gcc 4.5 and c++0x compiler switch.

But I can't guarantee, that no other errors will arise with gcc 4.5.

Regards

Armin
Reply | Threaded
Open this post in threaded view
|

Re: Compile error

LordOfBikes
Administrator
Yes, -std=c++11 was added with gcc 4.7, earlier versions fail with this switch.
Because the actual Ubuntu 12.04LTS still use gcc 4.6, I did the custom.pro hack to replace it with -std=c++0x.
I tried to use both switches, trusting the unknown switch is ignored by gcc, but with that combination all gcc versions failed. I've checked this with gcc 4.6 and 4.8.

Regards

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Compile error

LordOfBikes
Administrator
In reply to this post by dxli
Sorry, reading your question the 2nd time, I understood it .

The compiler error isn't because of -std=c++11, Robert figured out how to set the correct -std=c++0x switch.
But the gcc version on Ubuntu 10.04LTS is 4.1, which is definitely too old for LC code.

Regards

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution