drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

There's a bug in building MSYS2 #1901

Closed 321qwedsa000 closed 8 months ago

321qwedsa000 commented 8 months ago

Notice If you need support or clarification regarding the usage of Drogon in your project, visit the official Drogon support channel at gitter

Please create a new issue only if you think you have found a bug or if have a feature request/enhancement.

Describe the bug 416076764_1029918978303935_847687124198468128_n Here's the picture about the bug occur.

Desktop (please complete the following information):

prm-james-hill commented 8 months ago

Think this was fixed 5 days ago in https://github.com/drogonframework/drogon/commit/5ecbd1f1847b8c3611ccbad8e4d6586446651ff2 . Just not in a release yet

antores commented 8 months ago

Think this was fixed 5 days ago in 5ecbd1f . Just not in a release yet

No, that solves exactly opposite problem of redefinition of the functions. Probably different MSYS2 environment setup leads to this.

@321qwedsa000 , could you please check if drogon successfully builds in your environment if you remove #ifndef _WIN32 guard in orm_lib/inc/drogon/orm/SqlBinder.h (lines 74, 84), as was introduced in https://github.com/drogonframework/drogon/commit/5ecbd1f1847b8c3611ccbad8e4d6586446651ff2 ?

antores commented 8 months ago

I was able to reproduce this on a clean install on another computer with Windows 11 and fresh MSYS2/clang64. It seems the source of the problem is in the combination of: 1) winsock2.h has #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 around htonll and ntohll; 2) trantor's CMakeLists.txt explicitly and unconditionally sets -D_WIN32_WINNT=0x0601 (not sure if that's a good practice). _WIN32_WINNT_WIN8 is a 0x0602, so trantor's CMakeLists.txt implicilty disables htonll and ntohll. As a temporary workaround you can add -DCMAKE_CXX_FLAGS="-D_WIN32_WINNT=0x0A00" when configuring cmake. There will be many warnings '_WIN32_WINNT' macro redefined, but it builds successfully.

marty1885 commented 8 months ago

The underlying issue is resolved. Closing. Thanks @antores