[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Incorrect library names on Cygwin + MSCV CL/LINK
From: |
Scott Pakin |
Subject: |
Incorrect library names on Cygwin + MSCV CL/LINK |
Date: |
Sun, 27 Jan 2002 18:17:09 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1 |
In line 2041 of libtool.m4 (libtool v1.4.2), library_names_spec is set
to a .dll file and a .lib file. The .dll file is set to the library
name plus the first component of the release number, which is fine.
However, the .lib file is set to the library name only. This makes
programs that link with the library unable to find it.
For example, here's are the relevant lines from my Makefile.am:
lib_LTLIBRARIES = libsimpprof.la
libsimpprof_la_SOURCES = simpprof.c simpprof_int.h simpprof.h
libsimpprof_la_LDFLAGS = -no-undefined
include_HEADERS = simpprof.h
noinst_PROGRAMS = sptest
sptest_SOURCES = sptest.c simpprof.h
sptest_LDADD = libsimpprof.la
That is, I'm trying to build a shared library plus a test program
which uses that library. The problem I'm encountering is that libtool
is trying to link sptest.obj with ./.libs/libsimpprof.lib, which
doesn't exist:
/bin/sh ./libtool --mode=link cl -g -o sptest.exe sptest.obj
libsimpprof.la
cl -g -o .libs/sptest.exe sptest.obj ./.libs/libsimpprof.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
Command line warning D4002 : ignoring unknown option '-g'
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:sptest.exe
/out:.libs/sptest.exe
sptest.obj
./.libs/libsimpprof.lib
LINK : fatal error LNK1181: cannot open input file
"./.libs/libsimpprof.lib"
make[1]: *** [sptest.exe] Error 2
My .libs directory contains the following:
libsimpprof-0.dll libsimpprof-0.lib libsimpprof.lai
libsimpprof-0.exp libsimpprof.la
The solution is to modify libtool.m4 so that sptest is linked with
libsimpprof-0.lib, not libsimpprof.lib. Here's a patch file to do
just that:
====================================================================
--- libtool.m4.ORIG Fri Jan 18 16:22:45 2002
+++ libtool.m4 Fri Jan 18 16:24:37 2002
@@ -2038,7 +2038,7 @@
library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo
${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
;;
*)
- library_names_spec='${libname}`echo ${release} | sed -e
's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
+ library_names_spec='${libname}`echo ${release} | sed -e
's/[[.]]/-/g'`${versuffix}.dll ${libname}`echo ${release} | sed -e
's/[[.]]/-/g'`${versuffix}.lib'
;;
esac
dynamic_linker='Win32 ld.exe'
====================================================================
Thanks for your attention,
-- Scott
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Incorrect library names on Cygwin + MSCV CL/LINK,
Scott Pakin <=