bug#80155: Linker path does not have real file for library -lLIB
Kirill Makurin <[email protected]> Thu, 8 Jan 2026 17:24:16 +0000
| Newsgroups | gmane.comp.gnu.libtool.bugs |
|---|---|
| Message-ID | <LV5PR05MB998298210AAF1E700434DF1D84B185A@LV5PR05MB998298.namprd05.prod.outlook.com> |
--_000_LV5PR05MB998298210AAF1E700434DF1D84B185ALV5PR05MB998298_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I want to address very annoying libtool behavior which I had to encounter c=
ountless times when building stuff with MSVC.
Here's an example:
```
libtool: warning: Linker path does not have real file for library -lwldap32=
.
libtool: warning: I have the capability to make that library automatically =
link in when
libtool: warning: you link to this library. But I can only do this if you =
have a
libtool: warning: shared version of the library, which you do not appear to=
have
libtool: warning: because I did check the linker path looking for a file st=
arting
libtool: warning: with wldap32 and none of the candidates passed a file for=
mat test
libtool: warning: using a file magic. Last file checked: /cygdrive/c/WINDOW=
S/system32/secur32.dll
libtool: warning: Linker path does not have real file for library -liphlpap=
i.
libtool: warning: I have the capability to make that library automatically =
link in when
libtool: warning: you link to this library. But I can only do this if you =
have a
libtool: warning: shared version of the library, which you do not appear to=
have
libtool: warning: because I did check the linker path looking for a file st=
arting
libtool: warning: with iphlpapi and none of the candidates passed a file fo=
rmat test
libtool: warning: using a file magic. Last file checked: /cygdrive/c/PROGRA=
~2/WI3CF2~1/10/lib/100261~1.0/um/x64/iphlpapi.lib
```
Here, libtool failed to find *real library files* for -lwldap32 and -liphlp=
api.
Those are system libraries installed in C:\Windows\System32:
```
$ which wldap32.dll
/c/Windows/System32/wldap32.dll
$ file /c/Windows/System32/wldap32.dll
/c/Windows/System32/wldap32.dll: PE32+ executable for MS Windows 10.00 (DLL=
), x86-64, 8 sections
$ which iphlpapi.dll
/c/Windows/System32/iphlpapi.dll
$ file /c/Windows/System32/iphlpapi.dll
/c/Windows/System32/iphlpapi.dll: PE32+ executable for MS Windows 10.00 (DL=
L), x86-64, 8 sections
```
The worst part of this behavior is that instead of failing, libtool proceed=
s creating *static* library. This is nonsense on Windows. This *static* lib=
rary very likely contains symbol names mangled with __declspec(dllexport) a=
nd it will not work as static library.
If you're lucky, your build will just fail, but there are cases when such *=
static* library may get installed and will cause subsequent builds which wa=
nt to use it to fail. I have encountered it and it was frustrating.
This issue also is very likely to occur when using libraries build by cmake=
, since sometimes they are prefixed with "lib", e.g. libfoo.dll. Real examp=
les are libxml2.dll and libcurl.dll. I probably need to address naming conv=
ention mess with MSVC in another bug report.
I propose that libtool should proceed creating DLL in such cases, asumming =
DLL is somewhere in PATH and issuing a warning massage saying something lik=
e "failed to locale DLL for -lLIB. Executables using this DLL may fail to r=
un."
My point here is that in vast majority of cases you use libtool with Autoto=
ols and have already checked during configuration whether library links, an=
d for native builds whether it is actually usable.
Another case when this issue may occur is when names of import library and =
the DLL are different on purpose. For example, winpthreads install two impo=
rt libraries pthread[.dll].lib and winpthread[.dll].lib, both linking to wi=
npthread-1.dll. Using pthread.lib is impossible with libtool, unless you cr=
eate a link or a copy named pthread*.dll.
- Kirill Makurin
--_000_LV5PR05MB998298210AAF1E700434DF1D84B185ALV5PR05MB998298_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Hello, </div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
I want to address very annoying libtool behavior which I had to encounter c=
ountless times when building stuff with MSVC.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Here's an example:</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
```</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: Linker path does not have real file for library -lwldap32=
.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: I have the capability to make that library automatically =
link in when</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: you link to this library. But I can only do this if=
you have a</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: shared version of the library, which you do not appear to=
have</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: because I did check the linker path looking for a file st=
arting</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: with wldap32 and none of the candidates passed a file for=
mat test</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: using a file magic. Last file checked: /cygdrive/c/WINDOW=
S/system32/secur32.dll</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: Linker path does not have real file for library -lip=
hlpapi.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: I have the capability to make that library automatically =
link in when</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: you link to this library. But I can only do this if=
you have a</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: shared version of the library, which you do not appear to=
have</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: because I did check the linker path looking for a file st=
arting</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
libtool: warning: with iphlpapi and none of the candidates passed a file fo=
rmat test</div>
<div style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, =
Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
libtool: warning: using a file magic. Last file checked: /cygdrive/c/PROGRA=
~2/WI3CF2~1/10/lib/100261~1.0/um/x64/iphlpapi.lib</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
```</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">
<span style=3D"color: rgb(0, 0, 0);">Here, libtool failed to find *real lib=
rary files* for
</span><span style=3D"color: rgb(0, 0, 0);">-lwldap32 and -liphlpapi.</span=
></div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Those are system libraries installed in C:\Windows\System32:</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
```</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
$ which wldap32.dll<br>
/c/Windows/System32/wldap32.dll</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
$ file /c/Windows/System32/wldap32.dll<br>
/c/Windows/System32/wldap32.dll: PE32+ executable for MS Windows 10.00 (DLL=
), x86-64, 8 sections</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
$ which iphlpapi.dll<br>
/c/Windows/System32/iphlpapi.dll</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
$ file /c/Windows/System32/iphlpapi.dll<br>
/c/Windows/System32/iphlpapi.dll: PE32+ executable for MS Windows 10.00 (DL=
L), x86-64, 8 sections</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
```</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
The worst part of this behavior is that instead of failing, libtool proceed=
s creating *static* library. This is nonsense on Windows. This *static* lib=
rary very likely contains symbol names mangled with __declspec(dllexport) a=
nd it will not work as static library.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
If you're lucky, your build will just fail, but there are cases when such *=
static* library may get installed and will cause subsequent builds which wa=
nt to use it to fail. I have encountered it and it was frustrating.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
This issue also is very likely to occur when using libraries build by cmake=
, since sometimes they are prefixed with "lib", e.g. libfoo.dll. =
Real examples are libxml2.dll and libcurl.dll. I probably need to address n=
aming convention mess with MSVC in another
bug report.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
I propose that libtool should proceed creating DLL in such cases, asumming =
DLL is somewhere in PATH and issuing a warning massage saying something lik=
e "failed to locale DLL for -lLIB. Executables using this DLL may fail=
to run."</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
My point here is that in vast majority of cases you use libtool with Autoto=
ols and have already checked during configuration whether library links, an=
d for native builds whether it is actually usable.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Another case when this issue may occur is when names of import library and =
the DLL are different on purpose. For example, winpthreads install two impo=
rt libraries pthread[.dll].lib and winpthread[.dll].lib, both linking to wi=
npthread-1.dll. Using pthread.lib
is impossible with libtool, unless you create a link or a copy named pthre=
ad*.dll.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
- Kirill Makurin</div>
</body>
</html>
--_000_LV5PR05MB998298210AAF1E700434DF1D84B185ALV5PR05MB998298_--