Unable to build (Using G++-5)

Asked by Ravi J on 2015-10-07

Just installed Debian Stretch - and build-essentials. I have gcc version 5.2.1 20150911 (Debian 5.2.1-17).
The build fails. Anything I should do or any settings I must set?
I know this question is slightly outside of grub-customizer, but pls help. Thanks in advance.
Ravi J

Question information

Language:
English Edit question
Status:
Solved
For:
Grub Customizer Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Richter
Solved:
2015-10-09
Last query:
2015-10-09
Last reply:
2015-10-09
Ravi J (ravijoshi2002) said : #1

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

I wonder that there's a problem. The c++11 flag is set inside of my CMakeLists.txt and for me it always worked this way.

Are you building with cmake or my buildscript?

Alternatively you can download the old version not based on c++11 here: https://launchpad.net/grub-customizer/+download

Ravi J (ravijoshi2002) said : #3

Hi Daniel,
- I am building with cmake + make. I don't see any reference to (or don't know how to find) setting compiler in CMakeLists.txt.
- I haven't used your buildscript. ( I didn't know it existed. Need to find where).
- I tried using the link to old as well. Won't compile. ( have only 5 Don't have 4.9 or earlier).

Thanks. As always, any help is very much appreciated. And, also thanks for this great piece of software. Without it, I would be struggling to re-arrange display order.

Regards,
Ravi J

Ravi J (ravijoshi2002) said : #4

(The link you've sent seems to be to the latest version, not old). Thx.

Ok, I tried with your debian version and found the problem.

While the current release of grub customizer isn't using C++11 features, gtkmm-3.0 actually does.

This was different when I developed this version so it was not required to declare the requirement of C++11 and it compiled without problems. Generally this it's not a good programming style of a library to change things like this without a new major releaseā€¦

However the fix is simple. You just have to add this line to the CMakeLists.txt before compiling:
ADD_DEFINITIONS(-std=c++11)

You'll get some warnings when compiling cause there are old parts of gtkmm that are still using features which are deprecated since C++11 (second time I have to say: WTF).

I thought you used the version from vcs cause of the C++11 problems (this version uses C++11 itself).

About the buildscript: it's just for internal use (I use it to build packages and to deploy them to the PPA) but I didn't know whether you used it.

Ravi J (ravijoshi2002) said : #6

Thanks Daniel. I am able to compile now. But the linker is failing. Should I do something?

any error message?

Ravi J (ravijoshi2002) said : #8

grub-customizer-4.0.6]$ make
[ 1%] Linking CXX executable grub-customizer
CMakeFiles/grub-customizer.dir/src/View/Gtk/Element/PartitionChooser.cpp.o: In function `View_Gtk_Element_PartitionChooser::load()':
PartitionChooser.cpp:(.text+0x5cf): undefined reference to `Glib::ustring::ustring(std::string const&)'

Hmm I didn't got this problem.

Did you install the whole package libgtkmm-3.0-dev as stated here: https://answers.launchpad.net/grub-customizer/+faq/1397?

Please make sure all dependencies are installed and then do a clean compile (delete the directory and unpack the tar.gz again).

Ravi J (ravijoshi2002) said : #10

Yes, I am using newest version of libgtkmm-3.0-dev. (and typically recreate grub-cust folder each time)
I am using gcc/g++ version 4.8 (compilation fails for 5.2.1).
I am not sure which linker I am using. Could you tell how to find it, and may be point to right version of linker as well? Thanks !!!

Ravi J (ravijoshi2002) said : #11

Please ignore my just above comment about compilation failing with 5.2.1. It passes.

Ravi J (ravijoshi2002) said : #12

It's finally building. Excellent. I wasn't sure it would link earlier. But it does now.
Thanks Daniel. Appreciate all your help.

Ravi J (ravijoshi2002) said : #13

Thanks Daniel Richter, that solved my question.