nats-io / nats.c

A C client for NATS
Apache License 2.0
382 stars 132 forks source link

Support linking with MinGW toolchains on Linux #763

Closed XJ-0461 closed 1 month ago

XJ-0461 commented 2 months ago

In the top level CMakeLists file, the line: set(NATS_EXTRA_LIB "Ws2_32")

Causes linker errors when cross-compiling cnats to Windows under Linux using the mingw toolchains. Because of the uppercase 'W'.

/usr/lib/gcc/x86_64-w64-mingw32/14.1.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lWs2_32: No such file or directory

On linux libraries are case-sensitive, and can be found (depending on your toolchain choice) at:

On Windows case-sensitivity is not a problem, so changing to lowercase "ws2_32" is fine.

XJ-0461 commented 2 months ago

@mtmk @levb. If you (or someone you know) could check this out I'd appreciate it.