drogonframework / drogon

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

Usage of external spdlog library cause a compilation error when using system calls #2060

Open iscapla opened 2 weeks ago

iscapla commented 2 weeks ago

Describe the bug A Drogon project does not compile when spdlog and fmt libraries are already installed on the project when the compilation commands are executed using MINGW32 for Windows 11. After a little investigation, I cannot say that this behavior is an error introduced by Drogon because I may have forgotten something in the CMakefiles of the project to configure system libraries to define the UNICODE version of the access functions. The issue may be solve if os_access definition points to the _waccess system (from io.h) call but I couldn't find the way to enable it on the project.

To add more information about how the project is configured:

To Reproduce Steps to reproduce the behavior:

  1. Clone and build the project:
    
    git clone https://github.com/iscapla/drogon_spdlog.git
    cd drogon_spdlog
    mkdir build

cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\g++.exe -S. -B./build -G "MinGW Makefiles"

cmake --build ./build --config Debug --target all -j 22 --

2. See errors:
```bash
drogon_spdlog\build\_deps\drogon-src\lib\src\AccessLogger.cc:143:55: error: cannot convert 'const wchar_t*' to 'const char*'
  143 |                 if (os_access(fsLogPath.native().c_str(), W_OK) != 0)

drogon_spdlog\build\_deps\drogon-src\lib\src\HttpAppFrameworkImpl.cc:1087:55: error: cannot convert 'const wchar_t*' to 'const char*'
 1087 |                 if (os_access(fsLogPath.native().c_str(), W_OK) != 0)

Expected behavior A successful compilation.

Screenshots N/A

Desktop (please complete the following information):

Binaries uses the msys64\ucrt64 versions.

Smartphone (please complete the following information): N/A

Additional context N/A