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

Build failure with mingw #827

Open
star-hengxing opened this issue Dec 15, 2024 · 1 comment · May be fixed by #828
Open

Build failure with mingw #827

star-hengxing opened this issue Dec 15, 2024 · 1 comment · May be fixed by #828
Labels
defect Suspected defect such as a bug or regression

Comments

@star-hengxing
Copy link

star-hengxing commented Dec 15, 2024

Observed behavior

x86_64-w64-mingw32-gcc: error: /W4: linker input file not found: No such file or directory
x86_64-w64-mingw32-gcc: warning: /wd4100: linker input file unused because linking not done
x86_64-w64-mingw32-gcc: error: /wd4100: linker input file not found: No such file or directory
x86_64-w64-mingw32-gcc: warning: /wd4200: linker input file unused because linking not done
x86_64-w64-mingw32-gcc: error: /wd4200: linker input file not found: No such file or directory
x86_64-w64-mingw32-gcc: warning: /wd4130: linker input file unused because linking not done
x86_64-w64-mingw32-gcc: error: /wd4130: linker input file not found: No such file or directory
x86_64-w64-mingw32-gcc: warning: /wd4127: linker input file unused because linking not done
x86_64-w64-mingw32-gcc: error: /wd4127: linker input file not found: No such file or directory
make[2]: *** [src/CMakeFiles/nats.dir/asynccb.c.obj] Error 1
make[2]: *** Deleting file `src/CMakeFiles/nats.dir/asynccb.c.obj'
make[2]: *** Waiting for unfinished jobs....

These compile flags can only be used with MSVC.

nats.c/CMakeLists.txt

Lines 210 to 215 in 7b5d3d7

# Warning control.
add_compile_options(/W4) # Set warning level to maximum, then disable:
add_compile_options(/wd4100) # unreferenced formal parameter
add_compile_options(/wd4200) # nonstandard extension used: zero-sized array in struct/union
add_compile_options(/wd4130) # logical operation on address of string constant
add_compile_options(/wd4127) # conditional expression is constant

Expected behavior

Work.

Server and client version

tag: v3.9.2

Host environment

No response

Steps to reproduce

No response

@star-hengxing star-hengxing added the defect Suspected defect such as a bug or regression label Dec 15, 2024
@mtmk
Copy link
Contributor

mtmk commented Dec 16, 2024

thanks for the report @star-hengxing

just trying it myself I can confirm I see the exact same errors (using clion with mingw or w64devkit on Windows 11 pro):

$ cmake -B build -S . -G "MinGW Makefiles" -DNATS_BUILD_WITH_TLS=OFF -DNATS_BUILD_STREAMING=OFF
$ cmake --build build

this fix I used seems to have the roughly equivalent flags for gcc:

  if(MSVC)
    add_compile_options(/W4 /wd4100 /wd4200 /wd4130 /wd4127)
  else()
    add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pedantic -Wno-address -Wno-constant-conditional)
  endif()

kozlovic added a commit that referenced this issue Dec 19, 2024
Credit goes to @mtmk with the proposed fix and verification that it
works on mingw.

I have verified that the change still works when building on my Windows
VM, so I don't expect windows users to have any issue with that.

Resolves #827

Signed-off-by: Ivan Kozlovic <[email protected]>
@kozlovic kozlovic linked a pull request Dec 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants