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

Support linking with MinGW toolchains on Linux #763

Merged
merged 3 commits into from
Jul 15, 2024

Conversation

XJ-0461
Copy link
Contributor

@XJ-0461 XJ-0461 commented Jun 12, 2024

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:

  • /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libws2_32.a
  • /usr/i686-w64-mingw32/sys-root/mingw/lib/libws2_32.a
  • /usr/x86_64-w64-mingw32ucrt/sys-root/mingw/lib/libws2_32.a

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

@XJ-0461
Copy link
Contributor Author

XJ-0461 commented Jun 14, 2024

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

Copy link
Contributor

@mtmk mtmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @XJ-0461. I can confirm it's an issue on Linux mingw build and this PR fixes it. Also, Windows build isn't affected.

LGTM

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@levb levb merged commit a489234 into nats-io:main Jul 15, 2024
9 checks passed
levb added a commit that referenced this pull request Oct 1, 2024
@levb levb removed the cherry-pick label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants