Issues with C Compilers (macOS)

Anything QL Software or Programming Related.
Post Reply
rorodev
ROM Dongle
Posts: 6
Joined: Wed Jan 20, 2021 9:58 pm

Issues with C Compilers (macOS)

Post 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 ;) )
Last edited by rorodev on Thu May 09, 2024 11:25 am, edited 1 time in total.


User avatar
XorA
Site Admin
Posts: 1381
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Issues with xtc68

Post 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!


rorodev
ROM Dongle
Posts: 6
Joined: Wed Jan 20, 2021 9:58 pm

Re: Issues with xtc68

Post 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!!


Derek_Stewart
Font of All Knowledge
Posts: 4028
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Issues with xtc68

Post 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...


Regards,

Derek
rorodev
ROM Dongle
Posts: 6
Joined: Wed Jan 20, 2021 9:58 pm

Re: Issues with xtc68

Post 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 :)


User avatar
XorA
Site Admin
Posts: 1381
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Issues with xtc68

Post 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!


rorodev
ROM Dongle
Posts: 6
Joined: Wed Jan 20, 2021 9:58 pm

Re: Issues with xtc68

Post 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!


Post Reply