Installing LROSE on MacOS Catalina

I recently found a hack to make LROSE work on MacOS Catalina. So, I just thought of posting it here in case it helps others. I haven’t tried it for MacOS Big Sur or MacOS Monterey but it may as well work on those too.

The problem: While trying to install the latest LROSE release (at the time of writing this post), I was getting the following error message:

==> Downloading https://github.com/NCAR/lrose-core/releases/download/lrose-core-20210524/lrose-core-20210524.s
Already downloaded: /Users/ms/Library/Caches/Homebrew/downloads/596cd8f5869dd818fdd0524322d0b020c0dec5520f95175deed1e6cdd65dba5e--lrose-core-20210524.src.tgz
==> cmake ..
==> make -j 8 install
==> make -j 8 install
==> make -j 8 install
Last 15 lines from /Users/ms/Library/Logs/Homebrew/lrose-core/04.make:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:327:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:328:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
[  1%] Building CXX object libs/Mdv/src/CMakeFiles/Mdv.dir/DsMdvx/msg_assemble.cc.o
13 errors generated.
make[2]: *** [libs/Mdv/src/CMakeFiles/Mdv.dir/ClimoStatCalc/StdDevStatCalc.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [libs/Mdv/src/CMakeFiles/Mdv.dir/all] Error 2
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

Traceback (most recent call last):
	28: from /usr/local/Homebrew/Library/Homebrew/build.rb:229:in `<main>'
	27: from /usr/local/Homebrew/Library/Homebrew/build.rb:133:in `install'
	26: from /usr/local/Homebrew/Library/Homebrew/utils.rb:550:in `with_env'
	25: from /usr/local/Homebrew/Library/Homebrew/build.rb:138:in `block in install'
	24: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1274:in `brew'
	23: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2394:in `stage'
	22: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/forwardable.rb:230:in `stage'
	21: from /usr/local/Homebrew/Library/Homebrew/resource.rb:91:in `stage'
	20: from /usr/local/Homebrew/Library/Homebrew/resource.rb:116:in `unpack'
	19: from /usr/local/Homebrew/Library/Homebrew/resource.rb:199:in `mktemp'
	18: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `run'
	17: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `chdir'
	16: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `block in run'
	15: from /usr/local/Homebrew/Library/Homebrew/resource.rb:117:in `block in unpack'
	14: from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:102:in `stage'
	13: from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:115:in `chdir'
	12: from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:115:in `chdir'
	11: from /usr/local/Homebrew/Library/Homebrew/resource.rb:121:in `block (2 levels) in unpack'
	10: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2414:in `block in stage'
	 9: from /usr/local/Homebrew/Library/Homebrew/utils.rb:550:in `with_env'
	 8: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2415:in `block (2 levels) in stage'
	 7: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1281:in `block in brew'
	 6: from /usr/local/Homebrew/Library/Homebrew/build.rb:178:in `block (2 levels) in install'
	 5: from /Users/ms/Documents/LROSE_core_brew/lrose-core.rb:35:in `install'
	 4: from /Users/ms/Documents/LROSE_core_brew/lrose-core.rb:35:in `chdir'
	 3: from /Users/ms/Documents/LROSE_core_brew/lrose-core.rb:47:in `block in install'
	 2: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2185:in `system'
	 1: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2185:in `open'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2249:in `block in system': Failed executing: make -j 8 install (BuildError)
	5: from /usr/local/Homebrew/Library/Homebrew/brew.rb:155:in `<main>'
	4: from /usr/local/Homebrew/Library/Homebrew/brew.rb:167:in `rescue in <main>'
	3: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:509:in `dump'
	2: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:455:in `issues'
	1: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:459:in `fetch_issues'
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:60:in `issues_for_formula': undefined method `full_name' for nil:NilClass (NoMethodError)

Solution that worked for me:

Following the suggestions posted on this stackoverflow link, I edited the /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath file by

commenting out #include <math.h>
and replace it with
#include</Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h>

Then, just the usual brew install lrose-core.rb command should work fine.

Hi Milind,

Glad to hear you found a fix! Thank you for sharing here on the forum.

Regards,
Jen