[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #SFI-452964]: Failure to build with cmake 3.14.5 and GCC 9.1.0 on macOS



Hello,

The option you are passing, NETCDF_C_LIBRARY, when invoking cmake, is passing a 
directory and not a library itself.  It would more properly look as follows:

    `-DNETCDF_C_LIBRARY=/usr/local/Cellar/netcdf/4.7.0/lib/[name of netcdf 
library]`

Alternatively, you could try removing the `NETCDF_C_LIBRARY` option altogether, 
and instead use:

    `-DCMAKE_PREFIX_PATH=/usr/local/Cellar/netcdf/4.7.0`

I hope this helps, have a great day!

-Ward

> Compiling netcdf-fortran-4.4.5 from source on macOS (all versions from 10.12 
> to 10.14) with cmake 3.14.5 and GCC 9.1.0 fails with the error message:
> 
> > -- Looking for nc_def_opaque in /usr/local/Cellar/netcdf/4.7.0/lib
> > WARNING: Target "cmTC_e081a" requests linking to directory 
> > "/usr/local/Cellar/netcdf/4.7.0/lib".  Targets may link only to libraries.  
> > CMake is dropping the item.
> > -- Looking for nc_def_opaque in /usr/local/Cellar/netcdf/4.7.0/lib - not 
> > found
> > -- Looking for nccreate in /usr/local/Cellar/netcdf/4.7.0/lib
> > WARNING: Target "cmTC_ddfd8" requests linking to directory 
> > "/usr/local/Cellar/netcdf/4.7.0/lib".  Targets may link only to libraries.  
> > CMake is dropping the item.
> > -- Looking for nccreate in /usr/local/Cellar/netcdf/4.7.0/lib - not found
> > -- Looking for nc_set_log_level in /usr/local/Cellar/netcdf/4.7.0/lib
> > WARNING: Target "cmTC_309f2" requests linking to directory 
> > "/usr/local/Cellar/netcdf/4.7.0/lib".  Targets may link only to libraries.  
> > CMake is dropping the item.
> > -- Looking for nc_set_log_level in /usr/local/Cellar/netcdf/4.7.0/lib - not 
> > found
> > -- Looking for oc_open in /usr/local/Cellar/netcdf/4.7.0/lib
> > WARNING: Target "cmTC_86d73" requests linking to directory 
> > "/usr/local/Cellar/netcdf/4.7.0/lib".  Targets may link only to libraries.  
> > CMake is dropping the item.
> > -- Looking for oc_open in /usr/local/Cellar/netcdf/4.7.0/lib - not found
> > CMake Error at 
> > /tmp/netcdf--fortran-20190619-29212-1vcumno/netcdf-fortran-4.4.5/build-fortran/CMakeFiles/CMakeTmp/CMakeLists.txt:14
> >  (add_executable):
> >   Cannot find source file:
> >
> >     
> > /tmp/netcdf--fortran-20190619-29212-1vcumno/netcdf-fortran-4.4.5/CMakeExtras/check_cdf5.c
> >
> >   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
> >   .hpp .hxx .in .txx
> >
> >
> > CMake Error at 
> > /tmp/netcdf--fortran-20190619-29212-1vcumno/netcdf-fortran-4.4.5/build-fortran/CMakeFiles/CMakeTmp/CMakeLists.txt:14
> >  (add_executable):
> >   No SOURCES given to target: cmTC_49017
> >
> >
> > CMake Error at CMakeLists.txt:569 (try_compile):
> >   Failed to generate test project build system.
> 
> The cmake command line is:
> 
> > cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG 
> > -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG 
> > -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/netcdf/4.7.0 
> > -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST 
> > -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF 
> > -DNETCDF_C_LIBRARY=/usr/local/Cellar/netcdf/4.7.0/lib -DENABLE_TESTS=OFF
> 


Ticket Details
===================
Ticket ID: SFI-452964
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.