[SOLVED] Error compiling 0.4.7 - Linux

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Error compiling 0.4.7 - Linux

#16 Post by Dilvish »

mandarina wrote:I'm using Ubuntu Gnome, it is Ubuntu but with Gnome instead of Unity.

Code: Select all

$ nm  -DC /usr/lib/x86_64-linux-gnu/libboost_log.so | grep   text_file_backend::consume
000000000007ed80 T boost::log::v2_mt_posix::sinks::text_file_backend::consume(boost::log::v2_mt_posix::record_view const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
That's pretty interesting to me, because it's the same result I have, but it works fine for my compile/linker whereas your compiler/linker appears to be insisting on having the last parameter as a plain std::string const& instead of accepting the c++11 version. What versions of gcc and ld are you using? Mine are

Code: Select all

$gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Code: Select all

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.26.1
Perhaps you need to upgrade your gcc or set a compiler flag (either via ccmake as discussed above or as discussed in this thread)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

mandarina
Space Krill
Posts: 9
Joined: Thu Aug 10, 2017 1:06 pm

Re: Error compiling 0.4.7 - Linux

#17 Post by mandarina »

Hello,

Code: Select all

$ gcc --version
gcc (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4

Code: Select all

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.26.1
I tried compiling with the flag "--std=c++0x" but problem persists :(

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Error compiling 0.4.7 - Linux

#18 Post by Dilvish »

mandarina wrote:

Code: Select all

$ gcc --version
gcc (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4
Although the gnu.org docs state that gcc began "fully supporting" c++11 beginning with gcc 4.8.1, it is not until gcc 5.1 that they cite libstdc++ as having full support for c++11. It looks to me like the current version of gcc for Ubuntu 16.04 is >= 5.3.1, so could you update gcc (and probably best all the packages needed by FO) and then try compiling again? (and perhaps double check that you don't for some reason have 'gcc' aliased to an older version, perhaps try running 'gcc-5 --version' to see if you already have a newer gcc installed?)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

mandarina
Space Krill
Posts: 9
Joined: Thu Aug 10, 2017 1:06 pm

Re: Error compiling 0.4.7 - Linux

#19 Post by mandarina »

Hello, it seems I already have 5.4 :shock:

Code: Select all

$ gcc-5 --version
gcc-5 (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Error compiling 0.4.7 - Linux

#20 Post by Dilvish »

OK well I think we have probably more clearly identified the source of your problem, though I'm still not sure about the full scope of it or just the best way to fix it. if you run

Code: Select all

ls -l /usr/bin/gcc*
I expect that it will probably show that your gcc command is symlinked to the older gcc version, and it could be that the fix might be as simple as

Code: Select all

sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
But it also seems conceivable that some of your libraries might be symlinked to older versions also, if you don't know of any particular reason to keep the old gcc on your system it might be that the best approach would be to go into your package-manager/software-center (or just use apt) and uninstall the older gcc and then reinstall/repair the newer gcc. But I really don't know.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

mandarina
Space Krill
Posts: 9
Joined: Thu Aug 10, 2017 1:06 pm

Re: Error compiling 0.4.7 - Linux

#21 Post by mandarina »

Hello,

Before:

Code: Select all

$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root     21 ago  1 22:17 /usr/bin/gcc -> /etc/alternatives/gcc
-rwxr-xr-x 1 root root 838008 sep  5  2016 /usr/bin/gcc-4.9
-rwxr-xr-x 1 root root 915736 sep  4  2016 /usr/bin/gcc-5

$ ls -l /usr/bin/g++*
lrwxrwxrwx 1 root root     21 ago  1 22:17 /usr/bin/g++ -> /etc/alternatives/g++
-rwxr-xr-x 1 root root 842104 sep  5  2016 /usr/bin/g++-4.9
-rwxr-xr-x 1 root root 919832 sep  4  2016 /usr/bin/g++-5
After:

Code: Select all

$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root     14 ago 19 12:49 /usr/bin/gcc -> /usr/bin/gcc-5
-rwxr-xr-x 1 root root 838008 sep  5  2016 /usr/bin/gcc-4.9
-rwxr-xr-x 1 root root 915736 sep  4  2016 /usr/bin/gcc-5

$ ls -l /usr/bin/g++*
lrwxrwxrwx 1 root root     14 ago 19 12:52 /usr/bin/g++ -> /usr/bin/g++-5
-rwxr-xr-x 1 root root 842104 sep  5  2016 /usr/bin/g++-4.9
-rwxr-xr-x 1 root root 919832 sep  4  2016 /usr/bin/g++-5
And..... PROBLEM SOLVED!!!!

Thank you very much!!!!

Post Reply