Inkscape does not build with -std=c++11 flag

Bug #1122364 reported by Samuel Chase on 2013-02-11
This bug report is a duplicate of:  Bug #858814: c++11 build fixes. Edit Remove
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Samuel Chase

Bug Description

A few, minor pieces of code prevent Inkscape from being built.

Samuel Chase (samebchase) wrote :
Alex Valavanis (valavanisalex) wrote :

I guess we'd need to add a conditional build for this to make sure that earlier C++ standards are still supported... as far as I know, the "constexpr" modifier is only in the new spec

tags: added: build
Samuel Chase (samebchase) wrote :

g++ has been supporting several C++ features, for a while now.

People with earlier versions of g++ on might have problems building if their older version of the compiler does not support features that have been added in the later versions.

I would like to know from approximately when will it be "alright" to start using the newer features in Inkscape code? I think the question is a matter of what version of g++ a person is expected to have.

For example in sp-guide.cpp,

 for (std::list<std::pair<Geom::Point, Geom::Point> >::iterator i = pts.begin(); i != pts.end(); ++i) {
        SPGuide::createSPGuide(doc, (*i).first, (*i).second);

could be rewritten as:

for (auto i: pts) {
     SPGuide::createSPGuide(doc, i.first, i.second);

There are other such instances of code that could be made a bit more readable.

The other (more realistic) alternative would probably be to wait till all these things stabilise some more before these new features are used. I think people trying to build C++11 code with older versions of g++ could possibly run into build/runtime issues.

jazzynico (jazzynico) on 2013-02-12
Changed in inkscape:
assignee: nobody → Samuel Chase (samebchase)
importance: Undecided → Low
status: New → In Progress
su_v (suv-lp) wrote :

> I think the question is a matter of what version of g++ a person
> is expected to have.

If you don't want to exclude Inkscape from being built on OS X: Apple's latest version of GCC provided with Xcode is 4.2.1 (Apple cannot provide newer versions of GCC due to licensing changes of GCC).

This matters at least as long as Inkscape cannot be compiled with clang (see bug #992124) - using a custom built newer version of GCC for inkscape builds on OS X is unfortunately not a solution (due to hard-to-avoid ABI incompatibilities with other libraries compiled with the system compiler, those builds are unstable and tend to crash randomly).

Alex Valavanis (valavanisalex) wrote :

Marking as duplicate of #858814.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers