QDOS gcc made easy (docker stylee)

Anything QL Software or Programming Related.
User avatar
XorA
Super Gold Card
Posts: 510
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

QDOS gcc made easy (docker stylee)

Postby XorA » Fri Sep 15, 2017 6:24 pm

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
Super Gold Card
Posts: 510
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QDOS gcc made easy (docker stylee)

Postby XorA » Fri Sep 15, 2017 7:49 pm

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


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

Re: QDOS gcc made easy (docker stylee)

Postby Fabrizio » Sun Jun 10, 2018 11:09 pm

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
Super Gold Card
Posts: 510
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QDOS gcc made easy (docker stylee)

Postby XorA » Mon Jun 11, 2018 8:38 pm

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


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

Re: QDOS gcc made easy (docker stylee)

Postby Fabrizio » Tue Jun 12, 2018 9:28 am

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
Super Gold Card
Posts: 510
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QDOS gcc made easy (docker stylee)

Postby XorA » Tue Jun 12, 2018 2:53 pm

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: 12
Joined: Thu Apr 19, 2018 11:09 am

Re: QDOS gcc made easy (docker stylee)

Postby Fabrizio » Tue Jul 10, 2018 10:27 pm

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
QL Wafer Drive
Posts: 1062
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: QDOS gcc made easy (docker stylee)

Postby Derek_Stewart » Sat Jul 21, 2018 9:45 am

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
QL Wafer Drive
Posts: 1379
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: QDOS gcc made easy (docker stylee)

Postby tofro » Sat Jul 21, 2018 10:14 am

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


User avatar
XorA
Super Gold Card
Posts: 510
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QDOS gcc made easy (docker stylee)

Postby XorA » Sat Jul 21, 2018 12:51 pm

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



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 4 guests