libtool
[Top][All Lists]
Advanced

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

problem with libtool's choice in "library_names=" under MingW port - .dl


From: Ed Hartnett
Subject: problem with libtool's choice in "library_names=" under MingW port - .dll.a and .lib not the same!
Date: Wed, 07 Feb 2007 06:45:09 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Howdy all!

I am having trouble with my MingW port of netCDF, which uses libtool.

My C library builds fine, but when it tries to build the very first
test, it fails, because it tries to link to libnetcdf.lib instead of
libnetcdf-4.dll.

This is strange to me. I don't understand why, under MingW, this
works:

gcc -g -O2 -o .libs/t_nc.exe t_nc-t_nc.o ./.libs/libnetcdf-4.dll 
-L/usr/local/lib

And this doesn't:

gcc -g -O2 -o .libs/t_nc.exe t_nc-t_nc.o  ./.libs/libnetcdf.lib -L/usr/local/lib

When libnetcdf-4.dll and libnetcdf.lib are copies of each other. In
fact, the names has to end with ".dll" or the link fails. Here's the
versions of gcc and ld:

$ ld --version
GNU ld version 2.15.91 20040904

$ gcc --version
gcc.exe (GCC) 3.4.2 (mingw-special)

When I look in the libnetcdf.la file, I see:

# Names of this library.
library_names='libnetcdf-4.dll libnetcdf.lib'

If I simply remove "libnetcdf.lib" from the list, my test links
correctly, because libnetcdf-4.dll is used instead of libnetcdf.lib.

I have read the ld document carefully, but I can't understand why the
name has to end with the .dll extension, since libtool is not asking
ld to find the file with -lnetcdf, but is actually providing a path
and file. So why does it matter?

Any thoughts or suggestions would be appreciated.

I don't know what I am doing to cause libtool to list the .lib file
either. In my minimal mingw dll example code, I get this:

# Names of this library.
library_names='libmindll.dll.a'

This implies that I should have a netcdf.dll.a file, but I don't seem
to. How do I get it?

In my minimal dll build, I get a link line like this:
libtool: link: gcc -shared  .libs/mindll.o    -Wl,--output-def
-Wl,.libs/libmindll.def -o .libs/libmindll-1.dll
-Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker
.libs/libmindll.dll.a

But in the netCDF line I get no ".a" on the end of my implib name:
libtool: link: gcc -shared  .libs/attr.o .libs/ncx.o .libs/putget.o
.libs/dim.o .libs/error.o .libs/libvers.o .libs/nc.o .libs/string.o
.libs/v1hpg.o .libs/var.o .libs/posixio.o    -Wl,--output-def
-Wl,.libs/libnetcdf.def -o .libs/libnetcdf-4.dll
-Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker
.libs/libnetcdf-4.dll

(In the command above, doesn't the implib overwrite the -o dll file?)

Anyway, research into this problem continues. If anyone can spot the
trouble, that would be helpful.

Thanks!

Ed


-- 
Ed Hartnett  -- address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]