Closed MuellerSeb closed 2 years ago
I was able to compile with adding this to the netcdf_fortran_cmake_args
in netcdf.cmake
:
-DCMAKE_C_FLAGS:STRING="-fPIC"
So the problem is upstream in netcdf-fortran. There -fPIC
is only added when on APPLE or compiling with GNUCC as C compiler. They should add the POSITION_INDEPENDENT_CODE ON
property to the netcdff_c
instead of adding compiler flags by hand here: https://github.com/Unidata/netcdf-fortran/blob/43e3308bba4b6139c12bed53f10fd2dea9f55014/fortran/CMakeLists.txt#L142
Adding this also worked:
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
But afterwards two tests are failing:
Start 10: string
10/11 Test #10: string ...........................***Failed 0.02 sec
Start 11: version
11/11 Test #11: version ..........................***Failed 0.02 sec
I don't know if this is crucial.
I created a PR at netcdf-fortran: https://github.com/Unidata/netcdf-fortran/pull/334
For the sake of completeness, this is the TestLog for test 10:
"string" start time: Mar 07 22:41 CET
Output:
----------------------------------------------------------
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
test_string 0000000000432D6A for__signal_handl Unknown Unknown
libpthread-2.31.s 00007F93ED93F3C0 Unknown Unknown Unknown
test_string 00000000004CA3C8 __intel_avx_memmo Unknown Unknown
test_string 0000000000464E9C for_cpystr Unknown Unknown
libnetcdff.so.7.1 00007F93EDFEF278 nf_get_vars_text_ Unknown Unknown
test_string 000000000041290E Unknown Unknown Unknown
test_string 000000000040D2C1 Unknown Unknown Unknown
test_string 000000000040CE22 Unknown Unknown Unknown
libc-2.31.so 00007F93ED6080B3 __libc_start_main Unknown Unknown
test_string 000000000040CD2E Unknown Unknown Unknown
<end of output>
Test time = 0.02 sec
----------------------------------------------------------
Test Failed.
"string" end time: Mar 07 22:41 CET
"string" time elapsed: 00:00:00
----------------------------------------------------------
The version test seem to be just a missmatch, since I am using the development version of this library.
Or maybe the version test is also hinting a problem:
"version" start time: Mar 08 13:11 CET
Output:
----------------------------------------------------------
4.8.1 of Mar 8 2022 13:
version mismatch: 4.7.3 /= 4.8.1
<end of output>
Test time = 0.02 sec
----------------------------------------------------------
Test Failed.
"version" end time: Mar 08 13:11 CET
"version" time elapsed: 00:00:00
----------------------------------------------------------
Where 4.8.1
is the version of the netcdf-c package given in libraries.json
and 4.7.3
is my systems netcdf version.
Thanks after this update I still notice failures on Intel oneAPI on Linux on two different machines, whether with icc/ifort or icx/ifx for NetCDF-Fortran.
Checking with nm
the symbols are in that libnetcdf.so file, so maybe a NetCDF package problem
-- Check size of uint64_t
-- Check size of uint64_t - done
-- Performing Test COMPILER_HAS_ALLOW_ARGUMENT_MISMATCH
-- Performing Test COMPILER_HAS_ALLOW_ARGUMENT_MISMATCH - Failed
-- Performing Test COMPILER_HAS_MISMATCH_ALL
-- Performing Test COMPILER_HAS_MISMATCH_ALL - Failed
-- Looking for alloca
-- Looking for alloca - not found
-- Looking for nc_get_chunk_cache_ints in /tmp/nci/lib/libnetcdf.so
-- Looking for nc_get_chunk_cache_ints in /tmp/nci/lib/libnetcdf.so - not found
-- Looking for nccreate in /tmp/nci/lib/libnetcdf.so
-- Looking for nccreate in /tmp/nci/lib/libnetcdf.so - not found
-- Looking for nc_set_log_level in /tmp/nci/lib/libnetcdf.so
-- Looking for nc_set_log_level in /tmp/nci/lib/libnetcdf.so - not found
-- Looking for oc_open in /tmp/nci/lib/libnetcdf.so
-- Looking for oc_open in /tmp/nci/lib/libnetcdf.so - not found
-- Performing Test HAVE_SZIP_WRITE
-- Performing Test HAVE_SZIP_WRITE - Failed
-- Looking for nc_def_var_szip in /tmp/nci/lib/libnetcdf.so
-- Looking for nc_def_var_szip in /tmp/nci/lib/libnetcdf.so - not found
CMake Error at CMakeLists.txt:643 (message):
netcdf-c version 4.7.4 or greater is required
Do you have any idea how to solve this?
I would ask NetCDF project. I am simply providing a script that executes their CMake script
Hello, I believe I fixed this issue with nc4fortran v1.6.1. Please reopen if still an issue. I worked around the bugs in the netcdf-fortran/CMakeLists.txt upstream by sending additional hints from nc4fortran/cmake/netcdf.cmake.
Describe the bug
When compiling this (from commit 6ee7c58) with Intel oneAPI with auto-building dependencies, I run into a linker error for libnetcdff:
results in:
Did I do something wrong?
Thanks for this package! Sebastian
System details