bug#78682: Building libltdl with MSVC fails

Kirill Makurin <[email protected]> Thu, 5 Jun 2025 09:13:34 +0000
Newsgroups gmane.comp.gnu.libtool.bugs
Message-ID <DM4PR84MB137316AD20AF95EDFD943EFEB16FA@DM4PR84MB1373.NAMPRD84.PROD.OUTLOOK.COM>
--_000_DM4PR84MB137316AD20AF95EDFD943EFEB16FADM4PR84MB1373NAMP_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ileana,

I tried building from development branch and it has the same issue.

Out of curiosity I also tried to use clang-cl.exe (this is a clang which un=
derstands many of cl.exe's options), and I see the following:

```
H:/git/libtool/libltdl/ltdl.c(781,19): error: call to undeclared function '=
access'; ISO C99 and later do not support implicit function declarations [-=
Wimplicit-function-declaration]
781 |   int           notfound        =3D access (filename, R_OK);
         |                                                  ^
H:/git/libtool/libltdl/ltdl.c(781,19): note: did you mean 'accept'?
C:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um\winsock.h(=
739,19): note: 'accept' declared here
  739 | SOCKET PASCAL FAR accept (
           |                                               ^
```

On native Windows (mingw/MSVC), `access` function is declared in io.h. You =
may use the following condition to recognize native Windows:

```
#if defined (_WIN32) && !defined (__CYGWIN__)
#endif
```

- Kirill Makurin

________________________________
From: Ileana Dumitrescu
Sent: Thursday, June 5, 2025 12:13 AM
To: [email protected]
Cc: Kirill Makurin
Subject: Re: bug#78682: Building libltdl with MSVC fails

On 03/06/2025 17:29, Kirill Makurin wrote:
> Hi,

Hi!

>
> Building libltdl with MSVC fails:
>
> ```
> libltdl_la-ltdl.obj : error LNK2019: unresolved external symbol
> lt_ltdl_LTX_preloaded_symbols referenced in function lt_dlinit
> libltdl\.libs\libltdl-7.dll : fatal error LNK1120: 1 unresolved externals
> ```
>
> I attached full invocation in separate file since it's quite messy.
>
> I did some investigation.
>
> Apparently, `lt_ltdl_LTX_preloaded_symbols` is supposed to be defined in
> libtool-generated `libltdl/.libs/libltdlS.c`, however it defines
> `lt_libltdl_LTX_preloaded_symbols` instead, as if it was mingw build.
>
> I was building from libtool-2.5.4 release tarball. I tried building from
> `master` and the issue also exist there.

Most if not all MSVC-related fixes are in the 'development' branch for
review and testing before I migrate them to master. Would you try
building libltdl with MSVC using development source code?

> Thank you for working on MSVC-related issues. I have some other things
> to report/suggest.

Thank you for your detailed bug reports!

--
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354


--_000_DM4PR84MB137316AD20AF95EDFD943EFEB16FADM4PR84MB1373NAMP_
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);">
Hi Ileana,</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 tried building from development branch and it has the same issue.</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);">
Out of curiosity I also tried to use clang-cl.exe (this is a clang which un=
derstands many of cl.exe's options), and I see the following:</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);">
H:/git/libtool/libltdl/ltdl.c(781,19): error: call to undeclared function '=
access'; ISO C99 and later do not support implicit function declarations [-=
Wimplicit-function-declaration]</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);">
781 | &nbsp; int &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notfound &nbsp; &nbsp; =
&nbsp; &nbsp;=3D access (filename, R_OK);</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);">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</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);">
H:/git/libtool/libltdl/ltdl.c(781,19): note: did you mean 'accept'?</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);">
C:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um\winsock.h(=
739,19): note: 'accept' declared here</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);">
&nbsp; 739 | SOCKET PASCAL FAR accept (</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);">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^&nbsp; &nbsp;&n=
bsp;</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 id=3D"appendonsend"></div>
<div class=3D"elementToProof"><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);">
On native Windows (mingw/MSVC), `access` function is declared in io.h. You =
may use the following condition to recognize native Windows:</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);">
#if defined (_WIN32) &amp;&amp; !defined (__CYGWIN__)</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);">
#endif</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);">
- Kirill Makurin</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style=3D"display: inline-block; width: 98%;">
<div class=3D"elementToProof" style=3D"font-family: Calibri, Arial, Helveti=
ca, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>From:</b>&nbsp;Ileana Dumitrescu<br>
<b>Sent:</b>&nbsp;Thursday, June 5, 2025 12:13 AM<br>
<b>To:</b>&nbsp;[email protected]<br>
<b>Cc:</b>&nbsp;Kirill Makurin<br>
<b>Subject:</b>&nbsp;Re: bug#78682: Building libltdl with MSVC fails </div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-size: 11pt;">On 03/06/2025 17:29, Kirill Makurin wrote:<=
br>
&gt; Hi,<br>
<br>
Hi!<br>
<br>
&gt;<br>
&gt; Building libltdl&nbsp;with MSVC fails:<br>
&gt;<br>
&gt; ```<br>
&gt; libltdl_la-ltdl.obj&nbsp;: error LNK2019: unresolved external symbol<b=
r>
&gt; lt_ltdl_LTX_preloaded_symbols referenced in function lt_dlinit<br>
&gt; libltdl\.libs\libltdl-7.dll : fatal error LNK1120: 1&nbsp;unresolved e=
xternals<br>
&gt; ```<br>
&gt;<br>
&gt; I attached full invocation in separate file since it's quite messy.<br=
>
&gt;<br>
&gt; I did some investigation.<br>
&gt;<br>
&gt; Apparently, `lt_ltdl_LTX_preloaded_symbols` is supposed to be defined =
in<br>
&gt; libtool-generated `libltdl/.libs/libltdlS.c`, however it defines<br>
&gt; `lt_libltdl_LTX_preloaded_symbols` instead, as if it was mingw build.<=
br>
&gt;<br>
&gt; I was building from libtool-2.5.4 release tarball. I tried building fr=
om<br>
&gt; `master` and the issue also exist there.<br>
<br>
Most if not all MSVC-related fixes are in the 'development' branch for<br>
review and testing before I migrate them to master. Would you try<br>
building libltdl with MSVC using development source code?<br>
<br>
&gt; Thank you for working on MSVC-related issues. I have some other things=
<br>
&gt; to report/suggest.<br>
<br>
Thank you for your detailed bug reports!<br>
<br>
--<br>
Ileana Dumitrescu<br>
<br>
GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354<br>
<br>
</div>
</body>
</html>

--_000_DM4PR84MB137316AD20AF95EDFD943EFEB16FADM4PR84MB1373NAMP_--