nasa / trick

Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Other
26 stars 14 forks source link

Support RHEL8 on PowerPC architecture #1700

Open alexlin0 opened 2 months ago

alexlin0 commented 2 months ago

Found this in a round-about way. I was trying to compile Trick on a PowerPC machine running Redhat 8. Could not compile Trick. I found that sections of code with "#if linux" were not getting included. I found that linux was used on my machine instead. But while experimenting I found that linux is defined if we don't use the --std=c++11 argument. It's been years since this was added. The default version of g++ 8 (the default version that comes with RHEL8) is now c++14. Removing this argument throughout Trick makefiles will compile Trick code to a more recent c++ standard and fixes my build.

alexlin0 commented 2 months ago

Nope, can't do it. Found a couple of lines on some machines that still require the use of --std=c++11. Changing the title to my underlying purpose, support RHEL 8 on PowerPC.

Accomplish this by changing linux to linux __ in preprocessor statements.

dandexter commented 2 months ago

I know you are trying to get Trick to compile on RHEL 8 on PowerPC, but what about emulations that need to be compiled with -std=c++11? Would there be any problem with the Trick executive and supporting trick code that gets added to the simulation when the sim is compiled with -std=c++11? If you find a way that support c++11 that does not depend on __linux then perhaps this is not even a problem.

alexlin0 commented 2 months ago

I thought I read that the default compiler versions on RHEL and Mac were already supporting c++ 14 or newer by default. I thought that removing c++11 would work without issues. I was wrong. Somewhere there is still a dependency. I reverted that change and am trying a different way.

dandexter commented 2 months ago

The issue I'm thinking of is IEEE 1516-2010 uses deprecated APIs and that causes compile problems for c++14 and I have to set -std=c++11 for RHEL 8 or newer. I just wanted to share that some users may have to use c++ 11 to compile simulations and I wanted to make sure there would not be any issues for any fix you come up with.

alexlin0 commented 2 months ago

Do you have a plan to change the code relying on deprecated APIs? Eventually Trick should not specify which c++ version to use to compile, it could conflict with what the user wants. The user should always have the capability to specify the c++ standard in TRICK_CPPFLAGS.

dandexter commented 2 months ago

The IEEE 1516-2010 provides APIs and libraries that are targeted to the c++ 11 standard. The next version of the HLA standard (i.e. HLA 4) is going through balloting right now but it is my understanding that the APIs and libraries will also be c++ 11. So no we can't change the deprecated APIs and it will be that way for the foreseeable future.

dandexter commented 2 months ago

I think it will be okay for Trick to be compiled without specifying a C++ standard, but when we compile the simulation we do.