Skip to content

Error: Missing libgcc_s_dw2-1.dll in MINGW32 Environment #19

@resistance-shimako

Description

@resistance-shimako

An Issue That Occurred

Error libgcc_s_dw2-1.dll missing in a program that dynamically links and executes the built libserialport-0.dll

PC Environment

  • Build Environment: MSYS2 MINGW32 on Windows 10 Home 64Bit 22H2
  • MSYS2 Version: msys2-x86_64-20240727
  • Note: This issue does not occur in programs built in the MSYS2 MINGW64 environment. It only occurs in programs built in the MSYS2 MINGW32 environment.

Solution

Rewriting Makefile.am and giving the -static-libgcc option solved the problem.

Specifically, rewrite the following

@@ -27,6 +27,9 @@ AM_CFLAGS = -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow
 # Set flag used in libserialport.h to indicate we are building the library
 # using autotools.
 AM_CFLAGS += -DLIBSERIALPORT_ATBUILD
+if WIN32
+AM_CFLAGS += -static-libgcc
+endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions