Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build of examples with added c file fails. #12

Open
dmitsuki opened this issue Apr 2, 2021 · 2 comments
Open

Build of examples with added c file fails. #12

dmitsuki opened this issue Apr 2, 2021 · 2 comments

Comments

@dmitsuki
Copy link

dmitsuki commented Apr 2, 2021

Build of examples with added c file fails. There is a warning

warning(link): unexpected LLD stderr:
ld.lld: warning: Linking two modules of different target triples: C:\Users***\Desktop\ZigGBA-master\zig-cache\o\2e71dea1b90155b4f26cf1ea3866b2fd\keydemo.o' is 'thumb-unknown-unknown-eabi' whereas 'ld-temp.o' is 'armv4t-unknown-unknown-eabi'

for every failed demo

@jakehemmerle
Copy link

was this resolved? I seem to be having a similar issue but I'm not sure why. MacOS linker maybe?

@t56k
Copy link

t56k commented May 18, 2024

+1 on this issue if the project is still kicking. I'm running a nix flake to get the dev env up:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    devkit.url = "github:bandithedoge/devkitNix";
    mach.url = "github:Cloudef/mach-flake";
  };

  outputs = {
    nixpkgs,
    flake-utils,
    devkit,
    mach,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
        overlays = [devkit.overlays.default];
      };
      env = mach.outputs.mach-env.${system} {
        enableWayland = true;
      };
      system-triple = env.lib.zigTripleFromString "thumb-unknown-unknown-eabi";

    in with builtins; with env.lib; with env.pkgs.lib; {
      devShells.default = env.mkShell {
        buildInputs = [pkgs.devkitNix.devkitARM pkgs.mgba pkgs.python3];
        shellHook = ''
          ${pkgs.devkitNix.devkitARM.shellHook}
        '';
      };

      packages.target = genAttrs allTargetTriples (target: env.packageForTarget target ({
        src = cleanSource ./.;

        nativeBuildInputs = with env.pkgs; [ devkitNix.devkitARM gcc ];
        buildInputs = with env.pkgsForTarget target; [ devkitNix.devkitARM ];

        # Smaller binaries and avoids shipping glibc.
        # XXX: Disabled for now due to builds failing.
        zigPreferMusl = false;

        # This disables LD_LIBRARY_PATH mangling, binary patching etc...
        # The package won't be usable inside nix.
        zigDisableWrap = true;
        zigBuildFlags = [ "-Doptimize=ReleaseSmall" ];
      }));

      # nix build .
      packages.default = pkgs.target.${system-triple}.override {
        # Prefer nix friendly settings.
        zigPreferMusl = false;
        zigDisableWrap = false;
        preBuild = pkgs.devkitNix.devkitARM.shellHook;
      };

      # nix run .#build
      apps.build = env.app [] "zig build \"$@\"";

      # nix run .#test
      apps.test = env.app [] "zig build test -- \"$@\"";

      # nix run .#updateMachDeps
      apps.updateMachDeps = env.updateMachDeps;

      # nix run .#deps
      apps.deps = env.showExternalDeps;
    });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants