Skip to content

Build fails on Windows (MinGW-w64 / UCRT64): undefined reference to __imp___iob_func in bundled libpng.a #7

@leo-rodriguez-simspace

Description

@leo-rodriguez-simspace

I am encountering linker errors when trying to build a project using this package on Windows via MSYS2 (using the modern UCRT64 environment).

The build fails because the bundled static library (cdeps/win/amd/win64/libpng.a) appears to have been compiled with an older toolchain (likely targeting the legacy msvcrt.dll or an old MSVC version) which is binary-incompatible with modern MinGW toolchains that use ucrtbase.dll.

Steps to Reproduce
On Windows, set up a standard MSYS2 environment (UCRT64).

Install Go and libpng via pacman:

pacman -S mingw-w64-x86_64-go mingw-w64-x86_64-libpng
Import this package and run go build.

Error Log
The linker fails with references to deprecated symbols__imp___iob_funcand _setjmp:

# github.com/vcaesar/bitmap
C:/Users/.../go/pkg/mod/github.com/vcaesar/bitmap@v0.12.2/cdeps/win/amd/win64/libpng.a(pngerror.o):pngerror.c:(.text+0x353): undefined reference to `__imp___iob_func'
C:/Users/.../go/pkg/mod/github.com/vcaesar/bitmap@v0.12.2/cdeps/win/amd/win64/libpng.a(pngerror.o):pngerror.c:(.text+0x661): undefined reference to `__imp___iob_func'
C:/Users/.../go/pkg/mod/github.com/vcaesar/bitmap@v0.12.2/cdeps/win/amd/win64/libpng.a(pngread.o):pngread.c:(.text+0x99): undefined reference to `_setjmp'

Because libpng.a is a static binary committed to the repo, it forces the linker to look for these non-existent symbols, ignoring the correct libpng I installed via pacman.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions