Skip to content

Errors attempting to build on Windows (with and without WSL) #396

@pineapplemachine

Description

@pineapplemachine

I followed the instructions here to try to compile NBA but I ran into errors: https://github.com/nba-emu/NanoBoyAdvance/blob/master/docs/COMPILING.md

First I tried to build using the Windows instructions. I started by installing the msys packages as indicated:

Sophie@Skynet-22 MSYS ~
$ pacman -S make mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-python-jinja mingw-w64-x86_64-python-lxml mingw-w64-x86_64-SDL2 mingw-w64-x86_64-qt5-static
resolving dependencies...
looking for conflicting packages...

Packages (14) mingw-w64-x86_64-gcc-libs-13.2.0-2  mingw-w64-x86_64-libxslt-1.1.38-1
              mingw-w64-x86_64-ninja-1.11.1-3  mingw-w64-x86_64-python-markupsafe-2.1.3-2
              mingw-w64-x86_64-vulkan-headers-1.3.261-1  mingw-w64-x86_64-vulkan-loader-1.3.261-1
              mingw-w64-x86_64-z3-4.12.1-2  make-4.4.1-1  mingw-w64-x86_64-SDL2-2.28.3-1
              mingw-w64-x86_64-cmake-3.27.4-2  mingw-w64-x86_64-gcc-13.2.0-2
              mingw-w64-x86_64-python-jinja-3.1.2-7  mingw-w64-x86_64-python-lxml-4.9.3-1
              mingw-w64-x86_64-qt5-static-5.15.10-2

Total Download Size:    218.67 MiB
Total Installed Size:  1351.15 MiB
Net Upgrade Size:      1074.84 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 mingw-w64-x86_64-SDL2-2.28...  1443.6 KiB   779 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-python-lx...  1229.7 KiB  1278 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-vulkan-he...  1129.1 KiB   388 KiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-gcc-libs-...   965.0 KiB   424 KiB/s 00:02 [###############################] 100%
 make-4.4.1-1-x86_64             505.9 KiB   371 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-ninja-1.1...   457.3 KiB   424 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-libxslt-1...   364.1 KiB   123 KiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-python-ji...   294.9 KiB   456 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-vulkan-lo...   161.8 KiB   302 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-python-ma...    24.4 KiB  50.1 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-gcc-13.2....    28.8 MiB  1690 KiB/s 00:17 [###############################] 100%
 mingw-w64-x86_64-cmake-3.2...     8.2 MiB   477 KiB/s 00:18 [###############################] 100%
 mingw-w64-x86_64-z3-4.12.1...    20.2 MiB   759 KiB/s 00:27 [###############################] 100%
 mingw-w64-x86_64-qt5-stati...   155.0 MiB  3.41 MiB/s 00:45 [###############################] 100%
 Total (14/14)                   218.7 MiB  4.80 MiB/s 00:46 [###############################] 100%
(14/14) checking keys in keyring                             [###############################] 100%
(14/14) checking package integrity                           [###############################] 100%
(14/14) loading package files                                [###############################] 100%
ls3/14) checking for file conflicts                          [############################---]  92%
(14/14) checking for file conflicts                          [###############################] 100%
(14/14) checking available disk space                        [###############################] 100%
:: Processing package changes...
( 1/14) upgrading make                                       [###############################] 100%
( 2/14) upgrading mingw-w64-x86_64-gcc-libs                  [###############################] 100%
( 3/14) upgrading mingw-w64-x86_64-gcc                       [###############################] 100%
( 4/14) installing mingw-w64-x86_64-ninja                    [###############################] 100%
( 5/14) upgrading mingw-w64-x86_64-cmake                     [###############################] 100%
( 6/14) installing mingw-w64-x86_64-python-markupsafe        [###############################] 100%
( 7/14) installing mingw-w64-x86_64-python-jinja             [###############################] 100%
( 8/14) installing mingw-w64-x86_64-libxslt                  [###############################] 100%
( 9/14) installing mingw-w64-x86_64-python-lxml              [###############################] 100%
Optional dependencies for mingw-w64-x86_64-python-lxml
    mingw-w64-x86_64-python-beautifulsoup4: support for parsing not well formed HTML
    mingw-w64-x86_64-python-cssselect: support for cssselect
    mingw-w64-x86_64-python-html5lib: support for html5lib parser
(10/14) installing mingw-w64-x86_64-vulkan-headers           [###############################] 100%
(11/14) installing mingw-w64-x86_64-vulkan-loader            [###############################] 100%
(12/14) installing mingw-w64-x86_64-SDL2                     [###############################] 100%
(13/14) installing mingw-w64-x86_64-z3                       [###############################] 100%
(14/14) installing mingw-w64-x86_64-qt5-static               [###############################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...

Then in a new terminal session, cmake reported several errors:

cmake -S . -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:861 (file):
  file STRINGS file
  "E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdC/a.exe" cannot be
  read.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:967 (file):
  file failed to open for reading (Invalid argument):

    E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdC/a.exe
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:970 (string):
  string begin index: 1 is out of range 0 - 0
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:978 (math):
  math cannot parse the expression: " * 16 + ": syntax error, unexpected
  exp_TIMES (2).
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:980 (file):
  file failed to open for reading (Invalid argument):

    E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdC/a.exe
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:1022 (file):
  file failed to open for reading (Invalid argument):

    E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdC/a.exe
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The C compiler identification is GNU 13.2.0
CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:861 (file):
  file STRINGS file
  "E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdCXX/a.exe" cannot
  be read.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:967 (file):
  file failed to open for reading (Invalid argument):

    E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdCXX/a.exe
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:970 (string):
  string begin index: 1 is out of range 0 - 0
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:978 (math):
  math cannot parse the expression: " * 16 + ": syntax error, unexpected
  exp_TIMES (2).
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:980 (file):
  file failed to open for reading (Invalid argument):

    E:/git/NanoBoyAdvance/build/CMakeFiles/3.27.5/CompilerIdCXX/a.exe
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/apps/w64devkit-1.20.0/bin/cc.exe
-- Check for working C compiler: C:/apps/w64devkit-1.20.0/bin/cc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/apps/w64devkit-1.20.0/bin/c++.exe - skipped -- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Version: 10.2.1
-- Build type: Release
CMake Error at src/platform/core/CMakeLists.txt:11 (find_package):
  Could not find a package configuration file provided by "SDL2" (requested
  version 2.0.10) with any of the following names:

    SDL2Config.cmake
    sdl2-config.cmake

  Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
  "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

After this I tried following the Linux steps in WSL as well and encountered another error. First I installed dependencies:

sudo apt-get update
sudo apt install cmake python3-jinja2 python3-lxml libsdl2-dev qtbase5-dev libqt5opengl5-dev

Then after that was successful, cmake failed:

pineapple@Skynet-22:/mnt/e/git/NanoBoyAdvance$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Version: 10.2.1
-- Build type: Release
CMake Error at src/platform/core/CMakeLists.txt:11 (find_package):
  Could not find a configuration file for package "SDL2" that is compatible
  with requested version "2.0.10".

  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake, version: unknown
    /lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake, version: unknown



-- Configuring incomplete, errors occurred!
See also "/mnt/e/git/NanoBoyAdvance/build/CMakeFiles/CMakeOutput.log".

After removing the find_package version for SDL2 to see what would happen, I got a different error:

if(USE_STATIC_SDL)
  find_package(SDL2
    REQUIRED COMPONENTS SDL2-static
    OPTIONAL_COMPONENTS SDL2main
    CONFIG)
else()
  find_package(SDL2
    REQUIRED COMPONENTS SDL2
    OPTIONAL_COMPONENTS SDL2main
    CONFIG)
endif()
pineapple@Skynet-22:/mnt/e/git/NanoBoyAdvance$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
-- Version: 10.2.1
-- Build type: Release
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
CMake Error at src/platform/core/CMakeLists.txt:26 (glad_add_library):
  Unknown CMake command "glad_add_library".


-- Configuring incomplete, errors occurred!
See also "/mnt/e/git/NanoBoyAdvance/build/CMakeFiles/CMakeOutput.log".
pineapple@Skynet-22:/mnt/e/git/NanoBoyAdvance$ rm -rf build
pineapple@Skynet-22:/mnt/e/git/NanoBoyAdvance$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Version: 10.2.1
-- Build type: Release
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
CMake Error at src/platform/core/CMakeLists.txt:26 (glad_add_library):
  Unknown CMake command "glad_add_library".


-- Configuring incomplete, errors occurred!
See also "/mnt/e/git/NanoBoyAdvance/build/CMakeFiles/CMakeOutput.log".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions