Page 1 of 1

Issues with C Compilers (macOS)

Posted: Tue May 07, 2024 3:38 pm
by rorodev
I've finally started with my plan to create a game on the QL.
I use the ready-to-download binaries from https://github.com/stronnag/xtc68/releases
, which should be pretty new (2022). I use an Apple M2 laptop for development.
The toolchain works well for simple programs. I also have code to draw lines, etc. (which is needed for my game).
So I was thought all fine to start ... ;)

The issues now:
- Sometimes, the exe doesn't work anymore when I add additional code to a function or more case blocks in a switch statement, etc.
- Sometimes, it's even enough to copy the same line of code, and it won't work anymore

Good example is this one:

Code: Select all

graphicsBox(SCREEN, 10, 10, 100, 30, COLOR_GREEN); // 1
graphicsBox(SCREEN, 10, 10, 100, 30, COLOR_GREEN); // 2
graphicsBox(SCREEN, 10, 10, 100, 30, COLOR_GREEN); // 3
It works with 1 and 2, but when you add line 3, it doesn't start anymore (or crashes?).
I don't think it relates to the specific code itself; I can reproduce it with many other examples.

I am still looking to find out what causes these issues.
Do I miss something about how to use this compiler, have I overlooked limitations, or have I chosen the wrong settings?

I build the code quite simple:

Code: Select all

qcc -o out/sysvar.o -c sysvar.c
qcc -o out/graphics.o -c graphics.c
qcc -o out/vtext.o -c vtext.c
qcc -o out/test.o -c test.c
qcc -o test out/test.o out/sysvar.o out/graphics.o out/vtext.o
In the emulator, I add the header through a Super Basic script, and that's it.
Any ideas?

Thanks for any thoughts or help!

(I know there is also GCC but so far it will not compile on my M1 ;) )

Re: Issues with xtc68

Posted: Tue May 07, 2024 5:24 pm
by XorA
Odd I did the initial 64bit/Apple/Clang work on xtc68 and did not see any major issues like this!

I have not tested recently though!

Re: Issues with xtc68

Posted: Tue May 07, 2024 5:55 pm
by rorodev
I think bad was on my side ... :?
I've discovered that simply resetting the QL Emulator isn't sufficient. After making some changes, I've found it necessary to completely quit and start again.
Not sure why but it works with every new build of the executable when I do this.

Still, a lot to learn on the internals for me 8-)

But thanks a lot for the feedback!!

Re: Issues with xtc68

Posted: Wed May 08, 2024 7:24 am
by Derek_Stewart
Hi,

I compiled xtc68 and qdos-gcc on Linux Mint 21, Debian 12 on a Core i5 PC and Raspberry Pi-400 with no problems the both compilers work great.

There was a problem with the Linux Mint, not support GCC 12 onwards, I reported this as a issue on Github on Jonathan Hudson, who gave to the solution of using clang instead of GCC to compile, which fix the compile errors.

Now I have QL C compiled executable files being produced, with QDOS header trailers and can be executed in a QDOS environment.

I do not have a Apple M2, as I can not afford the cost, being very poor, I have to make the computers I use...

Re: Issues with xtc68

Posted: Wed May 08, 2024 11:15 am
by rorodev
Hi Derek,
Yes, on Linux, I was able to build it, but so far, I'm struggling to make it work on the M2. Anyway, it's not a big deal at the moment. Maybe I can try again when I have more time.

Currently, I have to focus on the game itself, which works already but is super slow :)

Re: Issues with xtc68

Posted: Wed May 08, 2024 11:28 am
by XorA
If you have a working copy on linux and a non working copy on m2, would be worth diffing the assembler output to see what is changing!

Re: Issues with xtc68

Posted: Thu May 09, 2024 11:24 am
by rorodev
Ah, now, that was misleading from my side:
  • XTC68 is now working fine on my m2
    Issues I have with GCC to build even the toolchain on m2
But for the moment, I'm happy that XTC68 is working, and I already have a working game in C to test.
The main effort I have to spend is now on performance. It's yet super slow on a BQL, but that was expected at first :)

Thanks for all the feedback!