Page 2 of 11
Re: LCC for the Gigatron. Take two.
Posted: 01 Aug 2021, 14:40
by lb3361
So far it only runs on Linux. For the time being, the best way to run it on Windows is to use Microsoft's Windows Subsystem for Linux,
https://docs.microsoft.com/en-us/windows/wsl/about . WSL1 should be good enough. Long term we have to do better, but that's another story...
Re: LCC for the Gigatron. Take two.
Posted: 17 Aug 2021, 13:42
by axelb
I successfully built the Gigatron-LCC 1.0 compiler under Windows 10 using Cygwin64 !
(Packages: bison, byacc, gcc-core, python 3.8, GNU make 4.3)
However, i had to add the line
cygwin: ${B}rcc
at the end of the makefiles in the following directories
gigatron/libc/
gigatron/mapsim/
gigatron/mapconx/
Otherwise the build process stopped returning a "No rule to make target" error.
After extracting the patch
https://github.com/axelb68/gigatron-lcc/tree/patch-1 to i.e. d:\glcc just start the cygwin64 terminal
and use
cd ../../cygdrive/d/glcc. If you now type
make install the build process will install the compiler to the folder
C:\cygwin64\usr\local\lib\gigatron-lcc. It can now be used from any location inside the cygwin terminal.
The compiler works great - thanks Leon !
Re: LCC for the Gigatron. Take two.
Posted: 18 Aug 2021, 18:50
by lb3361
Amazing. I thought that it would have required more work. I am surprised by this cygwin: rule to add to the make files. Is it a known cygwin thing?
- Leon
Ps1: please send me a pull request..
Ps2: At67 suggests to switch the build system to cmake, which would certainly open possibilities…
Re: LCC for the Gigatron. Take two.
Posted: 19 Aug 2021, 10:52
by at67
@axelb Great stuff!
@lb3361 CMake would solve a lot of your non Linux build issues.
Re: LCC for the Gigatron. Take two.
Posted: 19 Aug 2021, 11:24
by axelb
This is my pull request for the Cygwin build:
https://github.com/lb3361/gigatron-lcc/pulls .
It is also sufficient to change the ${B}rcc entries in these makefiles to ${B}rcc.exe without an additional rule !
Maybe the rule just changes the way how a missing extension is treated under Cygwin...
Re: LCC for the Gigatron. Take two.
Posted: 20 Aug 2021, 06:16
by lb3361
I found in the cygwin doc that some of the libc calls such as stat() basically try adding a .exe extension. Other calls such as readdir() do not show an extension-less file whenever a .exe is present. I guess the patch changes which api calls are used by make to assert the existence of ${B}rcc. This seems very fragile and could break under mingw for instance.
The correct solution would be to replace ${B}rcc by ${B}rcc${E} everywhere, do the same for all other executables, and make sure that E is .exe on Windows and empty on other platforms.
It seems that one can do that by testing the existence of the COMSPEC environment variable. Do you see such a variable when you type 'env' under cygwin?
Re: LCC for the Gigatron. Take two.
Posted: 20 Aug 2021, 14:20
by lb3361
I have tentatively changed all the Makefiles to be aware of .exe suffixes.
See
https://github.com/lb3361/gigatron-lcc/ ... 49cb5d6c7a
Re: LCC for the Gigatron. Take two.
Posted: 23 Aug 2021, 06:47
by axelb
Under cygwin>env i found COMSPEC=C:\windows\system32\cmd.exe.
Using your latest approach I again got the "No rule to make target"-error.
However, everything works fine when changing the main makefile to
ifdef COMSPEC
EX=.exe
else
EX=
endif
replacing E= to EX= and ${E} to ${EX} in this and the other makefiles.
I assume ifdef $(COMSPEC) was just a typo and the variable E might be used elsewhere...
Re: LCC for the Gigatron. Take two.
Posted: 23 Aug 2021, 17:58
by lb3361
I understand the comspec part but not the ex part and I really would like to know why things work. This probably means I need to setup a cygwin environment and test..
Update 1: I just installed a fresh cygwin distribution and was able to compile all with just the ifdef COMSPEC change. I had no need to rename variable E as EX. I am using gnu-make-4.3 and gcc-11.2. The test suite ran fine. Now I would like to know whether I can do the same with mingw.
Update 2: I also managed to compile with mingw and produce executables that only require the python launcher "py" to be installed. The attached zip contains binaries intended to be installed in c:\gigatron-lcc. If you install elsewhere, you need to patch the paths in the two bat files glcc.bat and glink.bat located in the bin directory. Seems to work. No guarantees.
Re: LCC for the Gigatron. Take two.
Posted: 25 Aug 2021, 06:08
by axelb
Changing back to E as a variable name now also works fine on my side
. Thank you for the clarification!