What do you think if we just guard those rules for `libptrhead[.dll].a` with 
`if !MSVC`?

Libtool has a silly behavior with MSVC tools. When you create a shared library 
which depends on another (non-libtool) shared library, when it handles 
`-l{name}` it searches PATH for file `{name}*.dll` (not even `lib{name}*.dll` 
as it seems) and it will refuse to create shared library if there is no such 
file. This means that having import library alone will not be sufficient and it 
also seems like it doesn't even consider static libraries. It gave lots of 
headache to me.

If people who build winpthreads with MSVC want to use it with Autotools 
projects they can create hard links like this:

pthread.dll.lib -> winpthreads.dll.lib
pthread.lib -> winpthreads.lib
pthread.dll -> winpthread-{VERSION}.dll

I mentioned in another thread that I have a `meson.build` for winpthreads and 
also think to write CMake infrastructure for it, and I want to upload it with a 
copy of winpthreads to GitHub. I think it is a much better way to build 
winpthreads with MSVC.

Maybe it would even worth to remove support for MSVC tools from winpthreads' 
`configure.ac` and `Makefile.am`?

- Kirill Makurin

________________________________
From: LIU Hao
Sent: Saturday, February 15, 2025 11:36 PM
To: Kirill Makurin; mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] make sure WINPTHREAD_API is correctly defined 
in pthread_time.h

在 2025-02-10 15:31, Kirill Makurin 写道:
> It seems defining variables like `{libname}_AR` has no effect if {libname} is 
> defined as
> `LTLIBRARIES` target, libtool script just used AR set during configuration. 
> This method works only
> with `LIBRARIES` targets.
>
> The best I could achieve with `LTLIBRARIES = libpthread.la` is to record 
> dependency on
> winpthreads.la in pthread.la.
>
> I tried to experiment with libtool's --mode=execute hoping it would 
> substitute .la with a library
> filename, but --mode=execute works only with executables.

I'm out of ideas about libtool now. Although I don't quite like the proposed 
patch as it seems
over-complicated, if there's no other solution, it may be acceptable.



--
Best regards,
LIU Hao

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to