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

Failed to build on MSYS2 MINGW64 #113

Open
ghost opened this issue Apr 24, 2023 · 4 comments
Open

Failed to build on MSYS2 MINGW64 #113

ghost opened this issue Apr 24, 2023 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 24, 2023

FAILED: CMakeFiles/c-ray.dir/src/c-ray.c.obj
C:\msys64\mingw64\bin\cc.exe -DCRAY_SDL_ENABLED -IC:/msys64/home/Administrator/c-ray/src -IC:/msys64/home/Administrator/c-ray/tests -IC:/msys64/mingw64/include/SDL2 -Wall -Wextra -Wno-missing-field-initializers -std=gnu99 -D_GNU_SOURCE -O2 -ftree-vectorize -g -flto=auto -fno-fat-lto-objects -MD -MT CMakeFiles/c-ray.dir/src/c-ray.c.obj -MF CMakeFiles\c-ray.dir\src\c-ray.c.obj.d -o CMakeFiles/c-ray.dir/src/c-ray.c.obj -c C:/msys64/home/Administrator/c-ray/src/c-ray.c
In file included from C:/msys64/home/Administrator/c-ray/src/c-ray.c:30:
C:/msys64/home/Administrator/c-ray/src/utils/protocol/server.h:12:10: fatal error: arpa/inet.h: No such file or directory
   12 | #include <arpa/inet.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
@vkoskiv
Copy link
Owner

vkoskiv commented Apr 25, 2023

Hey, thanks for reporting. Currently, the network protocol is not supported on Windows, as it assumes a Berkeley sockets style API.
I'm guarding the network code with a simple #ifndef WINDOWS. Reworking these guards is needed to get it building on MINGW environments.
I don't have a MINGW environment available, but the included instructions in the README on how to build natively on Windows should still work.

@ghost
Copy link
Author

ghost commented Apr 26, 2023

Hey, thanks for reporting. Currently, the network protocol is not supported on Windows, as it assumes a Berkeley sockets style API. I'm guarding the network code with a simple #ifndef WINDOWS. Reworking these guards is needed to get it building on MINGW environments. I don't have a MINGW environment available, but the included instructions in the README on how to build natively on Windows should still work.

Shouldn't it be #ifndef _WIN32? Your usage of #ifndef WINDOWS is wrong. This is the reason why <arpa/inet.h> is still included.

@ghost
Copy link
Author

ghost commented May 19, 2023

Oh I see, -DWINDOWS is added by you on your CMakeLists.txt. @vkoskiv What about replacing #ifndef WINDOWS in code with #ifndef _WIN32 so you will not need to define -DWINDOWS on CMakeLists.txt? Btw, please have a look at your CMakeLists.txt and add support for MinGW compiler. You could use if (MinGW) to check for MinGW on CMake. Currently you only check for MSVC so -DWINDOWS is not defined when building with MSYS2.

@vkoskiv
Copy link
Owner

vkoskiv commented May 29, 2023

Btw, please have a look at your CMakeLists.txt and add support for MinGW compiler.

I personally don't have a need for MinGW support, nor a test environment to implement that support, but I'd be happy to merge in those changes if someone else works on it.

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

No branches or pull requests

1 participant