openlvc / portico

Portico is an open source, cross-platform, fully supported HLA RTI implementation. Designed with modularity and flexibility in mind, Portico is a production-grade RTI for the Simulation and Training Community, so come say hi!
http://www.porticoproject.org
151 stars 81 forks source link

Example C++ 1516e Federate crashes on 64-bit Ubuntu 16.04 #290

Open michaelrfraser opened 5 years ago

michaelrfraser commented 5 years ago

I have successfully created a sandbox from the repository under 64-bit Ubuntu 16.04 (Xenial Xerus). I am able to compile the example application in examples/cpp/ieee1516e using the provided linux64.sh shell script.

However when I attempt to run the example, I get a seg fault, with the stack trace pointing somewhere in the std::string constructor (called from createFederationExecution).

michaelrfraser commented 5 years ago

Problem appears to be that librti1516e is being compiled via ant/cpptask with the flag _GLIBCXX_USE_CXX11_ABI=0 under linux. However the example script does not specify the flag, and therefore the rti lib and the example federate are expecting different versions of string, and are accessing memory that they don't have permission to.

The _GLIBCXX_USE_CXX11_ABI=0 advises gcc to generate code that is compatible with older versions of stdlibc++ (gcc4 and below).

Comments within the ant profile for 64-bit linux ieee1516e advise that the flag was added for compatibility with the existing cppunit library. Conversely it means headaches for people developing on newer linux distros that use gcc5, as the compiler flag must be specified on all compilation units that consume the library.

As such I'd recommend removing the _GLIBCXX_USE_CXX11_ABI=0 flag and deprecating support for older linux distributions. The flag can be reinstated easily enough by modifying codebase/profiles/linux/ieee1516e,xml and adding the flag back in. Note: if we follow this route we will need to replace the cppunit lib included in the distro with one compiled against gcc5.

The other option is to create two distributions, one for gcc4, and one for gcc5 - however that's probably more maintenance burden than I think anyone is prepared to take on at the moment.

michaelrfraser commented 5 years ago

Fixed in https://github.com/openlvc/portico/pull/291.

Submitted PR and awaiting review.

michaelrfraser commented 5 years ago

@timpokorny Travis fails to compile the branch now due to linker errors with the newer stdlibc++, is it configured to use an older version of linux itself? Can we update it to use a more recent version of Ubuntu?

Edit: Just checked the travis logs and its running on 14.04 (gcc 4.8.4). WIll look into updating this if its ok with you.

michaelrfraser commented 5 years ago

Updated Travis to use 16.04. however now it is complaining that Java 8 isn't supported under that platform. WIll need to get @timpokorny's feedback on this. Potentially need to move to Java 9+.