overdrivenpotato / rust-psp

Rust on PSP. Panic and allocation support. Access PSP system libraries.
Other
589 stars 31 forks source link

psp-hello-world-example rust-lld: error: --strip-all and --emit-relocs may not be used together #108

Closed randomshinichi closed 2 years ago

randomshinichi commented 2 years ago

Fresh install, was looking to get started homebrewing somewhere. I still have a PSP, but what sold the deal was the incredible integration into Rust! Just like developing a normal Rust program.

Compiling the hello world example, however, failed with this.

Environment:

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/shinichi/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
bpf

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.59.0-nightly (efec54529 2021-12-04)

Error

   Compiling psp-hello-world-example v0.1.0 (/home/shinichi/source/rust-psp/examples/hello-world)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--emit-relocs" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.1dvxhiqozxhnax6p.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.1jbozp62rdtspcki.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.2f4y6geg7q8tmzzl.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.2n939cxqcyvkm4zm.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.35zh3xdcf9mnlahg.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.4l8q58w309e8uxl7.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.4tzohso5uud2lmu2.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.4uizm1it4n5rvmyj.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.4zw6ef1533g1n0n1.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.5a1sk7asrejlxhvz.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.j6mffm6lx6dvy5j.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.jup3vqfcmegl9vk.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.tbsnez2jyccmt29.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.tvoskcf6h0i6x3i.rcgu.o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a.3ugzb26hdj0rwsm3.rcgu.o" "--as-needed" "-L" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps" "-L" "/home/shinichi/source/rust-psp/examples/hello-world/target/debug/deps" "-L" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/build/psp-5331f3a82de138d9/out" "-L" "/home/shinichi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-sony-psp/lib" "--start-group" "-Bstatic" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libpsp-1b097d29e42403d7.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libbitflags-e76b5db384bd4099.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libnum_enum-bb71ad21b1bf98e3.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libpanic_unwind-0ad6e09684aafd6d.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libunwind-9f962eaf1c8fee42.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/liblibc-9919ce7872eb5b4e.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libcfg_if-a68ee819c51dc776.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/liballoc-f52b6509161d11ab.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libpaste-728a443b7a53f844.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/librustc_std_workspace_core-3ad2d07ae1915367.rlib" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libcore-3219c33cda6fbcc2.rlib" "--end-group" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/libcompiler_builtins-59551438213631d6.rlib" "-Bdynamic" "--script" "/tmp/rustcnxutzJ/rustc-mipsel-sony-psp-linkfile.ld" "--eh-frame-hdr" "-znoexecstack" "-L" "/home/shinichi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-sony-psp/lib" "-o" "/home/shinichi/source/rust-psp/examples/hello-world/target/mipsel-sony-psp/debug/deps/psp_hello_world_example-0fdc2911ce5c492a" "-O1" "-s"
  = note: rust-lld: error: --strip-all and --emit-relocs may not be used together

error: could not compile `psp-hello-world-example` due to previous error
sajattack commented 2 years ago

Did you cargo build or cargo psp?

randomshinichi commented 2 years ago

cargo psp

overdrivenpotato commented 2 years ago

This is odd, the same toolchain version works on linux for me. Maybe the lld version is off, or perhaps you have conflicting rust-llds somehow. Can you run the following from the hello-world directory:

rustc --print sysroot

And then also, to check the rust-lld version:

cd ~/.rustup/toolchains/nightly-2021-12-05-x86_64-unknown-linux-gnu/lib
LD_LIBRARY_PATH=. ./rustlib/x86_64-unknown-linux-gnu/bin/rust-lld -flavor gnu -v
randomshinichi commented 2 years ago
shinichi@asuka:~/source/rust-psp/examples/rust-std-hello-world[master] rustc --print sysroot
/home/shinichi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
shinichi@asuka:~/source/rust-psp/examples/rust-std-hello-world[master] cd ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
shinichi@asuka:~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib LD_LIBRARY_PATH=. ./rustlib/x86_64-unknown-linux-gnu/bin/rust-ll
rust-lld       rust-llvm-dwp  
shinichi@asuka:~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib LD_LIBRARY_PATH=. ./rustlib/x86_64-unknown-linux-gnu/bin/rust-lld -flavor gnu -v
LLD 13.0.0 (compatible with GNU linkers)

Today I tried to run cargo psp again, for some reason it wanted to recompile rust-psp. Then it seems every macro doesn't work...

error: cannot find macro `concat` in this scope
   --> /home/shinichi/source/rust-psp/psp/src/sys/macros.rs:176:25
    |
176 |                           concat!(
    |                           ^^^^^^
    |
   ::: /home/shinichi/source/rust-psp/psp/src/sys/display.rs:38:1
    |
38  | / psp_extern! {
39  | |     #![name = "sceDisplay"]
40  | |     #![flags = 0x4001]
41  | |     #![version = (0, 0)]
...   |
145 | |     pub fn sceDisplayIsVblank() -> i32;
146 | | }
    | |_- in this macro invocation
    |
    = note: consider importing this macro:
            core::concat
    = note: this error originates in the macro `psp_extern` (in Nightly builds, run with -Z macro-backtrace for more info)

Maybe my rustup toolchain is completely broken and I should reinstall everything?

overdrivenpotato commented 2 years ago

Could be. Try this in the hello-world directory:

cargo uninstall cargo-psp
rustup toolchain uninstall nightly
rustup toolchain install --profile default nightly
rustup override set nightly
rustup component add rust-src
cargo install cargo-psp
cargo clean
cargo psp
sajattack commented 2 years ago

Are you trying to use std? That isn't ready/recommended at this time.

overdrivenpotato commented 2 years ago

Was this resolved on your end, or possibly by one of the new library versions? I'll keep the issue open if it's still causing trouble.

overdrivenpotato commented 2 years ago

I'm assuming this has been fixed with a toolchain update, as I cannot reproduce this. Feel free to re-open this issue if it is still causing problems.