Try compiling gtemuAT67 with Cygwin

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
denjhang
Posts: 54
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

at67 wrote: 20 Mar 2022, 05:43 I didn't realise you were trying to run it in a VM, what happens when you type glxinfo at a terminal, (or glxgears)? Have you tried running any of the SDL2 examples?

Google is your friend here, either you didn't download the SDL2 opengl backend as part of the SDL2 installation, or something is amiss with your VM's X11/opengl/etc.
To confirm, my cygwin is running directly on windows 10, no virtual machine. I have Ubuntu21.1 running in a VM but it works without any issues and currently runs gtemuAT67 correctly.
I type "glxinfo" or "glxgears" and it returns me "command not found".
I am now installing glx related stuff.
denjhang
Posts: 54
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

I finally successfully run gtemuAT67 in Cygwin-X\WindowMaker, but the sound is very stuck and it seems to be very inefficient. And the console gives me these complaints.

Code: Select all

$ ./gtemuAT67
Loader::initialise() : Couldn't find COM Port '0' in INI file 'loader_config.ini'
Failed to create secure directory (/home/Administrator/.config/pulse): Unknown error 13
libGL error: Screen is not Windows-DRI capable
So I want to use other methods to compile gtemuAT67 on Windows 10. Such as vc++.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

You can ignore this one, you only need to setup the COM port if you want to control real Gigatron HW via the emulator.

Code: Select all

Loader::initialise() : Couldn't find COM Port '0' in INI file 'loader_config.ini'
30 seconds of google searching for the following :P

Code: Select all

Failed to create secure directory (/home/Administrator/.config/pulse): Unknown error 13
https://superuser.com/questions/674866/ ... n-error-13

Code: Select all

libGL error: Screen is not Windows-DRI capable
https://superuser.com/questions/1218405 ... -on-cygwin
denjhang
Posts: 54
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

at67 wrote: 20 Mar 2022, 08:45 You can ignore this one, you only need to setup the COM port if you want to control real Gigatron HW via the emulator.

Code: Select all

Loader::initialise() : Couldn't find COM Port '0' in INI file 'loader_config.ini'
30 seconds of google searching for the following :P

Code: Select all

Failed to create secure directory (/home/Administrator/.config/pulse): Unknown error 13
https://superuser.com/questions/674866/ ... n-error-13

Code: Select all

libGL error: Screen is not Windows-DRI capable
https://superuser.com/questions/1218405 ... -on-cygwin
I know googling for answers to related questions, I actually didn't find an answer to some annoying problem with Cygwin, and while it looks like there are many search results, it's really not useful (I've tried them one by one).
And cygwin is extremely inefficient, which is almost an unchangeable fact, it is not suitable for running applications like gtemu with graphics and sound. (Maybe I don't use Cygwin) I googled a lot about Cygwin-X graphics performance improvements, but to no avail. I've tried almost every search result.

So at the moment I'm coming out of one rabbit hole and jumping into another.

I'm currently compiling with clion, and it's almost successful, but I still find new problems.

Code: Select all

====================[ 构建 | gtemuAT67 | Debug ]==================================
"D:\Program Files\CLion-2021.3.4.win\bin\cmake\win\bin\cmake.exe" --build F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cmake-build-debug --target gtemuAT67 -- -j 16
[  3%] Building CXX object CMakeFiles/gtemuAT67.dir/cpu.cpp.obj
[  7%] Building CXX object CMakeFiles/gtemuAT67.dir/graphics.cpp.obj
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\graphics.cpp: In function 'float Graphics::powStepRising(float, float, float, float)':
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\graphics.cpp:774:16: error: 'powf' was not declared in this scope
         return powf(f, p);
                ^~~~
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\graphics.cpp: In function 'float Graphics::powStepFalling(float, float, float, float)':
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\graphics.cpp:780:16: error: 'powf' was not declared in this scope
         return powf(f, p);
                ^~~~
mingw32-make.exe[3]: *** [CMakeFiles\gtemuAT67.dir\build.make:226: CMakeFiles/gtemuAT67.dir/graphics.cpp.obj] Error 1
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cpu.cpp: In function 'bool Cpu::process(bool)':
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cpu.cpp:1244:67: error: expected ')' before 'PRId64'
                 fprintf(stderr, "Cpu::process(): CPU stall for %" PRId64 " clocks : rebooting.\n", _clock - _clockStall);
                                                                   ^~~~~~
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cpu.cpp:1244:120: warning: spurious trailing '%' in format [-Wformat=]
                 fprintf(stderr, "Cpu::process(): CPU stall for %" PRId64 " clocks : rebooting.\n", _clock - _clockStall);
                                                                                                                        ^
F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cpu.cpp:1244:120: warning: too many arguments for format [-Wformat-extra-args]
mingw32-make.exe[3]: *** [CMakeFiles\gtemuAT67.dir\build.make:136: CMakeFiles/gtemuAT67.dir/cpu.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:189: CMakeFiles/gtemuAT67.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:196: CMakeFiles/gtemuAT67.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:118: gtemuAT67] Error 2

denjhang
Posts: 54
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

Code: Select all

"D:\Program Files\CLion-2021.3.4.win\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=D:/mingw/winlibs-x86_64-posix-seh-gcc-12.0.1-snapshot20220123-mingw-w64-9.0.0-r1/mingw64/bin/mingw32-make.exe -DCMAKE_C_COMPILER=D:/mingw/winlibs-x86_64-posix-seh-gcc-12.0.1-snapshot20220123-mingw-w64-9.0.0-r1/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=D:/mingw/winlibs-x86_64-posix-seh-gcc-12.0.1-snapshot20220123-mingw-w64-9.0.0-r1/mingw64/bin/x86_64-w64-mingw32-g++.exe -G "MinGW Makefiles" F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org
-- The C compiler identification is GNU 12.0.1
-- The CXX compiler identification is GNU 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/mingw/winlibs-x86_64-posix-seh-gcc-12.0.1-snapshot20220123-mingw-w64-9.0.0-r1/mingw64/bin/x86_64-w64-mingw32-gcc.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: D:/mingw/winlibs-x86_64-posix-seh-gcc-12.0.1-snapshot20220123-mingw-w64-9.0.0-r1/mingw64/bin/x86_64-w64-mingw32-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found SDL2: mingw32;-mwindows;D:/working/SDL2-2.0.20/x86_64-w64-mingw32/lib/libSDL2main.a;D:/working/SDL2-2.0.20/x86_64-w64-mingw32/lib/libSDL2.dll.a  
-- Configuring done
-- Generating done
-- Build files have been written to: F:/cygwin64/home/Administrator/gigatron-rom-master/gigatron-rom-master/at67-org/cmake-build-debug

[已完成]

Code: Select all

====================[ 构建 | gtemuAT67 | Debug ]==================================
"D:\Program Files\CLion-2021.3.4.win\bin\cmake\win\bin\cmake.exe" --build F:\cygwin64\home\Administrator\gigatron-rom-master\gigatron-rom-master\at67-org\cmake-build-debug --target gtemuAT67 -- -j 16
Consolidate compiler generated dependencies of target gtemuAT67
[  3%] Linking CXX executable gtemuAT67.exe
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x1a4): undefined reference to `comRead'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x315c): undefined reference to `comGetPortName'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x3d5e): undefined reference to `comClose'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x46fe): undefined reference to `comOpen'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4719): undefined reference to `comEnumerate'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x47b9): undefined reference to `comGetPortName'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x47db): undefined reference to `comClose'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4927): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4968): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x49b0): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4a12): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4ad7): undefined reference to `comRead'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4b8d): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4d74): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x4e90): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x5f2c): undefined reference to `comGetPortName'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x601d): undefined reference to `comGetPortName'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x6159): undefined reference to `comWrite'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0x95a6): undefined reference to `comEnumerate'
d:/mingw/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64-9.0.0-r6/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\gtemuAT67.dir/objects.a(loader.cpp.obj):loader.cpp:(.text+0xc22e): undefined reference to `comFindPort'
collect2.exe: error: ld returned 1 exit status
mingw32-make[3]: *** [CMakeFiles\gtemuAT67.dir\build.make:528: gtemuAT67.exe] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:189: CMakeFiles/gtemuAT67.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:196: CMakeFiles/gtemuAT67.dir/rule] Error 2
mingw32-make: *** [Makefile:118: gtemuAT67] Error 2


After I updated the compiler, the syntax error went away, but something went wrong with Linking.I think this should be the closest I have come to success.
denjhang
Posts: 54
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

Code: Select all

add_library(rs232lib rs232/rs232-win.c rs232/rs232.h)
target_link_libraries(gtemuAT67 ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY} rs232lib)

I added the following modifications at cmakelists and I finally succeeded.

By the way, I've given up on using cygwin for now. Actually from the linking error, I switched to clion.
I use clion+ (GCC 12.0.1 snapshot 20220123 (experimental) + MinGW-w64 9.0.0 (MSVCRT) - release ) to compile all the above tools, and my code modifications are only valid in clion.
Attachments
gtsplitrom.zip
(1.56 MiB) Downloaded 75 times
gtmidi.zip
(1.61 MiB) Downloaded 86 times
gtmakerom.zip
(1.56 MiB) Downloaded 100 times
gtbasic.zip
(2.22 MiB) Downloaded 79 times
gtasm.zip
(1.68 MiB) Downloaded 83 times
gt1torom.zip
(1.55 MiB) Downloaded 81 times
gtemuAT67 1.0.9R.zip
(2.67 MiB) Downloaded 76 times
Last edited by denjhang on 20 Mar 2022, 18:33, edited 1 time in total.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

I've never used MINGW so take this advice with a grain of salt:

1) What you added to CMakeLists.txt won't work for anyone except you, (won't build under Linux/MacOS and will cause conflicts under MSVC).

2) A better way to do it would be something like this:

Change:

Code: Select all

if(MSVC)
    add_compile_options(/W4)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    add_executable(gtemuAT67 WIN32 dirent/dirent.h inih/INIReader.h rs232/rs232.h ${headers} rs232/rs232-win.c ${sources})
else()
    add_compile_options(-Wall -Wextra -pedantic)
    add_executable(gtemuAT67 inih/INIReader.h rs232/rs232.h ${headers} rs232/rs232-linux.c ${sources})
endif()
To:

Code: Select all

if(MSVC)
    add_compile_options(/W4)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    add_executable(gtemuAT67 WIN32 dirent/dirent.h inih/INIReader.h rs232/rs232.h ${headers} rs232/rs232-win.c ${sources})
elseif(MINGW)
    add_compile_options(-Wall -Wextra -pedantic)
    add_executable(gtemuAT67 inih/INIReader.h rs232/rs232.h ${headers} rs232/rs232-win.c ${sources})
else()
    add_compile_options(-Wall -Wextra -pedantic)
    add_executable(gtemuAT67 inih/INIReader.h rs232/rs232.h ${headers} rs232/rs232-linux.c ${sources})
endif()
*Note* I haven't tested this and I am not going to setup MINGW, so you are on your own if it doesn't work, (but it should be a simple version of what I have posted to make it work). i.e. you may need the WIN32 to specify WinMain() instead of main() etc.
Post Reply