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

libretro: compilation on Windows #49

Open
audetto opened this issue Nov 28, 2021 · 4 comments
Open

libretro: compilation on Windows #49

audetto opened this issue Nov 28, 2021 · 4 comments
Labels

Comments

@audetto
Copy link
Owner

audetto commented Nov 28, 2021

It was mentioned here that the libretro code does not compile on Windows with MSYS2

#44 (comment)

I am allergic to Windows, but in small doses I could do something.
Is there any interest out there?

I could try to make it compile using Visual Studio 2019 (same compiler used by AW).
Any interest?

@audetto audetto changed the title libretro on Windows libretro: compilation on Windows Nov 28, 2021
@gouchi
Copy link

gouchi commented Jul 20, 2024

I tried to make a quick using msys2 and I got using

git clone https://github.com/audetto/AppleWin.git --recursive
mkdir build
cd build/
cmake -DCMAKE_BUILD_TYPE=RELEASE  -DBUILD_LIBRETRO=ON ..
-- The C compiler identification is GNU 14.1.0
-- The CXX compiler identification is GNU 14.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mingw64/bin/cc.exe - skipped
-- 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: /mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE:                RELEASE
CMAKE_CXX_FLAGS:
CMAKE_CXX_FLAGS_RELEASE:         -O3 -DNDEBUG
CMAKE_CXX_FLAGS_DEBUG:           -g
CMAKE_CXX_FLAGS_RELWITHDEBINFO:  -O2 -g -DNDEBUG
-- Found PkgConfig: /mingw64/bin/pkg-config.exe (found version "2.2.0")
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindZLIB.cmake:202 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  source/CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!

I installed RA environnement packages even not necessary (I did not install Nvdia and QT packages). Here the list at the end packages.txt.

@audetto
Copy link
Owner Author

audetto commented Jul 21, 2024

When you compile this libretro core, you need to install its dependencies, which are not the ones listed there.

I have a list of dependencies for Fedora (https://github.com/audetto/AppleWin/blob/master/source/linux/fedora.list.txt) and Debian (https://github.com/audetto/AppleWin/blob/master/source/linux/raspbian.list.txt).

If you restrict to libretro you might be able to skip some.

@gouchi
Copy link

gouchi commented Jul 23, 2024

I was missing packages zlib-devel mingw-w64-x86_64-minizip mingw-w64-x86_64-libslirp mingw-w64-x86_64-libyaml mingw-w64-x86_64-boost

CMake is ok now

cmake -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_LIBRETRO=ON ..
-- The C compiler identification is GNU 14.1.0
-- The CXX compiler identification is GNU 14.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mingw64/bin/cc.exe - skipped
-- 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: /mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE:                RELEASE
CMAKE_CXX_FLAGS:
CMAKE_CXX_FLAGS_RELEASE:         -O3 -DNDEBUG
CMAKE_CXX_FLAGS_DEBUG:           -g
CMAKE_CXX_FLAGS_RELWITHDEBINFO:  -O2 -g -DNDEBUG
-- Found PkgConfig: /mingw64/bin/pkg-config.exe (found version "2.2.0")
-- Found ZLIB: /usr/lib/libz.dll.a (found version "1.3.1")
-- Checking for one of the modules 'yaml-0.1'
-- Checking for one of the modules 'minizip'
-- Checking for one of the modules 'slirp'
CMake Warning (dev) at source/CMakeLists.txt:34 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /mingw64/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found version "1.85.0")
CMake Warning (dev) at source/frontends/common2/CMakeLists.txt:36 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /mingw64/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found version "1.85.0") found components: program_options
-- Configuring done (15.6s)
-- Generating done (0.6s)
-- Build files have been written to: /home/gouchi/AppleWin/build

But now I getting this error :

[  1%] Building CXX object source/linux/libwindows/CMakeFiles/windows.dir/dmusicc.cpp.o
In file included from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/winhandles.h:3,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/dmusicc.h:3,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/dmusicc.cpp:1:
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:47:9: warning: "__int64" redefined
   47 | #define __int64 long long int
      |         ^~~~~~~
In file included from C:/Users/krimo/Downloads/msys2/mingw64/include/corecrt.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/crtdefs.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/stdint.h:28,
                 from C:/Users/krimo/Downloads/msys2/mingw64/lib/gcc/x86_64-w64-mingw32/14.1.0/include/stdint.h:9,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/cstdint:45,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:20:
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:241:9: note: this is the location of the previous definition
  241 | #define __int64 long long
      |         ^~~~~~~
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:193:9: warning: "__stdcall" redefined
  193 | #define __stdcall
      |         ^~~~~~~~~
<built-in>: note: this is the location of the previous definition
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:203:9: warning: "__forceinline" redefined
  203 | #define __forceinline inline
      |         ^~~~~~~~~~~~~
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:264:9: note: this is the location of the previous definition
  264 | #define __forceinline inline __attribute__((__always_inline__))
      |         ^~~~~~~~~~~~~
[  1%] Building CXX object source/linux/libwindows/CMakeFiles/windows.dir/dsound.cpp.o
In file included from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/winhandles.h:3,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/dsound.h:3,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/dsound.cpp:1:
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:47:9: warning: "__int64" redefined
   47 | #define __int64 long long int
      |         ^~~~~~~
In file included from C:/Users/krimo/Downloads/msys2/mingw64/include/corecrt.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/crtdefs.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/stdint.h:28,
                 from C:/Users/krimo/Downloads/msys2/mingw64/lib/gcc/x86_64-w64-mingw32/14.1.0/include/stdint.h:9,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/cstdint:45,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:20:
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:241:9: note: this is the location of the previous definition
  241 | #define __int64 long long
      |         ^~~~~~~
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:193:9: warning: "__stdcall" redefined
  193 | #define __stdcall
      |         ^~~~~~~~~
<built-in>: note: this is the location of the previous definition
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:203:9: warning: "__forceinline" redefined
  203 | #define __forceinline inline
      |         ^~~~~~~~~~~~~
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:264:9: note: this is the location of the previous definition
  264 | #define __forceinline inline __attribute__((__always_inline__))
      |         ^~~~~~~~~~~~~
[  2%] Building CXX object source/linux/libwindows/CMakeFiles/windows.dir/fileapi.cpp.o
In file included from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/fileapi.h:3,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/fileapi.cpp:1:
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:47:9: warning: "__int64" redefined
   47 | #define __int64 long long int
      |         ^~~~~~~
In file included from C:/Users/krimo/Downloads/msys2/mingw64/include/corecrt.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/crtdefs.h:10,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/stdint.h:28,
                 from C:/Users/krimo/Downloads/msys2/mingw64/lib/gcc/x86_64-w64-mingw32/14.1.0/include/stdint.h:9,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/cstdint:45,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:20:
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:241:9: note: this is the location of the previous definition
  241 | #define __int64 long long
      |         ^~~~~~~
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:193:9: warning: "__stdcall" redefined
  193 | #define __stdcall
      |         ^~~~~~~~~
<built-in>: note: this is the location of the previous definition
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:203:9: warning: "__forceinline" redefined
  203 | #define __forceinline inline
      |         ^~~~~~~~~~~~~
C:/Users/krimo/Downloads/msys2/mingw64/include/_mingw.h:264:9: note: this is the location of the previous definition
  264 | #define __forceinline inline __attribute__((__always_inline__))
      |         ^~~~~~~~~~~~~
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/fileapi.h:43:9: warning: "_MAX_EXT" redefined
   43 | #define _MAX_EXT            _MAX_FNAME
      |         ^~~~~~~~
In file included from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/cstdlib:79,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/stdlib.h:36,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/assert.h:17,
                 from C:/Users/krimo/Downloads/msys2/mingw64/include/c++/14.1.0/cassert:44,
                 from C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/wincompat.h:21:
C:/Users/krimo/Downloads/msys2/mingw64/include/stdlib.h:123:9: note: this is the location of the previous definition
  123 | #define _MAX_EXT 256
      |         ^~~~~~~~
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/fileapi.cpp: In function 'DWORD GetFullPathName(const char*, DWORD, char*, char**)':
C:/Users/krimo/Downloads/msys2/home/krimo/AppleWin/source/linux/libwindows/fileapi.cpp:133:25: error: 'realpath' was not declared in this scope
  133 |   const char * result = realpath(filename, buffer);
      |                         ^~~~~~~~
make[2]: *** [source/linux/libwindows/CMakeFiles/windows.dir/build.make:104: source/linux/libwindows/CMakeFiles/windows.dir/fileapi.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:196: source/linux/libwindows/CMakeFiles/windows.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

@audetto
Copy link
Owner Author

audetto commented Jul 24, 2024

unfortunately, my Windows on qemu is barely usable, and msys2 does not really work on wine.

so, at the moment I struggle to replicate your build environment.

anyway, I am not surprised that a lot of the content of libwindows clashes with a real Windows compiler. you will have to try to tweak until you get something decent.

meanwhile I will keep trying to install msys2 somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants