c - netCDF Fortran 编译的问题:C 编译器不起作用
问题描述
我对 netCDF Fortran 编译有疑问。这是我编译的输出:
configure: netCDF-Fortran 4.5.3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: checking user options
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpicc
checking whether the C compiler works... no
configure: error: in `/home/ksenia/prgs4mom/src/netcdf-fortran-4.5.3':
configure: error: C compiler cannot create executables
See config.log for more details
make: *** No targets specified and no makefile found. Stop.
这是我的编译脚本:
#!/bin/bash
export CC="/home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpicc"
export FC="/home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpif90"
export F77="/home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpifort"
export CXX="/home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpicxx"
export CPPFLAGS="$(echo "nc-config --cflags")"
export LDFLAGS="$(echo "nc-config --libs")"
export LIBS="-lnetcdf"
export CFLAGS="-DgFortran"
export CPPLAGS="-DgFortran"
export CXXFLAGS="-DgFortran"
./configure --disable-shared --prefix=/home/ksenia/prgs4mom/netcdf_fortran_4.5.3
make && sudo make install
还应该注意的是,如果我注释提供 LDFLAGS、CPPFLAGS 和 LIBS 的字符串,编译将采用另一种可以理解的方式(为了更方便查看,我剪切了输出):
configure: netCDF-Fortran 4.5.3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: checking user options
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpicc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
***
configure: error: netcdf-c version 4.7.4 or greater is required
make: *** No targets specified and no makefile found. Stop.
这是输出nc-config --all
:
This netCDF 4.7.4 has been built with the following features:
--cc -> /home/ksenia/prgs4mom/openmpi_4.1.1/bin/mpicc
--cflags -> -I/home/ksenia/prgs4mom/netcdf_c_4.7.4/include -I/home/ksenia/prgs4mom/zlib_1.2.11/include -I/home/ksenia/prgs4mom/curl_7.77.0/include -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/include -I/home/ksenia/prgs4mom/openmpi_4.1.1/include -I/home/ksenia/prgs4mom/hdf5_1.12.0/include -I/home/ksenia/prgs4mom/pnetcdf_1.12.2/include
--libs -> -L/home/ksenia/prgs4mom/netcdf_c_4.7.4/lib -L/home/ksenia/prgs4mom/zlib_1.2.11/lib -L/home/ksenia/prgs4mom/curl_7.77.0/lib -L/usr/lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/home/ksenia/prgs4mom/openmpi_4.1.1/lib -L/home/ksenia/prgs4mom/hdf5_1.12.0/lib -L/home/ksenia/prgs4mom/pnetcdf_1.12.2/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -ldl -lz -lcurl
--static -> -lpnetcdf -lhdf5_hl -lhdf5 -lm -ldl -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--has-fortran -> no
--has-dap -> yes
--has-dap2 -> yes
--has-dap4 -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging -> no
--has-pnetcdf -> yes
--has-szlib -> no
--has-cdf5 -> yes
--has-parallel4 -> yes
--has-parallel -> yes
--prefix -> /home/ksenia/prgs4mom/netcdf_c_4.7.4
--includedir -> /home/ksenia/prgs4mom/netcdf_c_4.7.4/include
--libdir -> /home/ksenia/prgs4mom/netcdf_c_4.7.4/lib
--version -> netCDF 4.7.4
如果我提供有关 netCDF-C 的信息以及如何修复它,有人可以解释一下我做错了什么以及为什么配置回顾在我的 PC 上没有可用的 C 编译器?
谢谢!
解决方案
推荐阅读
- elasticsearch - 具有多个必须和应该的嵌套布尔查询
- python - 检测文本和纠偏
- html - 如何在 cakephp 分页中设置自定义过滤器
- assembly - Mult.asm 比较失败
- ios - 多用户共享一台设备时使用指纹登录iOS应用程序
- database - 如何在 DolphinDB 中获取空值在向量中的位置?
- c# - 如何防止在大字符串的空白行中添加后缀?C#
- c++ - 引入 std::enable_if 后出现“不匹配”错误
- php - 如何在运行 php 脚本的 aws-lambda 函数中从客户端获取连接中止事件?
- c++ - 引用另一个类时的 istream 重载