7

我将在 Windows 中使用 NetCDF,我认为它必须使用 MinGW 编译,因为我的主程序和所有其他库已经使用 MinGW 编译。

但是当我使用 MinGW(gcc 版本 4.6.2)时。我收到一些错误消息:

    Making all in liblib
    make[2]: Entering directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib'
    /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I../include  -DDLL_NETCDF   -DDLL_EXPORT   -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c -o libnetcdf_la-stub.lo `test -f 'stub.c' ||echo './'`stub.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c  -DDLL_EXPORT -DPIC -o .libs/libnetcdf_la-stub.o
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c -o libnetcdf_la-stub.o >/dev/null 2>&1
    mv -f .deps/libnetcdf_la-stub.Tpo .deps/libnetcdf_la-stub.Plo
    /bin/sh ../libtool --tag=CC   --mode=link gcc  -g -O2 -version-info 9:0:2 -no-undefined -Wl,--output-def,netcdfdll.def  -o libnetcdf.la -rpath /usr/local/lib libnetcdf_la-stub.lo ../libdispatch/libnetcdf2.la ../libdispatch/libdispatch.la ../libsrc/libnetcdf3.la    -lm
    libtool: link: gcc -shared  .libs/libnetcdf_la-stub.o  -Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a ../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a -Wl,--no-whole-archive   -O2 -Wl,--output-def -Wl,netcdfdll.def   -o .libs/libnetcdf-7.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libnetcdf.dll.a
    Creating library file: .libs/libnetcdf.dll.a
    libtool: link: (cd .libs/libnetcdf.lax/libnetcdf2.a && ar x "/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib/../libdispatch/.libs/libnetcdf2.a")
    libtool: link: object name conflicts in archive: .libs/libnetcdf.lax/libnetcdf2.a//c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib/../libdispatch/.libs/libnetcdf2.a
    make[2]: *** [libnetcdf.la] Error 1
    make[2]: Leaving directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1'
    make: *** [all] Error 2

我不知道 libtool 中的问题是什么。但我确实认为 ar 命令需要更多输入。生成 libtool 脚本时可能有问题?

我在网上搜索,但找不到任何带有 fortran 和 f90 接口的 MinGW 版本的 NetCDF。请帮我一把。非常感谢。

4

1 回答 1

16

问题是“Windows 的路径列在 PATH 中 msys 的 bin 之前。因此,与 Windows 的内置实用程序同名的 unix 实用程序不会被调用。而是调用 Windows 的。” (http://forum.world.st/The-old-quot-object-name-conflicts-in-archive-quot-problem-on-Windows-MSYS-MinGW-td3439428.html)。将 msys 二进制文件的路径放在 PATH 的开头应该会有所帮助。

于 2013-05-23T22:03:45.943 回答