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

Compilation for Windows broken #135

Open
RivenSkaye opened this issue Jan 30, 2023 · 1 comment
Open

Compilation for Windows broken #135

RivenSkaye opened this issue Jan 30, 2023 · 1 comment

Comments

@RivenSkaye
Copy link

Due to commit this commit adding two setenv calls, compilation under Windows through MSYS2 is currently broken. GCC asks if the user meant getenv, but on Windows it seems the correct call is putenv, which only takes a single string in the format "KEY=VALUE".
Error:

FAILED: src/common/CMakeFiles/common.dir/config.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DGBE_GLEW -DGBE_NETPLAY -DGBE_OGL -DGBE_QT_5 -IC:/msys64/mingw64/include/SDL2 -IC:/msys64/home/Riven/Projects/gbe-plus/src/. -O3 -funroll-loops
 -Wno-error -Wno-narrowing -std=c++17 -MD -MT src/common/CMakeFiles/common.dir/config.cpp.obj -MF src\common\CMakeFiles\common.dir\config.cpp.obj.d -o src/common/CMakeFiles/c
ommon.dir/config.cpp.obj -c C:/msys64/home/Riven/Projects/gbe-plus/src/common/config.cpp
C:/msys64/home/Riven/Projects/gbe-plus/src/common/config.cpp: In function 'bool parse_cli_args()':
C:/msys64/home/Riven/Projects/gbe-plus/src/common/config.cpp:793:41: error: 'setenv' was not declared in this scope; did you mean 'getenv'?
  793 |                                         setenv("SDL_AUDIODRIVER", config::override_audio_driver.c_str(), 1);
      |                                         ^~~~~~
      |                                         getenv
C:/msys64/home/Riven/Projects/gbe-plus/src/common/config.cpp: In function 'bool parse_ini_file()':
C:/msys64/home/Riven/Projects/gbe-plus/src/common/config.cpp:1848:41: error: 'setenv' was not declared in this scope; did you mean 'getenv'?
 1848 |                                         setenv("SDL_AUDIODRIVER", config::override_audio_driver.c_str(), 1);
      |                                         ^~~~~~
      |                                         getenv

Mangling that so it works:tm: proceeds to cause issues from src/gba/am3.cpp, in regards to a conversion from a filesystem path to a string. I can't seem to find the commit causing this one:

FAILED: src/gba/CMakeFiles/gba.dir/am3.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DGBE_GLEW -DGBE_NETPLAY -DGBE_OGL -DGBE_QT_5 -IC:/msys64/mingw64/include/SDL2 -IC:/msys64/home/Riven/Projects/gbe-plus/src/. -O3 -funroll-loops
 -Wno-error -Wno-narrowing -std=c++17 -MD -MT src/gba/CMakeFiles/gba.dir/am3.cpp.obj -MF src\gba\CMakeFiles\gba.dir\am3.cpp.obj.d -o src/gba/CMakeFiles/gba.dir/am3.cpp.obj -c
 C:/msys64/home/Riven/Projects/gbe-plus/src/gba/am3.cpp
C:/msys64/home/Riven/Projects/gbe-plus/src/gba/am3.cpp: In member function 'bool AGB_MMU::am3_load_folder(std::string)':
C:/msys64/home/Riven/Projects/gbe-plus/src/gba/am3.cpp:414:52: error: conversion from 'const std::filesystem::__cxx11::path' to non-scalar type 'std::string' {aka 'std::__cxx
11::basic_string<char>'} requested
  414 |                 std::string f_name = fs_files->path();
      |                                      ~~~~~~~~~~~~~~^~
C:/msys64/home/Riven/Projects/gbe-plus/src/gba/am3.cpp:415:63: error: conversion from 'std::filesystem::__cxx11::path' to non-scalar type 'std::string' {aka 'std::__cxx11::ba
sic_string<char>'} requested
if (USE_OGL)
  415 |                 std::string s_name = fs_files->path().filename();
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~
@RivenSkaye
Copy link
Author

Okay so I retried building it considering I had some spare time. Still on a Windows 10/MSYS2 environment, using the MinGW64 shell env. Required some additional package installation and I ended up getting this combination to work:

# Group them by package family, sort of.
# Yes, the Qt selection there is the rather bloated full qt5 collection package. The README does not
# list which components are actually used or required for the GUI.
pacman -Sy mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2_{gfx,image,mixer,net,sound,ttf} mingw-w64-x86_64-{gles-headers,ftgl} mingw-w64-x86_64-glfw mingw-w64-x86_64-angleproject mingw-w64-x86_64-qt5
git clone https://github.com/shonumi/gbe-plus.git
cd gbe-plus
cmake -S . -B ./build
cmake --build build
# Wait for the install to finish and you can find the full thing as ./build/src/qt/gbe_plus_qt.exe

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