Opened 3 years ago

Last modified 3 years ago

#62678 assigned defect

netcdf 4.8.0: update fails after libstdc++ headers not found

Reported by: thiagoveloso (Thiago V. dos Santos) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc: cjones051073 (Chris Jones), smeingast (Stefan Meingast), mf2k (Frank Schima), Dave-Allured (Dave Allured), EJFielding (Eric Fielding)
Port: netcdf

Description

I have a fully working copy of netcdf v4.7.4_2 installed on my system (macOS 11.2) with the following command:

sudo port install netcdf +gcc10 +mpich +dap +netcdf4

Now, when trying to update to v4.8.0_0, I get the following error:

:info:configure -- The C compiler identification is GNU 10.3.0
:info:configure -- The CXX compiler identification is AppleClang 12.0.0.12000032
:info:configure -- Checking whether C compiler has -isysroot
:info:configure -- Checking whether C compiler has -isysroot - yes
:info:configure -- Checking whether C compiler supports OSX deployment target flag
:info:configure -- Checking whether C compiler supports OSX deployment target flag - yes
:info:configure -- Detecting C compiler ABI info
:info:configure -- Detecting C compiler ABI info - done
:info:configure -- Check for working C compiler: /opt/local/bin/gcc-mp-10 - skipped
:info:configure -- Detecting C compile features
:info:configure -- Detecting C compile features - done
:info:configure -- Detecting CXX compiler ABI info
:info:configure -- Detecting CXX compiler ABI info - failed
:info:configure -- Check for working CXX compiler: /usr/bin/clang++
:info:configure -- Check for working CXX compiler: /usr/bin/clang++ - broken
:info:configure CMake Error at /opt/local/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message):
:info:configure   The C++ compiler
:info:configure     "/usr/bin/clang++"
:info:configure   is not able to compile a simple test program.
:info:configure   It fails with the following output:
:info:configure     Change Dir: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeTmp
:info:configure
:info:configure     Run Build Command(s):/usr/bin/make cmTC_726c5/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_726c5.dir/build.make CMakeFiles/cmTC_726c5.dir/build
:info:configure     Building CXX object CMakeFiles/cmTC_726c5.dir/testCXXCompiler.cxx.o
:info:configure     /usr/bin/clang++   -pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=11.0 -o CMakeFiles/cmTC_726c5.dir/testCXXCompiler.cxx.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
:info:configure     clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
:info:configure     Linking CXX executable cmTC_726c5
:info:configure     /opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_726c5.dir/link.txt --verbose=1
:info:configure     /usr/bin/clang++ -pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=11.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  CMakeFiles/cmTC_726c5.dir/testCXXCompiler.cxx.o -o cmTC_726c5
:info:configure     clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]
:info:configure     ld: library not found for -lstdc++
:info:configure     clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:configure     make[1]: *** [cmTC_726c5] Error 1
:info:configure     make: *** [cmTC_726c5/fast] Error 2
:info:configure
:info:configure
:info:configure
:info:configure   CMake will not be able to correctly generate this project.
:info:configure Call Stack (most recent call first):
:info:configure   CMakeLists.txt:13 (project)
:info:configure -- Configuring incomplete, errors occurred!
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeOutput.log".
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeError.log".
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX='/opt/local' -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_C_COMPILER="$CC" -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/opt/local;/usr" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -Wno-dev -DCMAKE_PREFIX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0/cmake/modules -DENABLE_NETCDF_4=ON -DENABLE_DAP=ON -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=ON -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0
:info:configure Exit code: 1
:error:configure Failed to configure netcdf: configure failure: command execution failed
:debug:configure Error code: NONE
:debug:configure Backtrace: configure failure: command execution failed
:debug:configure     while executing
:debug:configure "$procedure $targetname"
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/main.log for details.

All relevant error logs attached.

Is this error related to any of my Macports configuration or should I file an issue with the netcdf developers?

Attachments (3)

main.log (19.6 KB) - added by thiagoveloso (Thiago V. dos Santos) 3 years ago.
CMakeError.log (6.6 KB) - added by thiagoveloso (Thiago V. dos Santos) 3 years ago.
CMakeOutput.log (26.1 KB) - added by thiagoveloso (Thiago V. dos Santos) 3 years ago.

Download all attachments as: .zip

Change History (25)

Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Attachment: main.log added

Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Attachment: CMakeError.log added

Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Attachment: CMakeOutput.log added

comment:1 Changed 3 years ago by mf2k (Frank Schima)

Cc: tenomoto removed
Owner: set to tenomoto
Status: newassigned

comment:2 Changed 3 years ago by kencu (Ken)

Well I think it is your MacPorts configuration...I'm not sure how you would get -stdlib=libstdc++ into your CXXFLAGS otherwise:

debug:configure CXXFLAGS='-pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

can you show us the output of this command?:

$ diff -u /opt/local/etc/macports/macports.conf.default /opt/local/etc/macports/macports.conf

comment:3 in reply to:  2 ; Changed 3 years ago by jmroot (Joshua Root)

Replying to kencu:

I'm not sure how you would get -stdlib=libstdc++ into your CXXFLAGS otherwise:

The compilers portgroup does seem to be saying libstdc++ when it means macports-libstdc++.

comment:4 in reply to:  2 Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Replying to kencu:

Well I think it is your MacPorts configuration...I'm not sure how you would get -stdlib=libstdc++ into your CXXFLAGS otherwise:

debug:configure CXXFLAGS='-pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

can you show us the output of this command?:

$ diff -u /opt/local/etc/macports/macports.conf.default /opt/local/etc/macports/macports.conf

Thanks for the comment, Ken. I did change a few configs, but certainly nothing related to compiler flags:

thiago@vcr-mac:~$ diff -u /opt/local/etc/macports/macports.conf.default /opt/local/etc/macports/macports.conf
--- /opt/local/etc/macports/macports.conf.default	2020-11-14 08:13:56.000000000 -0300
+++ /opt/local/etc/macports/macports.conf	2021-02-03 10:49:40.000000000 -0300
@@ -1,6 +1,8 @@
 # MacPorts system-wide configuration file.
 # Commented-out values are defaults unless otherwise noted.

+#macosx_deployment_target 10.16
+
 # Directory under which MacPorts should install ports. This must be
 # where MacPorts itself is installed.
 prefix              	/opt/local
@@ -44,7 +46,7 @@
 # - always: Always build from source; never try fetching archives.
 # - never: Never build from source; try fetching archives and abort if
 #   unavailable.
-#buildfromsource     	ifneeded
+buildfromsource     	ifneeded

 # Type of archive to use for port images. Supported types are cpgz,
 # cpio, tar, tbz, tbz2, tgz, tlz, txz, xar, zip.
@@ -78,7 +80,7 @@

 # Maximum size of files stored in ccache's cache. Append "G", "M", or
 # "K" for gigabytes, megabytes, or kilobytes.
-#ccache_size         	2G
+ccache_size         	500M

 # Use distcc, a distributed compiler for C, C++, Objective-C, and
 # Objective-C++. (See http://distcc.org.) The "distcc" executable must

comment:5 in reply to:  3 ; Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Replying to jmroot:

Replying to kencu:

I'm not sure how you would get -stdlib=libstdc++ into your CXXFLAGS otherwise:

The compilers portgroup does seem to be saying libstdc++ when it means macports-libstdc++.

This is so weird, I don't know where that came from. The changes in the Portfile for this package update were pretty small: https://github.com/macports/macports-ports/commit/859375d3416092492f27620dc8efae670c49caaa

comment:6 Changed 3 years ago by kencu (Ken)

does this port work at all for anyone? Or is it just your system that won't build it?

comment:7 in reply to:  5 Changed 3 years ago by jmroot (Joshua Root)

Replying to thiagoveloso:

This is so weird, I don't know where that came from. The changes in the Portfile for this package update were pretty small: https://github.com/macports/macports-ports/commit/859375d3416092492f27620dc8efae670c49caaa

This is what I was referring to: https://github.com/macports/macports-ports/blob/master/_resources/port1.0/group/compilers-1.0.tcl#L147

I don't know why it would only now start causing problems, but it seems like it should be changed to macports-libstdc++ regardless of whether it's what is causing this issue.

comment:8 Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

I can't say for sure whether this port is working well out there, but I just realized I am getting errors on both macOs machines I own.

On my iMac, I am getting the following error message:

:info:configure -- The C compiler identification is AppleClang 12.0.0.12000032
:info:configure -- The CXX compiler identification is AppleClang 12.0.0.12000032
:info:configure -- Detecting C compiler ABI info
:info:configure -- Detecting C compiler ABI info - done
:info:configure -- Check for working C compiler: /opt/local/bin/mpicc-mpich-mp - skipped
:info:configure -- Detecting C compile features
:info:configure -- Detecting C compile features - done
:info:configure -- Detecting CXX compiler ABI info
:info:configure -- Detecting CXX compiler ABI info - done
:info:configure -- Check for working CXX compiler: /usr/bin/clang++ - skipped
:info:configure -- Detecting CXX compile features
:info:configure -- Detecting CXX compile features - done
:info:configure -- Check if the system is big endian
:info:configure -- Searching 16 bit integer
:info:configure -- Looking for sys/types.h
:info:configure -- Looking for sys/types.h - found
:info:configure -- Looking for stdint.h
:info:configure -- Looking for stdint.h - found
:info:configure -- Looking for stddef.h
:info:configure -- Looking for stddef.h - found
:info:configure -- Check size of unsigned short
:info:configure -- Check size of unsigned short - done
:info:configure -- Searching 16 bit integer - Using unsigned short
:info:configure -- Check if the system is big endian - little endian
:info:configure -- Performing Test LIBTOOL_HAS_NO_UNDEFINED
:info:configure -- Performing Test LIBTOOL_HAS_NO_UNDEFINED - Failed
:info:configure -- Performing Test CC_HAS_WCONVERSION
:info:configure -- Performing Test CC_HAS_WCONVERSION - Success
:info:configure -- Performing Test CC_HAS_SHORTEN_64_32
:info:configure -- Performing Test CC_HAS_SHORTEN_64_32 - Success
:info:configure -- Found HDF5: /opt/local/lib/libhdf5.dylib;/opt/local/lib/libsz.dylib;/opt/local/lib/libz.dylib;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libdl.tbd;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd (found version "1.12.0") found components: C HL
:info:configure -- Found HDF5 libraries version 1.12.0
:info:configure -- Using HDF5 include dir: /opt/local/include
:info:configure -- Looking for pthread.h
:info:configure -- Looking for pthread.h - found
:info:configure -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
:info:configure -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
:info:configure -- Found Threads: TRUE
:info:configure -- Performing Test USE_SZIP
:info:configure -- Performing Test USE_SZIP - Success
:info:configure -- HDF5 has szip.
:info:configure -- Looking for H5Pget_fapl_mpio in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5Pget_fapl_mpio in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5Pset_all_coll_metadata_ops in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5Pset_all_coll_metadata_ops in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5free_memory in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5free_memory in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5allocate_memory in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5allocate_memory in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5resize_memory in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5resize_memory in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5Literate in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5Literate in /opt/local/lib/libhdf5.dylib - not found
:info:configure -- Performing Test HAVE_H5Literate_Macro
:info:configure -- Performing Test HAVE_H5Literate_Macro - Success
:info:configure -- Looking for H5Dread_chunk in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5Dread_chunk in /opt/local/lib/libhdf5.dylib - found
:info:configure -- Looking for H5Pset_fapl_ros3 in /opt/local/lib/libhdf5.dylib
:info:configure -- Looking for H5Pset_fapl_ros3 in /opt/local/lib/libhdf5.dylib - not found
:info:configure -- Checking for HDF5 version 1.10.6 or later: TRUE
:info:configure -- Performing Test HAVE_HDF5_ZLIB
:info:configure -- Performing Test HAVE_HDF5_ZLIB - Success
:info:configure -- Performing Test HDF5_VERSION_1106
:info:configure -- Performing Test HDF5_VERSION_1106 - Success
:info:configure -- Found CURL: /opt/local/lib/libcurl.dylib (found version "7.76.0")
:info:configure -- Performing Test HAVE_CURLOPT_USERNAME
:info:configure -- Performing Test HAVE_CURLOPT_USERNAME - Success
:info:configure -- Performing Test HAVE_CURLOPT_PASSWORD
:info:configure -- Performing Test HAVE_CURLOPT_PASSWORD - Success
:info:configure -- Performing Test HAVE_CURLOPT_KEYPASSWD
:info:configure -- Performing Test HAVE_CURLOPT_KEYPASSWD - Success
:info:configure -- Performing Test HAVE_CURLINFO_RESPONSE_CODE
:info:configure -- Performing Test HAVE_CURLINFO_RESPONSE_CODE - Success
:info:configure -- Performing Test HAVE_CURLINFO_HTTP_CONNECTCODE
:info:configure -- Performing Test HAVE_CURLINFO_HTTP_CONNECTCODE - Success
:info:configure -- Performing Test HAVE_CURLOPT_BUFFERSIZE
:info:configure -- Performing Test HAVE_CURLOPT_BUFFERSIZE - Success
:info:configure -- Performing Test HAVE_CURLOPT_KEEPALIVE
:info:configure -- Performing Test HAVE_CURLOPT_KEEPALIVE - Success
:info:configure -- Performing Test HAVE_LIBCURL_766
:info:configure -- Performing Test HAVE_LIBCURL_766 - Success
:info:configure -- Found Math library: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
:info:configure -- Found MPI_C: /opt/local/bin/mpicc-mpich-mp (found version "3.1")
:info:configure -- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
:info:configure CMake Error at /opt/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
:info:configure   Could NOT find MPI (missing: MPI_CXX_FOUND) (found version "3.1")
:info:configure       Reason given by package: MPI component 'Fortran' was requested, but language Fortran is not enabled.
:info:configure Call Stack (most recent call first):
:info:configure   /opt/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
:info:configure   /opt/local/share/cmake-3.19/Modules/FindMPI.cmake:1722 (find_package_handle_standard_args)
:info:configure   CMakeLists.txt:1208 (FIND_PACKAGE)
:info:configure -- Configuring incomplete, errors occurred!
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeOutput.log".
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeError.log".
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX='/opt/local' -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_C_COMPILER="$CC" -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/opt/local;/usr" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -Wno-dev -DCMAKE_PREFIX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0/cmake/modules -DENABLE_PARALLEL_TESTS=ON -DENABLE_NETCDF_4=ON -DENABLE_DAP=ON -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=ON -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.2" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0
:info:configure Exit code: 1
:error:configure Failed to configure netcdf: configure failure: command execution failed
:debug:configure Error code: NONE
:debug:configure Backtrace: configure failure: command execution failed
:debug:configure     while executing
:debug:configure "$procedure $targetname"
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/main.log for details.

Which seems to be related to an absent MPI_CXX, which looks weird because all the MPI compilers are up and working on my system.

The only difference between the MacBook Pro that originated the original ticket message and the iMac is the OS version: the former is under Big Sur 11.0.1 (note the typo in the original post) and the later is up-to-date with Big Sur 11.2.3. Both have Xcode 12.4 and its Command Line Tools.

Thoroughly removing and re-installing XCode and MacPorts did not help on neither machine. Not sure where to go from here...

comment:9 Changed 3 years ago by teammig

I can confirm both errors reported here with Big Sur 11.2.3 and Xcode 12.4 on MacBook Pro. When attempting to upgrade outdated NetCDF from this configuration:

sudo port install gcc10
sudo port install mpich-gcc10
sudo port install netcdf-fortran +gcc10 +mpich

I received the MPI_CXX error. Uninstalled all installed ports and started over with:

sudo port install gcc10
sudo port install netcdf-fortran +gcc10

resulting in

:info:configure -- The C compiler identification is GNU 10.3.0
:info:configure -- The CXX compiler identification is AppleClang 12.0.0.12000032
:info:configure -- Checking whether C compiler has -isysroot
:info:configure -- Checking whether C compiler has -isysroot - yes
:info:configure -- Checking whether C compiler supports OSX deployment target flag
:info:configure -- Checking whether C compiler supports OSX deployment target flag - yes
:info:configure -- Detecting C compiler ABI info
:info:configure -- Detecting C compiler ABI info - done
:info:configure -- Check for working C compiler: /opt/local/bin/gcc-mp-10 - skipped
:info:configure -- Detecting C compile features
:info:configure -- Detecting C compile features - done
:info:configure -- Detecting CXX compiler ABI info
:info:configure -- Detecting CXX compiler ABI info - failed
:info:configure -- Check for working CXX compiler: /usr/bin/clang++
:info:configure -- Check for working CXX compiler: /usr/bin/clang++ - broken
:info:configure CMake Error at /opt/local/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message):
:info:configure   The C++ compiler
:info:configure     "/usr/bin/clang++"
:info:configure   is not able to compile a simple test program.
:info:configure   It fails with the following output:
:info:configure     Change Dir: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeTmp
:info:configure     
:info:configure     Run Build Command(s):/usr/bin/make cmTC_b6afa/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_b6afa.dir/build.make CMakeFiles/cmTC_b6afa.dir/build
:info:configure     Building CXX object CMakeFiles/cmTC_b6afa.dir/testCXXCompiler.cxx.o
:info:configure     /usr/bin/clang++   -pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=11.2 -o CMakeFiles/cmTC_b6afa.dir/testCXXCompiler.cxx.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
:info:configure     clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
:info:configure     Linking CXX executable cmTC_b6afa
:info:configure     /opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b6afa.dir/link.txt --verbose=1
:info:configure     /usr/bin/clang++ -pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=11.2 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  CMakeFiles/cmTC_b6afa.dir/testCXXCompiler.cxx.o -o cmTC_b6afa 
:info:configure     clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]
:info:configure     ld: library not found for -lstdc++
:info:configure     clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:configure     make[1]: *** [cmTC_b6afa] Error 1
:info:configure     make: *** [cmTC_b6afa/fast] Error 2
:info:configure     
:info:configure     
:info:configure   
:info:configure   CMake will not be able to correctly generate this project.
:info:configure Call Stack (most recent call first):
:info:configure   CMakeLists.txt:13 (project)
:info:configure -- Configuring incomplete, errors occurred!
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeOutput.log".
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeError.log".
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX='/opt/local' -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_C_COMPILER="$CC" -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/opt/local;/usr" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -Wno-dev -DCMAKE_PREFIX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0/cmake/modules -DENABLE_NETCDF_4=ON -DENABLE_DAP=ON -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=ON -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.2" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0 
:info:configure Exit code: 1
:error:configure Failed to configure netcdf: configure failure: command execution failed
:debug:configure Error code: NONE
:debug:configure Backtrace: configure failure: command execution failed
:debug:configure     while executing
:debug:configure "$procedure $targetname"
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/main.log for details.

comment:10 Changed 3 years ago by kencu (Ken)

well there have been changes to some portgroups recently that may or may not be involved.

I have never really taken the time to understand the compilers PortGroup so I'm not really in a position to help, but perhaps Chris might be.

comment:11 Changed 3 years ago by kencu (Ken)

Cc: cjones051073 added

Hi Chris- can you take a peek at this and help us sort out if some changes to the compiler PG might be involved? -- Thanks!

comment:12 Changed 3 years ago by smeingast (Stefan Meingast)

Cc: smeingast added

comment:13 Changed 3 years ago by mf2k (Frank Schima)

Cc: mf2k added

comment:14 Changed 3 years ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:15 Changed 3 years ago by EJFielding (Eric Fielding)

Cc: EJFielding added

comment:16 Changed 3 years ago by EJFielding (Eric Fielding)

I am getting the same error as @thiagoveloso on Catalina v10.15.7. I think this is the relevant part of the log:

version:1
:debug:sysinfo macOS 10.15 (darwin/19.6.0) arch i386
:debug:sysinfo MacPorts 2.6.4
:debug:sysinfo Xcode 12.4
:debug:sysinfo SDK 10.15
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 10.15
:msg:main --->  Computing dependencies for netcdf:info:main .:debug:main netcdf has no conflicts
:debug:main Searching for dependency: cmake
:debug:main Found Dependency: receipt exists for cmake
:debug:main Searching for dependency: openmpi-default
:debug:main Found Dependency: receipt exists for openmpi-default
:debug:main Searching for dependency: hdf5
:debug:main Found Dependency: receipt exists for hdf5
:debug:main Searching for dependency: curl
:debug:main Found Dependency: receipt exists for curl
:debug:main Executing org.macports.main (netcdf)
:debug:main dropping privileges: euid changed to 502, egid changed to 20.
:debug:archivefetch archivefetch phase started at Sat Apr 17 12:31:42 PDT 2021
:msg:archivefetch --->  Fetching archive for netcdf
:debug:archivefetch Executing proc-pre-org.macports.archivefetch-archivefetch-0
:debug:archivefetch Executing proc-pre-org.macports.archivefetch-archivefetch-1
:debug:archivefetch mpi.enforce_variant list:  hdf5
:debug:archivefetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:archivefetch   required: , forbidden: 
:debug:archivefetch   accepted
:debug:archivefetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:archivefetch   required: mpich, forbidden: 
:debug:archivefetch   rejected, because required variant mpich is missing
:debug:archivefetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:archivefetch   required: openmpi, forbidden: 
:debug:archivefetch   accepted
:debug:archivefetch Executing org.macports.archivefetch (netcdf)
:debug:archivefetch euid/egid changed to: 0/0
:debug:archivefetch chowned /opt/local/var/macports/incoming to macports
:debug:archivefetch euid/egid changed to: 502/20
:info:archivefetch --->  netcdf-4.8.0_0+cdf5+dap+netcdf4+openmpi.darwin_19.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
:msg:archivefetch --->  Attempting to fetch netcdf-4.8.0_0+cdf5+dap+netcdf4+openmpi.darwin_19.x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/netcdf
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 Not Found
:msg:archivefetch --->  Attempting to fetch netcdf-4.8.0_0+cdf5+dap+netcdf4+openmpi.darwin_19.x86_64.tbz2 from https://kmq.jp.packages.macports.org/netcdf
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 Not Found
:msg:archivefetch --->  Attempting to fetch netcdf-4.8.0_0+cdf5+dap+netcdf4+openmpi.darwin_19.x86_64.tbz2 from https://mse.uk.packages.macports.org/netcdf
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 Not Found
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:fetch fetch phase started at Sat Apr 17 12:31:44 PDT 2021
:notice:fetch --->  Fetching distfiles for netcdf
:debug:fetch Executing proc-pre-org.macports.fetch-fetch-0
:debug:fetch Executing proc-pre-org.macports.fetch-fetch-1
:debug:fetch mpi.enforce_variant list:  hdf5
:debug:fetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:fetch   required: , forbidden: 
:debug:fetch   accepted
:debug:fetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:fetch   required: mpich, forbidden: 
:debug:fetch   rejected, because required variant mpich is missing
:debug:fetch hdf5 is installed with the following variants: +cxx+hl+openmpi
:debug:fetch   required: openmpi, forbidden: 
:debug:fetch   accepted
:debug:fetch Executing org.macports.fetch (netcdf)
...
:info:configure -- Found Math library: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libm.tbd
:info:configure -- Found MPI_C: /opt/local/bin/mpicc-openmpi-mp (found version "3.1") 
:info:configure -- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
:info:configure CMake Error at /opt/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
:info:configure   Could NOT find MPI (missing: MPI_CXX_FOUND) (found version "3.1")
:info:configure       Reason given by package: MPI component 'Fortran' was requested, but language Fortran is not enabled.  
:info:configure Call Stack (most recent call first):
:info:configure   /opt/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
:info:configure   /opt/local/share/cmake-3.19/Modules/FindMPI.cmake:1722 (find_package_handle_standard_args)
:info:configure   CMakeLists.txt:1208 (FIND_PACKAGE)
:info:configure -- Configuring incomplete, errors occurred!
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeOutput.log".
:info:configure See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build/CMakeFiles/CMakeError.log".
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/build" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX='/opt/local' -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_C_COMPILER="$CC" -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/opt/local;/usr" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -Wno-dev -DCMAKE_PREFIX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0/cmake/modules -DENABLE_PARALLEL_TESTS=ON -DENABLE_NETCDF_4=ON -DENABLE_DAP=ON -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=ON -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.8.0 
:info:configure Exit code: 1
:error:configure Failed to configure netcdf: configure failure: command execution failed

comment:17 Changed 3 years ago by cjones051073 (Chris Jones)

The issue is the use of the none default gcc10 variant. Without this the configuration environment is

CC='/usr/bin/clang'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_science_netcdf/netcdf/work/.CC_PRINT_OPTIONS'
CFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
CPATH='/opt/local/include'
CPPFLAGS='-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
CXX='/usr/bin/clang++'
CXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
DEVELOPER_DIR='/Library/Developer/CommandLineTools'
F90FLAGS='-pipe -Os -m64'
FCFLAGS='-pipe -Os -m64'
FFLAGS='-pipe -Os -m64'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='11.0'
OBJC='/usr/bin/clang'
OBJCFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
OBJCXX='/usr/bin/clang++'
OBJCXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'

compared to with it enabled

CC='/opt/local/bin/gcc-mp-10'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_science_netcdf/netcdf/work/.CC_PRINT_OPTIONS'
CFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
CPATH='/opt/local/include'
CPPFLAGS='-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
CXX='/usr/bin/clang++'
CXXFLAGS='-pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
DEVELOPER_DIR='/Library/Developer/CommandLineTools'
F90FLAGS='-pipe -Os -m64'
FCFLAGS='-pipe -Os -m64'
FFLAGS='-pipe -Os -m64'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='11.0'
OBJC='/usr/bin/clang'
OBJCFLAGS='-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
OBJCXX='/usr/bin/clang++'
OBJCXXFLAGS='-pipe -Os -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'
SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk'

See how CC is changed to use gcc-mp-10, which is a bit odd, but also how -stdlib=libstdc++ finds its way into a number of flags.

I don't think this is an upstream issue with netcdf, but an issue with the MacPorts mpi (or compilers) PortGroup configuration.

comment:18 Changed 3 years ago by EJFielding (Eric Fielding)

One more data point about this build problem. On my MacBook, also running 10.15.7, I was able to build netcdf with the +openmpi option.

port installed netcdf
The following ports are currently installed:
  netcdf @4.7.4_2+cdf5+dap+netcdf4+openmpi
  netcdf @4.8.0_0+cdf5+dap+netcdf4+openmpi (active)

Only thing I can see that is different is that this machine has port openmpi installed and the other Mac that fails has openmpi-default installed. On the good Mac:

port installed openmpi
The following ports are currently installed:
  openmpi @4.1.0_1 (active)
Version 0, edited 3 years ago by EJFielding (Eric Fielding) (next)

comment:19 Changed 3 years ago by EJFielding (Eric Fielding)

I went ahead and uninstalled my old openmpi-default port, and ran install openmpi. It then installed the gcc10 and openmpi-default as dependencies, so I got a new version of openmpi-default. It also had this note at the end:

  openmpi-default has the following notes:
    The mpicc wrapper (and friends) are installed as:

      /opt/local/bin/mpicc-openmpi-mp (likewise mpicxx, ...)

    To make openmpi-default's wrappers the default (what you get when
    you execute 'mpicc' etc.) please run:

      sudo port select --set mpi openmpi-mp-fortran

After running the port select --set mpi openmpi-mp-fortran command, I was able to build netcdf with no problems on the Mac where it failed before. Maybe this is a relatively new requirement and people like me that have not installed a new openmpi-default have not done this important step.

comment:20 in reply to:  19 Changed 3 years ago by nhchan

Replying to EJFielding:

I went ahead and uninstalled my old openmpi-default port, and ran install openmpi. It then installed the gcc10 and openmpi-default as dependencies, so I got a new version of openmpi-default. It also had this note at the end:

  openmpi-default has the following notes:
    The mpicc wrapper (and friends) are installed as:

      /opt/local/bin/mpicc-openmpi-mp (likewise mpicxx, ...)

    To make openmpi-default's wrappers the default (what you get when
    you execute 'mpicc' etc.) please run:

      sudo port select --set mpi openmpi-mp-fortran

After running the port select --set mpi openmpi-mp-fortran command, I was able to build netcdf with no problems on the Mac where it failed before. Maybe this is a relatively new requirement and people like me that have not installed a new openmpi-default have not done this important step.

I can confirm that this procedure resolved the issue for me too. Thanks for sharing!

comment:21 in reply to:  19 Changed 3 years ago by thiagoveloso (Thiago V. dos Santos)

Replying to EJFielding:

I went ahead and uninstalled my old openmpi-default port, and ran install openmpi. It then installed the gcc10 and openmpi-default as dependencies, so I got a new version of openmpi-default. It also had this note at the end:

  openmpi-default has the following notes:
    The mpicc wrapper (and friends) are installed as:

      /opt/local/bin/mpicc-openmpi-mp (likewise mpicxx, ...)

    To make openmpi-default's wrappers the default (what you get when
    you execute 'mpicc' etc.) please run:

      sudo port select --set mpi openmpi-mp-fortran

After running the port select --set mpi openmpi-mp-fortran command, I was able to build netcdf with no problems on the Mac where it failed before. Maybe this is a relatively new requirement and people like me that have not installed a new openmpi-default have not done this important step.

Thanks for sharing. I did the same and the problem was solved on my machines as well. I already had the sudo port select --set mpi mpich-gcc10-fortran command set, but what appears to have made the difference was removing and reinstalling gcc10, mpich, mpich-gcc10, and mpich-default.

comment:22 Changed 3 years ago by EJFielding (Eric Fielding)

I ran into this problem of MPI_CXX not being defined again when trying to install all my ports on a new computer. I had to run that port select --set mpi openmpi-mp-fortran command again to get the netcdf version 4.8.0 to build. Fortunately, I was able to find this issue and see what I did before. It seems this needs to be included in the netcdf port somehow as a prerequisite.

Last edited 3 years ago by EJFielding (Eric Fielding) (previous) (diff)
Note: See TracTickets for help on using tickets.