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

error: parsing package.metadata.cargo-xbuild section failed #60

Closed
parasyte opened this issue Feb 16, 2020 · 7 comments · Fixed by #61
Closed

error: parsing package.metadata.cargo-xbuild section failed #60

parasyte opened this issue Feb 16, 2020 · 7 comments · Fixed by #61

Comments

@parasyte
Copy link

I get this new error message (introduced in #57) with no additional way to diagnose the cause.

error: parsing package.metadata.cargo-xbuild section failed
note: run with `RUST_BACKTRACE=1` for a backtrace

Setting RUST_BACKTRACE=1 hides the second line from the error message and produces no backtrace.

This causes my CI to fail. E.g. https://travis-ci.org/rust-console/cargo-n64/builds/650914215

FWIW, the cargo-n64 repo is setup with a workspace manifest, and I do not have a package.metadata.cargo-xbuild section in any of the crate manifests. cargo xbuild is invoked something like this:

cargo xbuild --target=/tmp/mips-nintendo64-none.json --package=hello-ipl3font --release
Where the contents of the target JSON file is:
{
  "arch": "mips",
  "cpu": "mips3",
  "data-layout": "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S64",
  "disable-redzone": true,
  "env": "unknown",
  "executables": true,
  "features": "+mips3,+gp64,+fpxx,+nooddspreg",
  "linker": "rust-lld",
  "linker-flavor": "ld.lld",
  "llvm-target": "mips-unknown-unknown",
  "os": "none",
  "panic-strategy": "abort",
  "pre-link-args": {
    "ld.lld": [
      "--script=/tmp/linker.ld"
    ]
  },
  "relocation-model": "static",
  "target-c-int-width": "32",
  "target-endian": "big",
  "target-pointer-width": "32",
  "vendor": "nintendo64"
}
And the contents of the linker script:
ENTRY(_start)

SECTIONS {
    . = 0x80000400;
    __boot_start = .;

    .boot : {
        *(.boot)
    }

    .text : {
        *(.text .text.*)
    }

    .rodata : {
        *(.rodata .rodata.*)
    }

    .data : {
        *(.data .data.*)
    }

    .bss : {
        . = ALIGN(4);
        __bss_start = .;
        *(.bss .bss.*)
        __bss_end = .;
    }

    . = ALIGN(2);
    __rom_end = . - __boot_start + 0xB0001000;

    /DISCARD/ : {
        *(.MIPS.*)
        *(.comment)
        *(.mdebug.*)
        *(.pdr)
        *(.reginfo)

        /*
         * We may need the global offset table some day.
         * Our target is currently set with a static relocation-model, so this
         * might not be needed after all.
         */
        *(.got)
    }
}
@parasyte
Copy link
Author

I've inserted some print statements to help debug, and it is failing here:

.ok_or("Cannot infer the root project id")?;

cc @ascjones

@phil-opp
Copy link
Member

Thanks for reporting this! I can reproduce this error with your repository and I'm trying to fix it.

@phil-opp
Copy link
Member

I think I found the error. The problem is that your project is using a virtual manifest at the workspace root, which we forgot to handle in the code introduced in #57. I opened #61 to fix this. Unfortunately, we can't load any config for such projects since it's not clear which Cargo.toml should be used for loading the config. For this reason we print a warning and use the default config.

Could you try the code in #61 and test whether this approach works for you? You can install the version through:

cargo install cargo-xbuild --git https://github.com/rust-osdev/cargo-xbuild.git --branch fix-60 --debug --force

@parasyte
Copy link
Author

Thanks for the quick turnaround on this. I'll give it a shot and report back.

Side note: I'm also considering pulling cargo-xbuild as a library dependency, instead of calling the binary through the system interface. That will take care of the virtual manifest problem, since the correct manifest can be passed directly.

@phil-opp
Copy link
Member

phil-opp commented Mar 2, 2020

@parasyte Did you try whether it works for you now?

@parasyte
Copy link
Author

parasyte commented Mar 2, 2020

It works! We also got it integrated as a library. 👍

@phil-opp
Copy link
Member

phil-opp commented Mar 4, 2020

Perfect, thanks for the update!

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

Successfully merging a pull request may close this issue.

2 participants