Giter VIP home page Giter VIP logo

Comments (9)

hulkholden avatar hulkholden commented on July 28, 2024 1

Ok, I found that I set DOCKER_DEFAULT_PLATFORM to linux/amd64, everything works as expected:

% export DOCKER_DEFAULT_PLATFORM=linux/amd64
% libdragon init                            
Initializing a libdragon project at /.../test7
Downloading docker image: ghcr.io/dragonminded/libdragon:latest
latest: Pulling from dragonminded/libdragon
Digest: sha256:b658097719451d994ced50f10b72692b07c2264d260ab9956bf97987761baf3c
Status: Downloaded newer image for ghcr.io/dragonminded/libdragon:latest
ghcr.io/dragonminded/libdragon:latest
Creating new container...
Successfully initialized docker container: /epic_bouman
Initialized empty Git repository in /.../test7/.git/
Reinitialized existing Git repository in /.../test7/.git/
Cloning into '/.../test7/libdragon'...
remote: Enumerating objects: 49530, done.
remote: Counting objects: 100% (6847/6847), done.
remote: Compressing objects: 100% (960/960), done.
remote: Total 49530 (delta 5893), reused 6794 (delta 5871), pack-reused 42683
Receiving objects: 100% (49530/49530), 27.10 MiB | 25.25 MiB/s, done.
Resolving deltas: 100% (44656/44656), done.
Preparing project files...
Installing libdragon to the container...
libdragon ready at `/.../test7`.
% libdragon make 
    [CC] src/main.c
/n64_toolchain/bin/mips64-elf-gcc -c -MMD      -march=vr4300 -mtune=vr4300 -I/n64_toolchain/mips64-elf/include -falign-functions=32    -ffunction-sections -fdata-sections -g -ffile-prefix-map=/libdragon= -DN64 -O2 -Wall -Werror -Wno-error=deprecated-declarations -fdiagnostics-color=always -std=gnu99 -o build/main.o src/main.c
    [LD] build/hello.elf
/n64_toolchain/bin/mips64-elf-g++ -o build/hello.elf /n64_toolchain/mips64-elf/lib/libdragon.a /n64_toolchain/mips64-elf/lib/libdragonsys.a build/main.o -lc -Wl,-g -Wl,-L/n64_toolchain/mips64-elf/lib -Wl,-ldragon -Wl,-lm -Wl,-ldragonsys -Wl,-Tn64.ld -Wl,--gc-sections -Wl,--wrap -Wl,__do_global_ctors -Wl,-Map=build/hello.map
/n64_toolchain/bin/mips64-elf-size -G build/hello.elf
      text       data        bss      total filename
     96368      63172       3364     162904 build/hello.elf
    [Z64] hello.z64
/n64_toolchain/bin/n64sym build/hello.elf build/hello.elf.sym
/n64_toolchain/bin/mips64-elf-objcopy -O binary build/hello.elf build/hello.elf.bin
DFS_FILE=""; \
if [ -z "$DFS_FILE" ]; then \
    /n64_toolchain/bin/n64tool --header /n64_toolchain/mips64-elf/lib/header --title "Hello World" --toc --output hello.z64 build/hello.elf.bin --align 8 build/hello.elf.sym; \
else \
    /n64_toolchain/bin/n64tool --header /n64_toolchain/mips64-elf/lib/header --title "Hello World" --toc --output hello.z64 build/hello.elf.bin --align 8 build/hello.elf.sym --align 16 "$DFS_FILE"; \
fi
if [ ! -z "" ]; then \
    /n64_toolchain/bin/ed64romconfig     hello.z64; \
fi
/n64_toolchain/bin/chksum64 hello.z64 >/dev/null

So something seems a bit wonky for native OSX builds, but I think I have a workaround for now!

from libdragon.

hulkholden avatar hulkholden commented on July 28, 2024

For some reason the CLI is fetching the image tagged :latest, not :latest-arm64:

% docker image inspect ghcr.io/dragonminded/libdragon 
[
    {
        "Id": "sha256:aa80bfcfa4dff76a304601e059e603e37a77ac62dc30bcc243807d334e118150",
        "RepoTags": [
            "ghcr.io/dragonminded/libdragon:latest"
        ],
        "RepoDigests": [
...

But even if I hack the CLI to use the latest-arm64 image it still doesn't work:

% libdragon init 
Initializing a libdragon project at /.../test
Downloading docker image: ghcr.io/dragonminded/libdragon:latest-arm64
latest-arm64: Pulling from dragonminded/libdragon
c21a0233221a: Already exists 
3d3855ac9f45: Already exists 
7f13a0e732e0: Already exists 
Digest: sha256:d2046560c3c4dbc98f89606e2e0bff3d5c88325fb3a0809490ab2cf60b9a76eb
Status: Downloaded newer image for ghcr.io/dragonminded/libdragon:latest-arm64
ghcr.io/dragonminded/libdragon:latest-arm64
Reinitialized existing Git repository in /./test/.git/
Reinitialized existing Git repository in /.../dev/test/.git/
 1470903f2c416f285223c0d53287eb33c8feed49 libdragon (toolchain-continuous-prerelease-85-g1470903f)
Adding existing repo at 'libdragon' to the index
Preparing project files...
Installing libdragon to the container...
/.../test/Makefile already exists, skipping.
/.../test/src/main.c already exists, skipping.
Command docker exec --workdir /libdragon/libdragon -u 501:20 -i afa417aa758e476f1028ef7533776a401781ac56e793fa2b4e0f4ac7b22f2056 /bin/bash ./build.sh exited with code 127.
Command error output:
dumpdfs.c: In function 'main':
dumpdfs.c:801:22: warning: argument 1 value '18446744073709551611' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
             uint8_t *data = malloc( (size_t)dfs_size( fl ) );
                      ^~~~

That image also reports the version as 7.5.0.

from libdragon.

hulkholden avatar hulkholden commented on July 28, 2024

More directly:

% docker run ghcr.io/dragonminded/libdragon:latest-arm64 gcc --version  
gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Am I just confused about the readme saying Based on modern GCC (13) or is something else going on here?

from libdragon.

hulkholden avatar hulkholden commented on July 28, 2024

Ah, I see the makefile is invoking /n64_toolchain/bin/mips64-elf-gcc:

% docker exec --workdir /libdragon/libdragon -u 501:20 -i afa417aa758e476f1028ef7533776a401781ac56e793fa2b4e0f4ac7b22f2056 /bin/bash 
 /n64_toolchain/bin/mips64-elf-gcc --version
mips64-elf-gcc (GCC) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And now I see the fatal error is actually:

mksprite.c:6:10: fatal error: png.h: No such file or directory
 #include <png.h>

from libdragon.

anacierdem avatar anacierdem commented on July 28, 2024

I remember @rasky saying something around it was possible to use the same tag for the arm image. Last time I tried (been a while) this was working on macOS (M1) just fine.

from libdragon.

anacierdem avatar anacierdem commented on July 28, 2024

Also note that we don't have an automated build for arm images. It is manually released for now. I will try this on my M1 but I don't have an M2 machine.

DOCKER_DEFAULT_PLATFORM seem to just force it to use an amd64 image, so it is non-ideal. We can build an upto date arm image and investigate on it.

from libdragon.

hulkholden avatar hulkholden commented on July 28, 2024

Thanks @anacierdem. Let me know if if can test anything. I'm still learning my way around the toolchain but happy to help as I get up to speed.

from libdragon.

rasky avatar rasky commented on July 28, 2024

@hulkholden we have lately regenerated all our Docker images with GCC 13.2. Can you please try again to see if the problem solved itself?

from libdragon.

hulkholden avatar hulkholden commented on July 28, 2024

@rasky It works, thanks!

 % libdragon version
libdragon-cli v10.9.1

% libdragon init
Initializing a libdragon project at /.../temp
Downloading docker image: ghcr.io/dragonminded/libdragon:latest
latest: Pulling from dragonminded/libdragon
7f8ef08e85ad: Pull complete
18a5acfb64d1: Pull complete
d98ff5a96d26: Pull complete
Digest: sha256:6661048dd1ba88ac630e5fb1c551c0af79a465da62d8706e940e477a9abad754
Status: Downloaded newer image for ghcr.io/dragonminded/libdragon:latest
ghcr.io/dragonminded/libdragon:latest
Creating new container...
Successfully initialized docker container: /gifted_shamir
Initialized empty Git repository in /.../temp/.git/
Reinitialized existing Git repository in /.../temp/.git/
Cloning into '/.../temp/libdragon'...
remote: Enumerating objects: 53772, done.
remote: Counting objects: 100% (53771/53771), done.
remote: Compressing objects: 100% (4847/4847), done.
remote: Total 53772 (delta 49136), reused 53354 (delta 48846), pack-reused 1
Receiving objects: 100% (53772/53772), 28.54 MiB | 20.10 MiB/s, done.
Resolving deltas: 100% (49136/49136), done.
Preparing project files...
Installing libdragon to the container...
libdragon ready at `/.../temp`.

I'll experiment a bit more over the next few days and report back if I spot any other problems, but I think we can close this now. Thanks again!

from libdragon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.