Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: Link gcc helpers statically on MinGW #1068

Closed
wants to merge 1 commit into from

Conversation

tormodvolden
Copy link
Contributor

This has been tested to do what it should, only add -static-libgcc to the linker flags when building the final libusb.dll on MinGW. There are however an infinite number of ways to do this with autoconf, so style and consistency could be reviewed. I am adding EXTRA_LDFLAGS instead of using (abusing?) LT_LDFLAGS which I suspect is used for non-libtool flags some other places. OTOH for instance EXTRA_CFLAGS is only used locally in configure.ac and put into AM_CFLAGS directly. I am not using AM_LDFLAGS if that is a thing, and I think that is fine since the extra flag should only be applied to the DLL linking. Maybe a more specific variable name could be used.

Fixes libusb#1049

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
@mcuee
Copy link
Member

mcuee commented Feb 11, 2022

Test results with MSYS2 32bit and 64bit compiler:

/mingw32/bin
$ objdump -x libusb-1.0.dll | grep DLL
        DLL
 vma:            Hint    Time      Forward  DLL       First
        DLL Name: KERNEL32.dll
        DLL Name: msvcrt.dll

/mingw64/bin
$  objdump -x libusb-1.0.dll | grep DLL
        DLL
 vma:            Hint    Time      Forward  DLL       First
        DLL Name: KERNEL32.dll
        DLL Name: msvcrt.dll

@mcuee mcuee removed the request for review from dickens February 11, 2022 04:14
@mcuee mcuee removed the request for review from hjelmn March 1, 2022 05:52
@mcuee
Copy link
Member

mcuee commented Mar 1, 2022

I think this is safe to be merged.

@tormodvolden
Copy link
Contributor Author

Yes, I was not worried about it not working, but I hoped a autoconf stylist could chime in.

@tormodvolden
Copy link
Contributor Author

Merged in commit f9162d3

@tormodvolden tormodvolden deleted the mingw_static_libgcc branch March 16, 2022 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MinGW 32-bit build requires -static-libgcc to avoid DLL migraine
2 participants