You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows MinGW linking fails with undefined reference to __imp__vsnprintf_s and _setjmp
Environment
OS: Windows 11
Go Version: go version go1.23.5 windows/amd64
confluent-kafka-go Version: v1.9.2
Compiler: MinGW-W64 x86_64-ucrt-posix-seh 12.2.0
Works on: WSL/Linux
Fails on: Windows with MinGW
Problem Description
The library fails to link on Windows when using MinGW-W64 GCC due to MSVC-specific runtime function dependencies in the bundled librdkafka_windows.a.
Error Output
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:/Users/SHAKIR/go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/librdkafka_vendor/librdkafka_windows.a(rdkafka_error.c.obj):(.text+0x8e):
undefined reference to `__imp__vsnprintf_s'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:/Users/SHAKIR/go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/librdkafka_vendor/librdkafka_windows.a(regexp.c.obj):(.text+0x29fa):
undefined reference to `_setjmp'
Root Cause Analysis
The bundled librdkafka_windows.a was compiled with MSVC and depends on:
These symbols are not available in MinGW's C runtime library.
Reproduction Steps
Install MinGW-W64 on Windows
Create any Go project using confluent-kafka-go
Run go run main.go or go build
Observe linking errors
Expected Behavior
The library should work with MinGW on Windows, just as it does on WSL/Linux.
Suggested Solutions
Provide MinGW-compiled librdkafka: Bundle a version compiled with MinGW
Build instructions: Provide clear instructions for building librdkafka with MinGW
Documentation: Document MSVC requirement or provide alternatives
CI/CD: Add MinGW testing to prevent regressions
Workarounds
Users currently need to:
Use WSL/Linux
Install Visual Studio Build Tools
Switch to pure Go libraries like segmentio/kafka-go
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Windows MinGW linking fails with undefined reference to __imp__vsnprintf_s and _setjmp
Environment
OS: Windows 11
Go Version: go version go1.23.5 windows/amd64
confluent-kafka-go Version: v1.9.2
Compiler: MinGW-W64 x86_64-ucrt-posix-seh 12.2.0
Works on: WSL/Linux
Fails on: Windows with MinGW
Problem Description
The library fails to link on Windows when using MinGW-W64 GCC due to MSVC-specific runtime function dependencies in the bundled librdkafka_windows.a.
Error Output
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:/Users/SHAKIR/go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/librdkafka_vendor/librdkafka_windows.a(rdkafka_error.c.obj):(.text+0x8e):
undefined reference to `__imp__vsnprintf_s'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:/Users/SHAKIR/go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/librdkafka_vendor/librdkafka_windows.a(regexp.c.obj):(.text+0x29fa):
undefined reference to `_setjmp'
Root Cause Analysis
The bundled librdkafka_windows.a was compiled with MSVC and depends on:
__imp__vsnprintf_s - Microsoft-specific secure string function
_setjmp - MSVC-specific setjmp implementation
These symbols are not available in MinGW's C runtime library.
Reproduction Steps
Install MinGW-W64 on Windows
Create any Go project using confluent-kafka-go
Run go run main.go or go build
Observe linking errors
Expected Behavior
The library should work with MinGW on Windows, just as it does on WSL/Linux.
Suggested Solutions
Provide MinGW-compiled librdkafka: Bundle a version compiled with MinGW
Build instructions: Provide clear instructions for building librdkafka with MinGW
Documentation: Document MSVC requirement or provide alternatives
CI/CD: Add MinGW testing to prevent regressions
Workarounds
Users currently need to:
Use WSL/Linux
Install Visual Studio Build Tools
Switch to pure Go libraries like segmentio/kafka-go
Beta Was this translation helpful? Give feedback.
All reactions