Starting with C on the QL

Anything QL Software or Programming Related.
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Starting with C on the QL

Post by tcat »

Hi Derek and All,

I found this site devoted to qdos-gcc, is it the one you would recommend to use to get gcc package?
I guess this should also work on Raspberry PI, as the whole Debian trunk was also ported to RPI with gcc (mind you, some 35.000 packages)

http://morloch.hd.free.fr/qdos/qdosgcc.html
It seems to be maintained by Richard Židlický, Jonathan Hudson and Thierry Gogefroy.

I have myself only just discovered GST C, which is more around my QL skils and knowledge. I am toying with that. Also my QL box, though extended with simple 512K RAM sets my limits, but I like QL and its former design, as is.

Tom


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

Re: Starting with C on the QL

Post by Derek_Stewart »

Hi,

I forgot about the link on THierry's Web site to the GCC port.

I will have a loook at GCC and see if it is better.

Do you know if Franz Herrman is is still around.

I am re-learning programming after a long time out only considering hardware. I was mainly considering on C68, as this is an ANSI compatabile compiler and programmed to compile UNIX/Linux source code... well that is the claim in the documentation.

GST C, which I have used in the dim distant past, I think was a Lattice C compiler.

I am not sure what is the best.


Regards,

Derek
User avatar
tofro
Font of All Knowledge
Posts: 2701
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Starting with C on the QL

Post by tofro »

GST C is, like the DP C compiler a pretty simple "Small C" implementation. Thus it's missing quite some features like structures and a proper floating point implementation. Thus, it's not really fit for 21st century C programming.

Thanks for the gcc link - I didn't have that one. QDOS gcc is, however, based on a far outdated gcc version (4.9 is the actual one, I believe, QDOS gcc is based on 2.95), and i was really astonished that those sources still seem to be around. With regards to maintenance, I wouldn't bet a fortune that you still can get someone to fix any bugs - Most of the people mentioned on the web page have long left the QL scene.

I will try and build a QDOS gcc compiler once back from holidays. For now, I still think C68 is the most suitable C compiler for the QL.

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Starting with C on the QL

Post by tcat »

Toby,

I found this link to gcc 2.95 archive sources, it is one of the GNU German mirror sites.
As you say, 2.95 is required, while current release versions are 4.x.

http://www.artfiles.org/gnu.org/gcc/gcc-2.95/

My understanding is, that C sources ANSI compiled on UNIX can be recompiled on QL using C68 and respective libraries producing functional executable.

Alternatively 68k QDOS binary can produced directly under Linux using QDOS-GCC compiler.

Tom


User avatar
dex
Gold Card
Posts: 286
Joined: Thu Dec 23, 2010 1:40 pm

Re: Starting with C on the QL

Post by dex »

Derek_Stewart wrote:GST C, which I have used in the dim distant past, I think was a Lattice C compiler.
Metacomco C was the Lattice (ANSI) C.


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

Re: Starting with C on the QL

Post by Derek_Stewart »

Hi,

Thank you for the correction.

I like using C68 on the QL, but GCC coompiled QL binaries would nicer.

I compiled the QDOS-GCC files in a Virtual Machine running Redhat 9 OK, my main machine 64Bit Ubuntu, the makefile did not know about the version of Linux.

I dumped the QDOS GCC web page to My Kindle with the Firefox extension, I like to read most manuals on the Kindle, as with all the QL manuals and magazines, I have.


Regards,

Derek
User avatar
Peter
QL Wafer Drive
Posts: 1987
Joined: Sat Jan 22, 2011 8:47 am

Re: Starting with C on the QL

Post by Peter »

QDOS-GCC:
- Only available as crosscompiler, not as native compiler
- Generates much faster executables (-O2 commandline option)
- C68 library can be recompiled with QDOS-GCC
- Understands & compiles nearly all C68 code
- Easier porting of non-QL projects written in C
- Known bug concerning string related macros

C68
- Available as native and crosscompiler
- Extremely reliable
- Porting a non-QL project usually more difficult

Both compilers do not support C++ for the QL


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

Re: Starting with C on the QL

Post by Derek_Stewart »

Hi Peter,

I have got QDOS-GCC working on a Virtual Machine running Redhat 7, which does not really solve the problem of the system running on a modern version of GCC.

The makefile does not recognise my 64Bit Ubuntu 14.04 System, which has GCC v4.8.2

I am not sure if I have the knowledge to modify the code to run on a modern version of Linux.

Maybe I can compile the QDOS programmes in a Virtual Machine. I will try this with some software I would like to use on the QL, i.e. SQLite, JED, JOE, MuPDF

Looks like I have some interesting times ahead.


Regards,

Derek
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Starting with C on the QL

Post by tcat »

Hi,

I wish to share my experience too.
I am trying to make qdos-gcc using gcc (Debian 4.4.5-8) 4.4.5
When running build-qdos-gcc makefile, I get build error,

_mulsi3
shift: 43: can't shift that many
make[1]: *** [libgcc1-asm.a] Error 1

at a stage when libgcc1-asm.o is to be built I guess.
Cannot make it go further.

Tom


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Starting with C on the QL

Post by tcat »

Hi,

I have found a few problems with the wrapper shell script
/usr/local/qdos/bin/as

that is called by xgcc

which in turn calls
/usr/local/qdos/bin/as68

It is to do with the shift command that moves positional parameters a given number of times

I have now recompiled qdos-gcc binaries under libc6 and gcc 4.4.5
qdos-gcc itself is tied to gcc 2.95.3 and libc4 (4.24.5)

Question is, if it makes sense to produce new qdos-gcc sources based on libc6 and gcc 4.x?

Tom


Post Reply