libtool: object name conflicts in archive (NETCDF + MinGW)
Asked Answered
N

1

7

I am going to use NetCDF in windows and I think it has to be compiled with MinGW since my main program and all other libraries are compiled with MinGW already.

But when I used MinGW (gcc version 4.6.2). I got some error messages:

    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

I have no idea of what is the problem within libtool. But I do think ar command needs more inputs. And maybe there are something wrong when generating the libtool script?

I searched online but I can't find any MinGW version NetCDF with fortran and f90 interface. Please give me a hand. Many thanks.

Nightie answered 21/8, 2012 at 17:42 Comment(0)
S
17

The problem is that "Windows' path is listed before msys' bin in PATH. So, unix utilities which have same name with Windows' builtin utilities won't get called. Windows' ones get called instead." (http://forum.world.st/The-old-quot-object-name-conflicts-in-archive-quot-problem-on-Windows-MSYS-MinGW-td3439428.html). Putting path to msys binaries in the beginning of PATH should help.

Stilted answered 23/5, 2013 at 22:3 Comment(3)
Saved my day, thanks! To make a feedback: in my case I forgot the path of libraries in windows PATH, and I was running the msys sh on the normal cmd. Then now I removed the PATH and moved back to msys, just make again, and it continued where it gave the error. :) Basically double check the Path guys.Meanie
Oh flipping A. This fixed the issue.Noman
I encountered this same problem under cygwin. Reordering the PATH entries fixed it.Biramous

© 2022 - 2024 — McMap. All rights reserved.