[seL4] Re: seL4 docker build issues on Apple Silicon

2024-04-13 Thread Mark Jones
Thanks Gerwin!

I’m happy to report that I have been able to build and run seL4 test on two 
Apple silicon macs using Docker.  I’m sure Ivan’s work can provide a better 
long term solution.  But, in case my quick hacks are useful to anyone else, 
here’s a summary of what I did:

Building: The docker build that caused the error in my previous message was 
failing because it was looking for an arm version of the extras image, instead 
of the x86_64 version that had already been built.  To fix this, I just changed 
Line 9 in dockerfiles/user.Dockerfile (i.e., the line highlighted in the error 
message), from “FROM $EXTRAS_IMG” to "FROM --platform=linux/amd64 $EXTRAS_IMG” 
(new part highlighted in green).  After that, I’m able to run ninja to build 
seL4test.

Running: Alas, ./simulate fails when I try to run seL4test in the container (a 
qemu issue).  But I can just use ./simulate -n, to output the required qemu 
command, and then copy, paste, and run that command in a regular terminal 
outside the container.  This works because I already have qemu installed on the 
mac (courtesy of homebrew).

As I understand it, both steps are emulating x86_64 code under qemu, so it’s 
not as fast as it could be ... but still enough to be see the message that "All 
is well in the universe” :-)

Best wishes,
Mark



> On Apr 11, 2024, at 4:48 PM, Gerwin Klein  wrote:
> 
> Hi Mark,
> 
> the Docker setup is currently only really supported on Intel. We've tried to 
> get M1 working, but have so far only succeeded for the base sel4 image, not 
> for the larger containers on top (e.g. CamkES), although Ivan has make some 
> progress here: https://github.com/seL4/seL4-CAmkES-L4v-dockerfiles/pull/65 
> which might be worth trying.
> 
> I believe there is an option to make Docker emulate x64 on M1, but it is slow 
> (it uses qemu).
> 
> We'd be quite interested in a proper multi-arch image that does both x64 and 
> aarch64, so if you have any success in making progress, please do let us know.
> 
> Cheers,
> Gerwin
> 
>> On 12 Apr 2024, at 04:48, Mark Jones  wrote:
>> 
>> [Some people who received this message don't often get email from 
>> m...@pdx.edu. Learn why this is important at 
>> https://aka.ms/LearnAboutSenderIdentification ]
>> 
>> Dear All,
>> 
>> I’m trying to use the instructions on 
>> https://docs.sel4.systems/projects/dockerfiles/ to set up an seL4 docker 
>> build environment on an Apple Silicon Mac.  I’ve actually tried this on two 
>> different machines (with small variations in the versions of macOS Sonoma, 
>> Apple Silicon, and Docker between each of the machines), but get the same 
>> result on each one.  I’m hoping that other folks on this list might know how 
>> to fix this.
>> 
>> I start by running:
>> 
>> git clone https://github.com/seL4/seL4-CAmkES-L4v-dockerfiles.git
>> cd seL4-CAmkES-L4v-dockerfiles
>> make user
>> 
>> But the make command fails with the output appended below.
>> Any hints (including other places to post this question) would be much 
>> appreciated!
>> 
>> Best wishes,
>> Mark
>> 
>> __
>> 
>> scripts/utils/check_for_old_docker_imgs.sh
>> WARNING: Unable to check if your trustworthysystems docker images are 
>> getting a bit old!
>> The date command did not behave as expected. Skipping the check.
>> docker build --force-rm=true \
>>--build-arg=USER_BASE_IMG=trustworthysystems/camkes \
>>-f dockerfiles/extras.Dockerfile \
>>-t extras \
>>.
>> [+] Building 109.7s (6/6) FINISHED   
>>   docker:desktop-linux
>> => [internal] load build definition from extras.Dockerfile   
>>  0.0s
>> => => transferring dockerfile: 602B  
>>  0.0s
>> => [internal] load metadata for docker.io/trustworthysystems/camkes:latest   
>>  1.4s
>> => [internal] load .dockerignore 
>>  0.0s
>> => => transferring context: 153B 
>>  0.0s
>> => [1/2] FROM 
>> docker.io/trustworthysystems/camkes:latest@sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea
>>   96.3s
>> => => resolve 
>> docker.io/trustworthysystems/camkes:latest@sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea2
>>   0.0s
>> => => 
>> sha256:e943b5afb84223c55b5dfdbe2f383970021765c345c51b08fa8b9b0d4d69ccd7 
>> 9.97kB / 9.97kB 0.3s
>> => => 
>> sha256:46cbb6e89f5727950fb43b0c4b18a28073c18ad928ccf16c6e2a9f6d708ccb35 
>> 80.82MB / 80.82MB   6.9s
>> => => 
>> sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea2e12c65f2 
>> 1.79kB / 1.79kB 0.

[seL4] Re: seL4 docker build issues on Apple Silicon

2024-04-11 Thread Gerwin Klein via Devel
Hi Mark,

the Docker setup is currently only really supported on Intel. We've tried to 
get M1 working, but have so far only succeeded for the base sel4 image, not for 
the larger containers on top (e.g. CamkES), although Ivan has make some 
progress here: https://github.com/seL4/seL4-CAmkES-L4v-dockerfiles/pull/65 
which might be worth trying.

I believe there is an option to make Docker emulate x64 on M1, but it is slow 
(it uses qemu).

We'd be quite interested in a proper multi-arch image that does both x64 and 
aarch64, so if you have any success in making progress, please do let us know.

Cheers,
Gerwin

On 12 Apr 2024, at 04:48, Mark Jones  wrote:

[Some people who received this message don't often get email from m...@pdx.edu. 
Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Dear All,

I’m trying to use the instructions on 
https://docs.sel4.systems/projects/dockerfiles/ to set up an seL4 docker build 
environment on an Apple Silicon Mac.  I’ve actually tried this on two different 
machines (with small variations in the versions of macOS Sonoma, Apple Silicon, 
and Docker between each of the machines), but get the same result on each one.  
I’m hoping that other folks on this list might know how to fix this.

I start by running:

git clone https://github.com/seL4/seL4-CAmkES-L4v-dockerfiles.git
cd seL4-CAmkES-L4v-dockerfiles
make user

But the make command fails with the output appended below.
Any hints (including other places to post this question) would be much 
appreciated!

Best wishes,
Mark

__

scripts/utils/check_for_old_docker_imgs.sh
WARNING: Unable to check if your trustworthysystems docker images are getting a 
bit old!
The date command did not behave as expected. Skipping the check.
docker build --force-rm=true \
   --build-arg=USER_BASE_IMG=trustworthysystems/camkes \
   -f dockerfiles/extras.Dockerfile \
   -t extras \
   .
[+] Building 109.7s (6/6) FINISHED  
   docker:desktop-linux
=> [internal] load build definition from extras.Dockerfile  
  0.0s
=> => transferring dockerfile: 602B 
  0.0s
=> [internal] load metadata for docker.io/trustworthysystems/camkes:latest  
  1.4s
=> [internal] load .dockerignore
  0.0s
=> => transferring context: 153B
  0.0s
=> [1/2] FROM 
docker.io/trustworthysystems/camkes:latest@sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea
  96.3s
=> => resolve 
docker.io/trustworthysystems/camkes:latest@sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea2
  0.0s
=> => sha256:e943b5afb84223c55b5dfdbe2f383970021765c345c51b08fa8b9b0d4d69ccd7 
9.97kB / 9.97kB 0.3s
=> => sha256:46cbb6e89f5727950fb43b0c4b18a28073c18ad928ccf16c6e2a9f6d708ccb35 
80.82MB / 80.82MB   6.9s
=> => sha256:29206d51ef1d09bb5e1934b11a1946a13d1ab0ff7c2ff2645ea2e12c65f2 
1.79kB / 1.79kB 0.0s
=> => sha256:678186f76064904e561bbec5cc0fb200e1c7d0435dbeeaf2433d050631a132ab 
6.82kB / 6.82kB 0.0s
=> => sha256:99046ad9247f8a1cbd1048d9099d026191ad9cda63c08aadeb704b7000a51717 
31.36MB / 31.36MB   3.0s
=> => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 
32B / 32B   0.8s
=> => sha256:be52171dda4a5d045a589cf92b25fe60ac5b74dac75bb03997d5a049d47b361e 
1.15GB / 1.15GB53.1s
=> => extracting 
sha256:99046ad9247f8a1cbd1048d9099d026191ad9cda63c08aadeb704b7000a51717 
 1.2s
=> => sha256:460c68d68ad3efcc4c324e3da3ea9a8d7ebee818d87643e78fa551c90106c218 
1.19GB / 1.19GB65.4s
=> => extracting 
sha256:e943b5afb84223c55b5dfdbe2f383970021765c345c51b08fa8b9b0d4d69ccd7 
 0.0s
=> => extracting 
sha256:46cbb6e89f5727950fb43b0c4b18a28073c18ad928ccf16c6e2a9f6d708ccb35 
 3.0s
=> => extracting 
sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 
 0.0s
=> => extracting 
sha256:be52171dda4a5d045a589cf92b25fe60ac5b74dac75bb03997d5a049d47b361e 
20.1s
=> => extracting 
sha256:460c68d68ad3efcc4c324e3da3ea9a8d7ebee818d87643e78fa551c90106c218 
22.7s
=> [2/2] RUN apt-get update -q && apt-get install -y 
--no-install-recommends cowsay sudo 11.8s
=> exporting to image