MIT-LAE / APCEMM

Aircraft Plume Chemistry, Emissions, and Microphysics Model
MIT License
8 stars 17 forks source link

netcdf-c dependency does not compile with clang #28

Open lrobion opened 2 months ago

lrobion commented 2 months ago

Trying to compile vcpkg dependencies with APCEMM on clang fails due to netcdf-c. Tested on clang 18 on Hex. I tried updating the vcpkg version with git submodule update --remote which did update vcpkg but did not fix the netcdf-c compilation issue.

(clang) lrobion@hex:~/APCEMM_public/rundirs/clang$ CC=clang CXX=clang++ cmake ../../Code.v05-00/
-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
The following packages will be built and installed:
  * netcdf-c[core,dap,hdf5,nczarr,netcdf-4]:x64-linux -> 4.8.1#4 -- /home/lrobion/.cache/vcpkg/registries/git-trees/12002458bc69dbcd92c6792a3edd1f5e3931ae95
    netcdf-cxx4:x64-linux -> 4.3.1#5 -- /home/lrobion/.cache/vcpkg/registries/git-trees/e923110ddc48818ad472b7b577823caabfb203ab
    yaml-cpp:x64-linux -> 0.8.0 -- /home/lrobion/.cache/vcpkg/registries/git-trees/595f95f94e93c518b99e8c0e83ef35ced9e7867a
Additional packages (*) will be modified to complete this operation.
Restored 0 package(s) from /home/lrobion/.cache/vcpkg/archives in 22.3 us. Use --debug to see more details.
Installing 1/3 netcdf-c:x64-linux...
Building netcdf-c[core,dap,hdf5,nczarr,netcdf-4]:x64-linux...
-- Installing port from location: /home/lrobion/.cache/vcpkg/registries/git-trees/12002458bc69dbcd92c6792a3edd1f5e3931ae95
-- Using cached Unidata-netcdf-c-cd6173f472b778fa0e558982c59f7183aa5b8e47.tar.gz.
-- Cleaning sources at /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/src/83aa5b8e47-9b921f4f32.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/downloads/Unidata-netcdf-c-cd6173f472b778fa0e558982c59f7183aa5b8e47.tar.gz
-- Applying patch no-install-deps.patch
-- Applying patch fix-dependency-zlib.patch
-- Applying patch use_targets.patch
-- Applying patch fix-dependency-libmath.patch
-- Applying patch fix-linkage-error.patch
-- Applying patch fix-manpage-msys.patch
-- Applying patch fix-dependency-libzip.patch
-- Applying patch fix-dependency-mpi.patch
-- Applying patch fix-pkgconfig.patch
-- Using source at /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/src/83aa5b8e47-9b921f4f32.clean
-- Configuring x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/src/83aa5b8e47-9b921f4f32.clean -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/packages/netcdf-c_x64-linux/debug -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DBUILD_TESTING=OFF -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF -DENABLE_FILTER_TESTING=OFF -DENABLE_DAP_REMOTE_TESTS=OFF -DDISABLE_INSTALL_DEPENDENCIES=ON -DENABLE_DAP=ON -DENABLE_NETCDF_4=ON -DENABLE_HDF5=ON -DENABLE_NCZARR=ON -DENABLE_NCZARR_ZIP=OFF -DBUILD_UTILITIES=OFF -DCMAKE_REQUIRE_FIND_PACKAGE_CURL=ON -DUSE_SZIP=ON -DCMAKE_MAKE_PROGRAM=/home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja -DCMAKE_SYSTEM_NAME=Linux -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/scripts/toolchains/linux.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DVCPKG_APPLOCAL_DEPS=OFF -DCMAKE_TOOLCHAIN_FILE=/home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -DVCPKG_CXX_FLAGS= -DVCPKG_CXX_FLAGS_RELEASE= -DVCPKG_CXX_FLAGS_DEBUG= -DVCPKG_C_FLAGS= -DVCPKG_C_FLAGS_RELEASE= -DVCPKG_C_FLAGS_DEBUG= -DVCPKG_CRT_LINKAGE=dynamic -DVCPKG_LINKER_FLAGS= -DVCPKG_LINKER_FLAGS_RELEASE= -DVCPKG_LINKER_FLAGS_DEBUG= -DVCPKG_TARGET_ARCHITECTURE=x64 -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_BINDIR:STRING=bin -D_VCPKG_ROOT_DIR=/home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg -D_VCPKG_INSTALLED_DIR=/home/lrobion/APCEMM_public/rundirs/clang/vcpkg_installed -DVCPKG_MANIFEST_INSTALL=OFF
    Working Directory: /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/x64-linux-dbg
    Error code: 1
    See logs for more information:
      /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/config-x64-linux-dbg-CMakeCache.txt.log
      /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/config-x64-linux-dbg-out.log
      /home/lrobion/APCEMM_public/Code.v05-00/submodules/vcpkg/buildtrees/netcdf-c/config-x64-linux-dbg-err.log

Call Stack (most recent call first):
  /home/lrobion/APCEMM_public/rundirs/clang/vcpkg_installed/x64-linux/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:267 (vcpkg_execute_required_process)
  /home/lrobion/.cache/vcpkg/registries/git-trees/12002458bc69dbcd92c6792a3edd1f5e3931ae95/portfile.cmake:65 (vcpkg_cmake_configure)
  scripts/ports.cmake:170 (include)

error: building netcdf-c:x64-linux failed with: BUILD_FAILED
Elapsed time to handle netcdf-c:x64-linux: 6.2 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+netcdf-c
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[netcdf-c]+Build+error+on+x64-linux&body=Copy+issue+body+from+%2Fhome%2Flrobion%2FAPCEMM_public%2Frundirs%2Fclang%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at submodules/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  /home/lrobion/APCEMM_public/rundirs/clang/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /home/lrobion/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.24/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:6 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
lrobion commented 2 months ago

After more testing:

Local WSL setup:

HPC setup:

Seems like a local compiler configuration problem rather than a APCEMM / netcdf-c issue.

sdeastham commented 2 months ago

Hi @lrobion - what's your conclusion on this? I don't think we have clang on the cluster I'm using, otherwise I would've given it a shot. I did try using oneapi but no joy on that front either..

lrobion commented 2 months ago

I ended managing to compile with clang 10 on the cluster. Clang 10 is the system installation of clang on the HPC setup. On my local machine the only compilation that succeeded was with clang 14 which is also my system installed compiler.

All other tests were run with conda installations of clang, so I think it's a problem with conda not pointing clang to the proper installation of either the stdlib or OpenMP (sometimes instead of netcdf-c it was Boost that wouldn't compile). Interestingly enough conda installations of different gcc version work just fine.

I don't think this is an APCEMM / vcpkg specific problem, but if you had issues with other compilers then it may be worth looking into more.