Giter VIP home page Giter VIP logo

Comments (9)

ian-h-chamberlain avatar ian-h-chamberlain commented on August 16, 2024

Unfortunately the rust3ds-template is pretty out of date and probably does not work with cargo-3ds at all.

We are in the midst of reorganizing the rust3ds organization, hopefully to make it less confusing to get started and archive some of the old repos (like rust3ds-template) that are no longer needed to get everything building...

For now, the simplest quick-start option is probably to clone https://github.com/Meziu/ctru-rs (which we are working to upstream to the rust3ds org) and try to cargo +nightly 3ds build some of the examples there: https://github.com/Meziu/ctru-rs/tree/master/ctru-rs/examples

As far as I know, those should mostly work with just ctru-rs as a dependency, which hopefully gives you a starting point to work from? We could probably stand to update the README here to make it more obvious how to get started, so perhaps this issue can be used to track that work.

Let me know if you have troubles, I'd like to make it as simple as possible for people to start using cargo-3ds and related libraries, so docs improvements should be forthcoming!

from cargo-3ds.

ian-h-chamberlain avatar ian-h-chamberlain commented on August 16, 2024

Hmm, after trying myself I realize there seems to have been a regression in std nightly for horizon (similarly, ESP-IDF and Redox had fixes around this): rust-lang/rust@e86c128

If you try with an older nightly (e.g. nightly-2022-07-18), it should work... we'll have to open a PR upstream to fix it in future versions.

from cargo-3ds.

spencerelliott avatar spencerelliott commented on August 16, 2024

Thanks for looking into this. I will try switching to a different nightly and attempt compiling again. I'll let you know if everything works.

from cargo-3ds.

spencerelliott avatar spencerelliott commented on August 16, 2024

I am able to compile the Rust source for the hello world example from the Meziu repository but the linker fails with the following error:

error: linking with `arm-none-eabi-gcc` failed: exit status: 1
  |
  = note: "arm-none-eabi-gcc" "-specs=3dsx.specs" "-mtune=mpcore" "-mfloat-abi=hard" "-mtp=soft" "/tmp/rustcGsV4aq/symbols.o" "/home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/rust3ds_template-60abccf8cfbf4027.ctru-3f8df33ef42cdc17.ctru.e2c90a4f-cgu.0.rcgu.o.rcgu.o" "-Wl,--as-needed" "-L" "/home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps" "-L" "/home/spencer/projects/rust3ds-template-master/target/debug/deps" "-L" "/opt/devkitpro//libctru/lib" "-L" "/opt/devkitpro//libctru/lib" "-L" "/home/spencer/.rustup/toolchains/nightly-2022-07-18-x86_64-unknown-linux-gnu/lib/rustlib/armv6k-nintendo-3ds/lib" "-lctru" "-Wl,-Bstatic" "/tmp/rustcGsV4aq/libctru_sys-88e3acefb5528873.rlib" "-Wl,--start-group" "-Wl,--end-group" "/home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib" "-Wl,-Bdynamic" "-lctru" "-lctru" "-lc" "-lm" "-lctru" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/spencer/.rustup/toolchains/nightly-2022-07-18-x86_64-unknown-linux-gnu/lib/rustlib/armv6k-nintendo-3ds/lib" "-o" "/home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/rust3ds_template-60abccf8cfbf4027.elf" "-Wl,--gc-sections" "-no-pie"

  = note: /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.15.rcgu.o): in function `compiler_builtins::float::conv::int_to_float::u64_to_f64_bits':
          /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:45: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:46: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:47: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:47: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:48: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.15.rcgu.o):/home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/float/conv.rs:49: more undefined references to `core::panicking::panic' follow
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.7.rcgu.o): in function `core::f64::<impl f64>::to_bits':
          /home/spencer/.rustup/toolchains/nightly-2022-07-18-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/f64.rs:934: undefined reference to `core::intrinsics::const_eval_select'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.7.rcgu.o): in function `core::f64::<impl f64>::from_bits':
          /home/spencer/.rustup/toolchains/nightly-2022-07-18-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/f64.rs:1027: undefined reference to `core::intrinsics::const_eval_select'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.9.rcgu.o): in function `compiler_builtins::arm::__aeabi_memcpy4':
          /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/arm.rs:105: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.9.rcgu.o): in function `compiler_builtins::arm::__aeabi_memset4':
          /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/arm.rs:154: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.1.rcgu.o): in function `compiler_builtins::int::specialized_div_rem::u32_normalization_shift':
          /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/int/specialized_div_rem/norm_shift.rs:64: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/int/specialized_div_rem/norm_shift.rs:66: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/int/specialized_div_rem/norm_shift.rs:69: undefined reference to `core::panicking::panic'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /home/spencer/projects/rust3ds-template-master/target/armv6k-nintendo-3ds/debug/deps/libcompiler_builtins-d99bd19cd65bc4ce.rlib(compiler_builtins-d99bd19cd65bc4ce.compiler_builtins.01645937-cgu.1.rcgu.o):/home/spencer/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.73/src/int/specialized_div_rem/delegate.rs:71: more undefined references to `core::panicking::panic' follow
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

from cargo-3ds.

Meziu avatar Meziu commented on August 16, 2024

Hmm, after trying myself I realize there seems to have been a regression in std nightly for horizon (similarly, ESP-IDF and Redox had fixes around this): rust-lang/rust@e86c128

If you try with an older nightly (e.g. nightly-2022-07-18), it should work... we'll have to open a PR upstream to fix it in future versions.

I've made a fix in my local repository (it's just 2 lines of #[cfg]). I will PR it.

from cargo-3ds.

Meziu avatar Meziu commented on August 16, 2024

I've opened rust-lang/rust#100249

from cargo-3ds.

Meziu avatar Meziu commented on August 16, 2024

I am able to compile the Rust source for the hello world example from the Meziu repository but the linker fails with the following error:

This shouldn't happen in a clean install. I'd suggest to cargo clean the project and retry. Otherwise, check your installation (correct rust-src installed, latest devkitARM etc.). What were your installation steps? @spencerelliott

from cargo-3ds.

spencerelliott avatar spencerelliott commented on August 16, 2024

Hi @Meziu, I used the devkitPro pacman command to install the latest version of devkitARM along with the examples. To install the Rust toolchain, I ran the following commands:

rustup install nightly-2022-07-18
rustup +nightly-2022-07-18 component add rust-src
cd <project directory>
rustup override set nightly-2022-07-18
cargo clean
cargo update
cargo 3ds build

While I was writing out these steps, I also looked at my Cargo.toml file and I removed the following lines that were in the rust3ds-template project:

[profile.dev]
lto = true

[profile.release]
lto = true

Now, I am able to compile the 3dsx file 👍 I guess the link-time optimizations were removing needed methods.

from cargo-3ds.

Meziu avatar Meziu commented on August 16, 2024

Indeed. Because of some issues with how the libraries are linked, lto breaks some workarounds we are currently using (mainly to link a library after it’s used…). It’s weird really, but we could not find any other way, even with the help of Rust’s maintainers.

from cargo-3ds.

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.