mingw - libtool:存档中的对象名称冲突(NETCDF + MinGW)

标签 mingw conflict libtool netcdf

我将在 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 接口(interface)的 MinGW 版本的 NetCDF。请帮我一把。非常感谢。

最佳答案

问题是“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 的开头应该会有所帮助。

关于mingw - libtool:存档中的对象名称冲突(NETCDF + MinGW),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12060186/

相关文章:

c++ - 执行格式错误 Eclipse CDT

autoconf - 可能未定义的宏 : AC_SUBST

makefile - 如何使libtool指向用户安装的库?

c - 如何检测 printf 是否支持 %a?

c++ - Assimp 无法在 Code::Blocks 中正确构建 - "TVITEMEXW not declared in current scope"

c++ - 开发 Cpp "make.exe"错误代码 = 0xc00000fd

c - 错误: Conflicting types for 'pow' in C

sql - INSERT ... 在发生冲突时什么都不做 - 读取 csv 并生成外键表

我的 html 页面上的 Javascript 冲突

autotools - Libtool 安装警告 : xxx. la 尚未安装在/user/local/lib