-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for compilation on Mac / Darwin #2450
Conversation
Included in C++11, marked deprecated in Clang compiler on Darwin (Apple clang version 12.0.0)
ncxx4 not using `appending` variable
https://en.cppreference.com/w/cpp/numeric/complex/abs It appears that std::fabs may have an implementation for complex, but this is implementation specific. std::abs is in the standard.
Incomplete type causes trouble for constexpr values when compiled with Apple Clang (12.0.0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/fileio/impls/netcdf4/ncxx4.cxx
Outdated
@@ -802,7 +802,7 @@ bool Ncxx4::write(BoutReal *data, const char *name, int lx, int ly, int lz) { | |||
} | |||
|
|||
for(int i=0;i<lx*ly*lz;i++) { | |||
if(!finite(data[i])) | |||
if(!std::isfinite(data[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
if(!std::isfinite(data[i]))
^
{
src/fileio/impls/netcdf4/ncxx4.cxx
Outdated
@@ -853,7 +853,7 @@ bool Ncxx4::write_perp(BoutReal *data, const std::string& name, int lx, int lz) | |||
} | |||
|
|||
for(int i=0;i<lx*lz;i++) { | |||
if(!finite(data[i])) | |||
if(!std::isfinite(data[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
if(!std::isfinite(data[i]))
^
{
src/fileio/impls/netcdf4/ncxx4.cxx
Outdated
@@ -1120,7 +1120,7 @@ bool Ncxx4::write_rec(BoutReal *data, const char *name, int lx, int ly, int lz) | |||
} | |||
|
|||
for(int i=0;i<lx*ly*lz;i++) { | |||
if(!finite(data[i])) | |||
if(!std::isfinite(data[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
if(!std::isfinite(data[i]))
^
{
src/fileio/impls/netcdf4/ncxx4.cxx
Outdated
@@ -1188,7 +1188,7 @@ bool Ncxx4::write_rec_perp(BoutReal *data, const std::string& name, int lx, int | |||
} | |||
|
|||
for(int i=0;i<lx*lz;i++) { | |||
if(!finite(data[i])) | |||
if(!std::isfinite(data[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: statement should be inside braces [readability-braces-around-statements]
if(!std::isfinite(data[i]))
^
{
I think probably |
For reasons I don't understand, this fails on Apple Clang 12. Tried both -std=c++14 and -std=c++17. Replacing with an insertion works.
Debugging hint (VERBOSE=1), and cmake settings for compilation.
Debugging hint (VERBOSE=1), and cmake settings for compilation.
which are being issued by adding `VERBOSE=1` to the make command i.e. in the build | ||
directory running:: | ||
|
||
$ make VERBOSE=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmake --build . -v
does work as well
…nto next-darwin-fixes
Some progress: The link command ends with
That last |
Braces on conditionals, some spacing
Thanks to @dschworer, cmake -v flag for additional debugging information
Pretty sure it's coming from FindLibuuid.cmake: BOUT-dev/cmake/FindLibuuid.cmake Lines 31 to 43 in 26d8341
It looks like importing Mac frameworks is a complicated business:
Easiest fix is to just delete that whole bit -- not having a system UUID generator is not a massive loss, we have a fallback solution anyway. Some general points on debugging CMake files: |
Modifying instructions, tested on Darwin cmake . -B build -DBOUT_ENABLE_BACKTRACE=Off -DBUILD_SHARED_LIBS=Off -DBOUT_USE_NLS=Off -DBOUT_USE_UUID_SYSTEM_GENERATOR=Off cd build make [skip ci]
Thanks @ZedThree that worked! I've updated the documentation rather than modify the CMakelists.txt file |
Compiling with Apple Clang 12.0.0 on MacOS.
Compile flags to disable components which currently don't compile and/or link on MacOS have been put in the manual:
Clang has found another possible bug: