QDOS gcc made easy (docker stylee)

Anything QL Software or Programming Related.
User avatar
XorA
Site Admin
Posts: 1344
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

QDOS gcc made easy (docker stylee)

Post by XorA »

Create a file hello.c

Code: Select all

#include <stdio.h>

int main(int argc, char **argv)
{
    printf("Hello\n");
}
run docker like so

Code: Select all

docker pull xora/qdos-gcc
docker  run -v $PWD:/build -w /build -u $USER xora/qdos-gcc qdos-gcc -o hello hello.c
and you should have hello as a QDOS executable.

This is my first play with docker so please let me know any problems.


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

Re: QDOS gcc made easy (docker stylee)

Post by XorA »

Fixed image now so -w argument is no longer needed.


Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: QDOS gcc made easy (docker stylee)

Post by Fabrizio »

Hi!

I would like to compile my universal game CROSS CHASE for the QL.
Ideally I would like to use it within Cygwin. To get me started as fast as possible I have tried the docker version but I cannot get to compile the hello world code.

I don't have much experience with docker. I have managed to pull the docker image.

I get the following error:
$ docker run -v $PWD:/build -w /build -u $USER xora/qdos-gcc qdos-gcc --version
C:\Program Files\Docker Toolbox\docker.exe: invalid reference format: repository name must be lowercase.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

On the other hand I can run
$ docker run xora/qdos-gcc qdos-gcc --version
2.95.3

But if I try to compile anything the file is not found.
$ docker run xora/qdos-gcc qdos-gcc /c/Retro/test/hello.c
qdos-gcc: /c/Retro/test/hello.c: No such file or directory
qdos-gcc: No input files

but the file is there

$ ll /c/Retro/test/hello.c
-rw-r--r-- 1 Brizio 197121 81 Jun 10 16:33 /c/Retro/test/hello.c

What am I doing wrong?


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

Re: QDOS gcc made easy (docker stylee)

Post by XorA »

You need to remap the directory with the source code into the container.


Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: QDOS gcc made easy (docker stylee)

Post by Fabrizio »

How?
Could you please give me an example on how to build a hello world program?

I have tried the suggested command but I get:
C:\Program Files\Docker Toolbox\docker.exe: invalid reference format: repository name must be lowercase.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Fabrizio


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

Re: QDOS gcc made easy (docker stylee)

Post by XorA »

Fabrizio wrote:How?
Could you please give me an example on how to build a hello world program?

I have tried the suggested command but I get:
C:\Program Files\Docker Toolbox\docker.exe: invalid reference format: repository name must be lowercase.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Fabrizio
-v $PWD:/build is what maps the directory to the /build dir where compiler is run inside the container.

so replace $PWD with your top level directory.

But I am unfamiliar with windows docker as to why you get that error message, my guess would be that either $PWD has a space in it or $USER does not exist in cygwin.


Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: QDOS gcc made easy (docker stylee)

Post by Fabrizio »

Hi

I am not using Cygwin. I just want to compile a simple hello world program.

What is my top level directory?
/c/ ?

Let us say I have put the hello.c file into /c/Retro/hello.c, then I get:

$ docker run xora/qdos-gcc qdos-gcc -v /c/Retro/hello.c
qdos-gcc: /c/Retro/hello.c: No such file or directory
Reading specs from /usr/local/lib/gcc-lib/qdos/2.95.3/specs
gcc version 2.95.3 20010315 (release)

I have also tried:
$ docker run -v /c/Retro/hello.c -w /build -u $USER xora/qdos-gcc qdos-gcc -o hello hello.c
Unable to find image 'qdos-gcc:latest' locally
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: pull access denied for qdos-gcc, repository does not exist or may require 'docker login'.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Brizio@DESKTOP-I20P8HM MINGW64 /c/Program Files/Docker Toolbox
$ docker run -v /c/Retro/hello.c -w /build xora/qdos-gcc qdos-gcc -o hello hello.c
qdos-gcc: hello.c: No such file or directory
qdos-gcc: No input files


Could you please provide a simple command that compiles hello.c placed at /c/Retro/hello.c ?

Fabrizio


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

Re: QDOS gcc made easy (docker stylee)

Post by Derek_Stewart »

Hi,

I installed Docker on my Linux Mint 18.3 x64 laptop, pulled the xora/qdos-gcc image down.

I tried to compile the example hello_c file, but it would only compile when I changed the -u statement to root.

The resultant object file"hello" was created with ownership to root, which I changed ownership to my user account.

The object file was not executable, but qdos-gcc returned the data space figure, so I loaded the object file into a RESPR area with SMSQmualator and SEXEC the new file with the data space figure.

The new executable file runs in SMSQmulator OK.

Is it possible to have the object file QL executable header?


Regards,

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

Re: QDOS gcc made easy (docker stylee)

Post by tofro »

Derek_Stewart wrote:
Is it possible to have the object file QL executable header?

Not easily - There's no way to store a QL file header anywhere on a foreign file system (other than, maybe, using the Q-Emulator method, which makes the file un-usable on native boxes). Your method to re-create the header on an Emulator was probably the best one.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
XorA
Site Admin
Posts: 1344
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QDOS gcc made easy (docker stylee)

Post by XorA »

Compile qdos zip for linux and zip the exe. Qdos zip recognises the xtcc field and adds the header.


Post Reply