AmigaPorts / ACE

Amiga C Engine
Mozilla Public License 2.0
155 stars 26 forks source link

does it work on windows 10 ? #139

Closed 0wen101 closed 3 years ago

0wen101 commented 3 years ago

Is it possible to build ACE with Cygwin and windows 10 ?

Using cygwin my cmake command is:

cmake .. -DCMAKE_TOOLCHAIN_FILE=/cygdrive/d/Dev/Amiga/ACE/AmigaCMakeCrossToolchains-master/m68k-amigaos.cmake -DM68K_TOOLCHAIN_PATH=/cygdrive/c/amiga-gcc -DM68K_CPU=68000 -DM68K_FPU=soft

I get

-- The C compiler identification is GNU 10.2.0 -- The CXX compiler identification is GNU 10.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/cygwin64/bin/gcc -- Check for working C compiler: C:/cygwin64/bin/gcc - broken

CMake Error at /usr/share/cmake-3.20.0/Modules/CMakeTestCCompiler.cmake:66 (message): The C compiler "C:/cygwin64/bin/gcc" is not able to compile a simple test program. It fails with the following output:

Change Dir: /cygdrive/d/Dev/Amiga/ACE/ACE-master/tools/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make.exe -f Makefile cmTC_acf86/fast && /usr/bin/make  -f CMakeFiles/cmTC_acf86.dir/build.make CMakeFiles/cmTC_acf86.dir/build
make[1]: Entering directory '/cygdrive/d/Dev/Amiga/ACE/ACE-master/tools/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_acf86.dir/testCCompiler.c.obj
C:/cygwin64/bin/gcc --sysroot=/opt/m68k-generic   -m68000 -msoft-float -fomit-frame-pointer -mcrt=nix20   -m68000 -msoft-float -fomit-frame-pointer -mcrt=nix20   -o CMakeFiles/cmTC_acf86.dir/testC

.c gcc: error: unrecognized command-line option '-m68000' gcc: error: unrecognized command-line option '-mcrt=nix20' gcc: error: unrecognized command-line option '-m68000' gcc: error: unrecognized command-line option '-mcrt=nix20' make[1]: [CMakeFiles/cmTC_acf86.dir/build.make:78: CMakeFiles/cmTC_acf86.dir/testCCompiler.c.obj] Error 1 make[1]: Leaving directory '/cygdrive/d/Dev/Amiga/ACE/ACE-master/tools/build/CMakeFiles/CMakeTmp' make: [Makefile:127: cmTC_acf86/fast] Error 2

Help please ?

tehKaiN commented 3 years ago

Looks like your cmake doesn't detect a compiler properly:

 -- Check for working C compiler: C:/cygwin64/bin/gcc
-- Check for working C compiler: C:/cygwin64/bin/gcc - broken

my cmake configure string under windows looks like this:

cmake -DCMAKE_C_COMPILER:FILEPATH=C:\Users\tehKa\.vscode\extensions\bartmanabyss.amiga-debug-1.1.0-preview33\bin\opt\bin\m68k-amiga-elf-gcc.exe -DCMAKE_CXX_COMPILER=C:\Users\tehKa\.vscode\extensions\bartmanabyss.amiga-debug-1.1.0-preview33\bin\opt\bin\m68k-amiga-elf-g++.exe -DCMAKE_TOOLCHAIN_FILE=C:\prg\_git\AmigaCMakeCrossToolchains\m68k-bartman.cmake -DM68K_CPU=68000 -DTOOLCHAIN_PREFIXm68k-amiga-elf -DTOOLCHAIN_PATH:STRING=C:/Users/tehKa/.vscode/extensions/bartmanabyss.amiga-debug-1.1.0-preview33/bin/opt

since you're using Bebbo's toolchain, try adding

-DCMAKE_C_COMPILER:FILEPATH=m68k-amigaos-gcc -DCMAKE_CXX_COMPILER=m68k-amigaos-g++. Before running cmake again, be sure to delete CMakeCache.txt or the whole build folder.

or full paths to executables. If all else fails, you may want to try his prebuilt msys version (link to setup.exe in his readme).

I hope that helps!

0wen101 commented 3 years ago

Thanks for that.

Yes, using gcc from Bebbo's setup.exe (installed to C:\amiga-gcc). I ran the cmdline.bat there and it's definitely working ok.

Seems my problem is CMake is defaulting to the cygwin gcc/g++ compiler (GNU 10.2.0) in C:\cygwin64\bin\gcc.exe instead of C:\amiga-gcc\bin\m68k-amigaos-gcc.exe. Or my toolchain param is incorrect..

Will try a few things and post again if get it working. Nearest I got was to just run 'CMake ..' from a build subfolder in the ACE-master repo. Makefiles created. But wrong compiler. Also, using Windows7 64 not Win10 if that makes any difference..

thank you, looking forward to trying out the engine :)

0wen101 commented 3 years ago

cygwin, mingw seems just too problematic. Use WSL2 and UBuntu instead. So using Win10 64 version 20H2 for example

1/ install wsl2, 2/ install gcc (e.g 9.3), cmake (e.g. 3.16.3) 3/ build bebbo gcc 4/ clone ACE 5/ clone AmigaCMakeCrossToolchain 6/ cd ACE , mkdir build, cd build 7/ build: cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/0wen101/AmigaCMakeCrossToolchains/m68k-amigaos.cmake -DM68K_CPU=68000 -DM68K_FPU=soft -DTOOLCHAIN_PREFIX=m68k-amigaos -DTOOLCHAIN_PATH:STRING=/opt/amiga 8/make. Wait a few seconds then

. . . [100%] Linking C static library libace.a [100%] Built target ace

One more dumbass question if I may. The libace.a static library that I just built as above on WSL2/Ubuntu. Can I compile and link to that same library with Bebbo's GCC back on Windows ? (I've tools and stuff setup there)

Close this as it's not really an issue. More a discussion..

thanks

tehKaiN commented 3 years ago

Use WSL2 and UBuntu instead

That's exactly what I do. ;)

One more dumbass question if I may.

There are no dumbass questions here. ;)

The libace.a static library that I just built as above on WSL2/Ubuntu. Can I compile and link to that same library with Bebbo's GCC back on Windows ? (I've tools and stuff setup there)

I'm not really sure, but probably it should work. Let me know how it goes because it's not something that I've tested earlier.

What I would rather encourage is to include ACE as a submodule of each project (e.g. using git submodules or just copy of sources in separate subdirectory) and build it as dependency (e.g. using CMake's add_subdirectory). ACE has unstable structure and breaking changes are done between commits now and then so that more performance can be achieved. When you make ACE part of your project as submodule, you don't have a problem remembering witch which exact ACE's commit was the game buildable. The https://github.com/approxit/impsbru/ went with approach of building ACE separately and linking it systemwide, and then, after few years, the author haven't remembered the exact commit he built the game with, and it took him some time to make the game running again with more recent version.