Subject: bug#78701: closed (Re: bug#78701: Undeclared reference to access on Windows)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 06 Jun 2025 17:49:02 +0000

Your bug report

#78701: Undeclared reference to access on Windows

which was filed against the libtool package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78701: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78701
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78701: Undeclared reference to access on Windows
From: Ileana Dumitrescu <[email-masked]>
To: [email-masked]
Cc: Kirill Makurin <[email-masked]>
Date: Fri, 6 Jun 2025 20:47:51 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

On 05/06/2025 19:22, Kirill Makurin wrote:
> Building libltdl on Windows using clang-cl.exe fails with the following 
> diagnostic:
> 
> ```
> 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        = 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 (MSVC/mingw), access is declared in io.h, which is not 
> included. (On mingw, it could be indirectly included from
> other header files.)
> 
> A solution would be to add
> 
> ```
> #if defined (_WIN32) && !defined (__CYGWIN__)
> #include <io.h>
> #endif
> ```
> 
> on top of libltdl/ltdl.c.

Thank you for the bug report and suggested patch! I have applied the
change to ltdl.h, and it is on the development branch [1].

[1] 
https://cgit.git.savannah.gnu.org/cgit/libtool.git/commit/?h=development&id=a26932a36ecb2c3013be0c1e7fdbf2eb9062e845

-- 
Ileana Dumitrescu

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

Subject: Undeclared reference to access on Windows
From: Kirill Makurin <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Thu, 5 Jun 2025 16:22:42 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Building libltdl on Windows using clang-cl.exe fails with the following diagnostic:

```
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        = 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 (MSVC/mingw), access is declared in io.h, which is not included. (On mingw, it could be indirectly included from
other header files.)

A solution would be to add

```
#if defined (_WIN32) && !defined (__CYGWIN__)
#include <io.h>
#endif
```

on top of libltdl/ltdl.c.

- Kirill Makurin