16 fpe code doesn t work on mac - #68
Conversation
Added function to cml_unit_sim.mk so that the -Wno-nonnull-compare only gets added to TRICK_C/XXFLAGS in a Linux environment as the compile flag is not compatible with Clang Fixed overloading and fpe compile errors for SIM_Test_table. Using SIM_Test_table as the test case to get Mac working with CML. Currently seeing SWIG error where SWIG is attempting to access private things within a class. Refs #16
…D=1 on Mac Also includes #ifdef SWIG fix for swig attempting to access private class information Refs #16
|
This is a few commits behind so go ahead and rebase or merge main into this branch first. |
| ExtendedPlanetaryDerivedState(); | ||
| ~ExtendedPlanetaryDerivedState() override = default; | ||
|
|
||
| using SubscriptionBase::initialize; |
There was a problem hiding this comment.
Quick note about these before you go too far down this rabbit hole: this is downstream from #27. We're better off ignoring the warning generated by overloading virtual functions for now with (off the top of my head) -Wno-error=overloaded-virtual, we don't want to make this change. This doesn't trip up on Linux for now because -Woverloaded-virtual isn't included in -Wall in GCC 8.5, but it is in newer GCCs.
The reason we don't want to make this change is because that SubscriptionBase::initialize function is intended to be overridden. If we added this, users would be able to call the wrong initialize() method as opposed to the overloaded one with arguments in some of these models. There's some architectural work that needs to happen to address that warning, so it'll definitely be its own PR in the future. I think the solution will probably be something along the lines of making SubscriptionBase::initialize a method named something like initialize_subscription() and not virtual, but I haven't spent time thinking about the ramifications yet.
Branch works on Linux as well. Refs #16
| -Walloca | ||
| -Wcast-align | ||
| -Wcast-qual | ||
| -Wduplicated-branches |
There was a problem hiding this comment.
For this file I'm tempted to say let's just return at the start of the function if the compiler isn't GCC and keep the rest as it was before. Most contributions to CML currently come from people using GCC on Rocky 8 and if they can't easily reproduce mac-only warnings, that'll be difficult to deal with. Maybe we'll add mac warnings in the future though.
| # We need to know what TRICK_HOST_CPU is to find the libraries, so get that first | ||
| cmd = ( os.path.join(args.trick, 'bin/trick-gte') + " TRICK_HOST_CPU") | ||
| sys.path.append(os.path.abspath(os.path.join(args.trick, 'share/trick/trickops/'))) | ||
| from WorkflowCommon import run_subprocess | ||
| trick_host_cpu = run_subprocess(command=cmd,m_shell=True).stdout.strip().split("\n")[-1] | ||
| if "Linux" in trick_host_cpu: | ||
| trick_build_lib_dir = "lib64" | ||
| elif "Darwin" in trick_host_cpu: | ||
| trick_build_lib_dir = "lib" | ||
| if not args.trick or not os.path.exists(args.trick): | ||
| msg = ("Unable to locate trick directory. Define TRICK_HOME in your environment" | ||
| " or use --trick=/path/to/trick/ to specify a path to a pre-built Trick" | ||
| " directory (Requires version 19.5.1 or later)") | ||
| raise RuntimeError(msg) | ||
| if (not os.path.exists(os.path.join(args.trick, 'lib64')) or | ||
| not os.listdir(os.path.join(args.trick,'lib64'))): | ||
| if (not os.path.exists(os.path.join(args.trick, trick_build_lib_dir)) or | ||
| not os.listdir(os.path.join(args.trick, trick_build_lib_dir))): |
There was a problem hiding this comment.
Let's just remove this entire section that checks if Trick exists. It'll be immediately obvious if it doesn't when you run the script regardless, there's no need to maintain extra code to check for it.
| TRICK_LDFLAGS += -L${CML_LIBRARY_DIR} | ||
| ifeq (1, $(CML_USE_STATIC_LIB)) | ||
| TRICK_LDFLAGS += -l:libcml.a | ||
| else ifeq ($(findstring Darwin,$(trick-gte TRICK_HOST_CPU)),) |
There was a problem hiding this comment.
Could probably just make this a direct comparison with Darwin using trick-gte TRICK_HOST_TYPE instead.
| TRICK_CFLAGS += -g -I. -Wall -Wextra -Werror -Wno-implicit-fallthrough -Wno-format-truncation -Wno-int-in-bool-context -Wno-address | ||
| TRICK_CXXFLAGS += -g -I. -Wall -Wextra -Werror -Wno-implicit-fallthrough -Wno-format-truncation -Wno-int-in-bool-context -Wno-address |
There was a problem hiding this comment.
These should have already been removed in this file along with the Wno-nonnul-compare. l I think this branch is a bit behind. Try rebasing or merging main and reverting the changes to this file first. We can probably essentially get rid of every change in here.
| RangeComputation(const jeod::PlanetFixedPosition & state_in); | ||
| ~RangeComputation() override = default; | ||
|
|
||
| using SubscriptionBase::initialize; |
There was a problem hiding this comment.
These all still need to be removed.
| #ifdef SWIG | ||
| %immutable; | ||
| #endif |
There was a problem hiding this comment.
I added these in the Rocky 9 compatibility branch which was just merged. Go ahead and revert the ones on this branch and see if the ones I added are enough to get builds on mac working.
| // and the inverse of the decomposed matrix is arithmetically simple to | ||
| // compute. | ||
| double C_inv[dimension][dimension] = {0}; | ||
| double C_inv[dimension][dimension] = {{0}}; |
There was a problem hiding this comment.
Can be simplified, the zero is redundant in the first place.
| double C_inv[dimension][dimension] = {{0}}; | |
| double C_inv[dimension][dimension] {}; |
| const double failed_val, | ||
| const bool failed_flag) | ||
| { | ||
| fenv_t env; |
There was a problem hiding this comment.
| fenv_t env; | |
| std::fenv_t env; |
Ditto further down in this file, we should be using the C++ std::feholdexcept and std::fesetenv.
| public: | ||
| double independent; | ||
| double dependent[11][2]; // (--) 11 tables, 2 data per table | ||
| double dependent[12][2]; // (--) 11 tables, 2 data per table |
There was a problem hiding this comment.
Don't forget to update the comment.
| double dependent[12][2]; // (--) 11 tables, 2 data per table | |
| double dependent[12][2]; // (--) 12 tables, 2 data per table |
| ifeq ($(shell pkg-config --exists libxml-2.0 && echo $$?),0) | ||
| export TRICKIFY_CXX_FLAGS += $(shell pkg-config libxml-2.0 --cflags) | ||
| endif |
There was a problem hiding this comment.
This is probably going to cause the Rocky build to fail because it won't be able to find libxml types that the headers need.
No description provided.