Skip to content
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

Issue building with clang on macOS 11.3 #109

Closed
mathomp4 opened this issue May 3, 2021 · 3 comments · Fixed by #112
Closed

Issue building with clang on macOS 11.3 #109

mathomp4 opened this issue May 3, 2021 · 3 comments · Fixed by #112

Comments

@mathomp4
Copy link

mathomp4 commented May 3, 2021

All,

I seem to be having an issue compiling netcdf-cxx4 and it seems to be due to my upgrading my (work) laptop from Catalina to Big Sur. Before the upgrade, netcdf-cxx4 was happy with clang but now it's not.

To wit, my OS is macOS 11.3, the compiler is clang++ (or, rather, mpic++ as I built HDF5 for parallel) from XCode 12.5:

mpic++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and the issue is that when I try and build the library I get errors. I'm putting the output below, but note that this is built inside a set of libraries I maintain for a climate model, so the GNU make that's called that eventually calls the make in netcdf-cxx4 is not pretty, but it works. To wit:

...
Installing netcdf-cxx4 
make[2]: Entering directory '/Users/mathomp4/Baselibs/ESMA-Baselibs-6.2.1/src/netcdf-cxx4/build'
Making install in cxx4
make[3]: Entering directory '/Users/mathomp4/Baselibs/ESMA-Baselibs-6.2.1/src/netcdf-cxx4/build/cxx4'
depbase=`echo ncAtt.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../libtool  --tag=CXX   --mode=compile mpic++ -DHAVE_CONFIG_H -I. -I../../cxx4 -I..   -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/netcdf  -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/zlib    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/szlib    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/jpeg    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/hdf5    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/hdf    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/netcdf    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/udunits2    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/gsl    -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/antlr2    -fPIC -MT ncAtt.lo -MD -MP -MF $depbase.Tpo -c -o ncAtt.lo ../../cxx4/ncAtt.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  mpic++ -DHAVE_CONFIG_H -I. -I../../cxx4 -I.. -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/netcdf -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/ -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/zlib -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/szlib -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/jpeg -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/hdf5 -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/hdf -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/netcdf -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/udunits2 -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/gsl -I/Users/mathomp4/installed/MPI/nag-7.0_7045/openmpi-4.1.1/Baselibs/6.2.1/Darwin/include/antlr2 -fPIC -MT ncAtt.lo -MD -MP -MF .deps/ncAtt.Tpo -c ../../cxx4/ncAtt.cpp -o ncAtt.o
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:639:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/initializer_list:46:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:639:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/initializer_list:46:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
      ~~^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:418:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:642:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:205:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:668:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/typeinfo:60:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:83:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:671:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/new:93:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
In file included from ../../cxx4/ncAtt.cpp:1:
In file included from ../../cxx4/ncAtt.h:1:
In file included from ../../cxx4/ncType.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:673:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:121:
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [Makefile:852: ncAtt.lo] Error 1
make[3]: Leaving directory '/Users/mathomp4/Baselibs/ESMA-Baselibs-6.2.1/src/netcdf-cxx4/build/cxx4'
make[2]: *** [Makefile:543: install-recursive] Error 1
make[2]: Leaving directory '/Users/mathomp4/Baselibs/ESMA-Baselibs-6.2.1/src/netcdf-cxx4/build'
make[1]: *** [GNUmakefile:887: netcdf-cxx4.install] Error 2
make[1]: Leaving directory '/Users/mathomp4/Baselibs/ESMA-Baselibs-6.2.1/src'
make: *** [GNUmakefile:393: install] Error 2
@aerorahul
Copy link

@mathomp4 See #111 for a possible solution.
I should have checked with you.

@mathomp4
Copy link
Author

mathomp4 commented Jun 3, 2021

@mathomp4 See #111 for a possible solution.
I should have checked with you.

@aerorahul Ooh. Thanks! You were better than my current "workaround": Don't build netcdf-cxx4 if macOS. 😄 (I have the luxury that I only build the C++ interface because it's essentially free, but not required by GEOS. Yet.)

@WardF
Copy link
Member

WardF commented Jun 3, 2021

Thanks, and now that this is on my radar I'll get it merged in before other things bubble back to the top. We'll be minting fresh Fortran and C++ releases shortly, so now is a good time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants