LCC for the Gigatron. Take two.

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
lb3361
Posts: 367
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

If you do not want to do make install and want to run glcc from the build directory, the cleanest solution is to create a directory $HOME/bin, make sure it is in your PATH, and have symlinks from there to the glcc executables in the build directory. For instance my bin directory contains this because I always want to use the recently built versions:

Code: Select all

lrwxr-xr-x 35 Jun  3  2023 glcc -> ../gigatron/gigatron-lcc/build/glcc
lrwxr-xr-x 36 Jun  3  2023 glink -> ../gigatron/gigatron-lcc/build/glink
lrwxr-xr-x 38 Oct 21 11:02 gt1dump -> ../gigatron/gigatron-lcc/build/gt1dump
lrwxr-xr-x 40 Jan  1 09:39 gt1z -> ../gigatron/gigatron-rom/Utils/gt1z/gt1z
lrwxr-xr-x 37 Jun  3  2023 gtprof -> ../gigatron/gigatron-lcc/build/gtprof
lrwxr-xr-x 36 Jun  3  2023 gtsim -> ../gigatron/gigatron-lcc/build/gtsim
and my .profile (or .zprofile on a Mac) contains

Code: Select all

PATH=$HOME/bin:$PATH
The purpose of the build directory is to build glcc. It contains plenty of files that are not necessary to run glcc but are useful to build it. I chose to make it possible to run glcc from the build directory, but this is just a bonus.

In principle, "make clean" in glcc only cleans what is in the build directory, and in fact completely removes it. So in short, you should never put anything precious into the build directory. But I frequently create subdirectories in the "gigaton-lcc/stuff" directory for various programs, and they are not disturbed when glcc is recompiled from scratch.

For you particular versioning problem, you could just remove the glccver.py file that is in the build directory. But frankly there may be plenty of other problems. Best would be to delete the build directory completely and compile from fresh.
petersieg
Posts: 110
Joined: 28 Jun 2023, 09:06

Re: LCC for the Gigatron. Take two.

Post by petersieg »

Hmm..?
When I build glcc fresh/new, I normally download a zip from github, unzip it in Downloads, goto the gigatron-lcc-master
do a make
Than I get:
...
../../../build/glcc -c -cpu=5 -o ../../../build/libcon1/cons_setup_5.o cons_setup.c
cpp: cons_setup.c:8 #error directive: "This library requires GLCC > 1.5-61"
make[3]: *** [../../../build/libcon1/cons_setup_5.o] Error 1
make[2]: *** [subdirs-all] Error 2
make[1]: *** [subdirs-all] Error 2
make: *** [all] Error 2
ichs-iMac:gigatron-lcc-master ich$

But don't worry about me. I know how to get around that. I just comment out the mentioned #error lines 4 times and after that, it compiled just fine.
But what if someone new to glcc. That wants to download your compiler for the very first time?
How would he be able to build/compile your compiler?

Thats my point.
This looks like a hen and egg problem?
Or am I completely wrong here?
build/glccver.py contains:
ver="GLCC-unknown-version"

If this is only my issue, please ignore it, as I said, I get around it.
in the gigatron-lcc directory, I have only one 'example' directory, with all my little projects in subdirectories.
Inside the Makefile, I call ../..build/glcc :-)
So with any new glcc compile, I save just examples into any new build.

Maybe thats part of the issue:
ichs-iMac:gigatron-lcc-master ich$ build/lcc --version
build/lcc: /usr/local/lib/gigatron-lcc/glink: No such file or directory
ichs-iMac:gigatron-lcc-master ich$

/usr/local/lib/gigatron-lcc/glcc is searched..?

If I do a rm build/glccver.py - it is rebuild with above contents and exactly same compile error is the result.

best, Peter
lb3361
Posts: 367
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

Oh I see.

I never realized one could download a zip. I was expecting users to "git clone".
The makefile uses the git information to create the version file glccver.py in the build directory.
If git is not detected, it creates one with "unknown-version" and this is what causes your problem.

Conclusion: I should find a better way to create or maintain the version file.

Comment: It should work now.
petersieg
Posts: 110
Joined: 28 Jun 2023, 09:06

Re: LCC for the Gigatron. Take two.

Post by petersieg »

Jap. Just downloaded and now it works out of the box, even with zip download :-)
...
/build/map512k/libcon_h.a
+----------------------------------+
| Compilation ran successfully! |
+----------------------------------+
ichs-iMac:gigatron-lcc-master ich$

Great!
Thx, Peter
lb3361
Posts: 367
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

New release.

Linux and Mac users --> clone the github repository at https://github.com/lb3361/gigatron-lcc
Windows users --> try the attached precompiled zip.

Version 2.4 makes a more efficient use of scratch registers, optimizes a bit more, and produces more compact code.
Long multiplication is substantially faster.
A couple bugs have been fixed.
Attachments
glcc-2.4.zip
(1.44 MiB) Downloaded 39 times
Last edited by lb3361 on 20 Mar 2024, 14:26, edited 1 time in total.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: LCC for the Gigatron. Take two.

Post by at67 »

lb3361 wrote: 19 Mar 2024, 20:17 [OOOPS] I get message "failed to move uploaded file" when i try to attach the 1.5MB zip file with the windows executable.
Max file upload size has been increased to approximately 5MiB.
lb3361
Posts: 367
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

at67 wrote: 20 Mar 2024, 03:47 Max file upload size has been increased to approximately 5MiB.
Thanks at67. It works now.
Post Reply