Unable to Compile osgEarth 3.1 with gcc 4.8.5

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

Unable to Compile osgEarth 3.1 with gcc 4.8.5

Hello,

I'm using g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39).

It supports c++11. I can verify that by printing out the compiler features in cmake,
and the fact that I use c++11 for everything else.

I am unable to compile osgEarth 3.1.

The CXX11.cmake tells me C++11 can't be verified.

Even if I force the compile option to be -std-c++11, I still can't compile.
I get lambda function errors (Threading module line 660, for one).

Any hints on how to get around this with this compiler?

Thanks,
DC
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Compile osgEarth 3.1 with gcc 4.8.5

Not sure.
Try using the CMake module from 3.0:
https://github.com/gwaldron/osgearth/blob/3.0/CMakeModules/CXX11.cmake
Glenn Waldron / Pelican Mapping
emminizer emminizer
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Compile osgEarth 3.1 with gcc 4.8.5

In reply to this post by DC
Hello!  We use CentOS 6 for compiling osgEarth too.  4.8.5 was insufficient for us.

https://gcc.gnu.org/projects/cxx-status.html#cxx11 suggests that 4.8 fully supports C++11 but our findings on 4.8.5 were different.  We had consistent crashes on 4.8.5 and tracked it down to some header that defined the implementation, so it built, but the implementation was empty or aborted or something like that.  I don't recall the details, but it was obviously wrong looking at the system header.  I think it was something with std::thread or std::mutex but I don't recall for sure.

Our team upgraded the compiler using the devtoolkit package to gcc 8.x and everything went away.  I think the 4.8 implementation of C++11 just didn't cut it.  I believe 4.9 was OK, but I don't know for sure and we didn't do testing in that fine grained detail for what were just really old compilers.
DC DC
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Compile osgEarth 3.1 with gcc 4.8.5

Using CXX11.cmake from osgEarth 3.0 did not work either.

Even when hard-coding -std=c++11, I get multiple errors like this:

Threading:660:45: error: expected ‘,’ before ‘...’ token
             _delegate = [promise, func, args...]() mutable

Also, the osgEarth3.0 CXX11.cmake did not verify c++11. Regardless, osgEarth 3.0 still compiles.

Following the logic in CXX11.cmake file, I'm not sure how any g++ compiler version < 5.0 would pass the c++11 verification test.

As emminizer said, using g++ 8.x compiles OK. But that's not an option for us.

DC
emminizer emminizer
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Compile osgEarth 3.1 with gcc 4.8.5

DC, I found the underlying issue that we had about a year back.  See https://stackoverflow.com/questions/20326604/stdatomic-h-in-gcc-4-8 -- it was fixed in gcc 4.9 (see bug report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016).  It compiled, but would crash due to use of std::atomic.

It's unfortunate because the compiler reports that it supports C++11, but it doesn't seem to actually support the entire set, as per this bug.  It sounds like you've found another instance where C++11 isn't fully supported by gcc 4.8.

It looks like CXX11.cmake only presumes correct support of C++11 for gcc>5.  Ultimately for our team we decided that the 4.8 compiler was too buggy to keep using so we had to upgrade.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Compile osgEarth 3.1 with gcc 4.8.5

Can anyone confirm whether it builds OK under GCC 4.9? If so, I will note this in the documentation.
Glenn Waldron / Pelican Mapping