Giter Site home page Giter Site logo

psp2-sys's People

Contributors

nikarh avatar pheki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

psp2-sys's Issues

Status of this org and rust std on vita

Hi,

In the last couple of weeks, I have managed to compile rust std for ps vita (via vitasdk newlib).

I have made PR's to rust-lang/libc, rust-lang/backtrace-rs, rust-random/rand, and of course rust-lang/rust. Also I made some contributions to glium and vitagl in order to make them work together. As of writing this, all of my PR's but the std itself are merged, and rust-lang/rust PR is approved, and will probably be merged soon.

Unfortunately, I don't have the capacity to test the whole scope of std, but a couple of things I've tested:

  • Allocations work (e.g. Vec)
  • Concurrency primitives work (atomics, mutexes, etc.)
  • Random works (e.g. HashMap)
  • rust-sdl2 works
  • Attempts of backtrace unwinding crash real hardware, and go into an infinite allocation loop on an emulator
  • FS access should mostly work
  • Networking is uncharted territory for now. I've tried building reqwest, but it depends on some of the tokio stuff, requiring unix sockets and select API, not sure if it would be possible to port that.

It would be amazing if there were other people willing to work on that/support that effort.
So, my question is, what's the status of this org? I think it would be nice to have some guides and examples for rust+std+vita stuff in this org.

I can't run hello_rust_world.

Environment

  • vitasdk version: vitasdk-x86_64-apple-darwin-2018-09-02_17-59-26.tar.bz2
  • os version: macOS 10.13.6
  • rustc version: 1.32.0-nightly (f1e2fa8f0 2018-11-20)
  • xargo version: 0.3.12
  • cargo version: 1.32.0-nightly (b3d0b2e54 2018-11-15)

Describe the regression

run cargo make vpk

[cargo-make] INFO - cargo-make 0.15.1
[cargo-make] INFO - Using Build File: Makefile.toml
[cargo-make] INFO - Task: vpk
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
+ '[' '!' -f common.toml ']'
[cargo-make] INFO - Setting Up Env.
[cargo-make] INFO - Running Task: init
[cargo-make] INFO - Running Task: get-target-specs
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
+ test '!' -f /Users/limitliu/.rustup/toolchains/nightly-x86_64-apple-darwin/share/targets/armv7-vita-eabihf.json
[cargo-make] INFO - Running Task: xbuild
[cargo-make] INFO - Execute Command: "xargo" "build" "--target=armv7-vita-eabihf" "--release" "-vv" "--all-features"
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ RUSTFLAGS="--sysroot /Users/limitliu/.xargo"
+ "cargo" "build" "--target=armv7-vita-eabihf" "--release" "-vv" "--all-features"
       Fresh psp2-sys v0.2.2 (/Users/limitliu/Desktop/psp2-sys)
   Compiling bare_metal_rust v0.1.0 (/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world)
     Running `rustc --crate-name bare_metal_rust src/lib.rs --color always --crate-type staticlib --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=c0b80039208fb390 -C extra-filename=-c0b80039208fb390 --out-dir /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps --target armv7-vita-eabihf -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/deps --extern psp2_sys=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps/libpsp2_sys-590770d2ca5accb7.rlib --sysroot /Users/limitliu/.xargo -L /usr/local/vitasdk/arm-vita-eabi/lib`
error[E0557]: feature has been removed
 --> src/lib.rs:2:41
  |
2 | #![feature(lang_items, core_intrinsics, panic_implementation, start, used, const_fn)]
  |                                         ^^^^^^^^^^^^^^^^^^^^
  |
note: subsumed by `#[panic_handler]`
 --> src/lib.rs:2:41
  |
2 | #![feature(lang_items, core_intrinsics, panic_implementation, start, used, const_fn)]
  |                                         ^^^^^^^^^^^^^^^^^^^^

error[E0658]: The attribute `panic_implementation` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
  --> src/lib.rs:17:3
   |
17 | #[panic_implementation]
   |   ^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(custom_attribute)] to the crate attributes to enable

error: aborting due to 2 previous errors

Some errors occurred: E0557, E0658.
For more information about an error, try `rustc --explain E0557`.
error: Could not compile `bare_metal_rust`.

Caused by:
  process didn't exit successfully: `rustc --crate-name bare_metal_rust src/lib.rs --color always --crate-type staticlib --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=c0b80039208fb390 -C extra-filename=-c0b80039208fb390 --out-dir /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps --target armv7-vita-eabihf -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/deps --extern psp2_sys=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps/libpsp2_sys-590770d2ca5accb7.rlib --sysroot /Users/limitliu/.xargo -L /usr/local/vitasdk/arm-vita-eabi/lib` (exit code: 1)
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

So, I edit lib.rs and cargo make vpk.

lib.rs

#![allow(dead_code, unused_imports, unused_variables, unused_macros, unused_parens)]
#![feature(lang_items, core_intrinsics, start, const_fn)]
#![no_std]

extern crate psp2_sys as psp2;

mod debug;

use core::fmt::Write;
use core::intrinsics;
use core::panic::PanicInfo;

#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn eh_personality() {}

#[panic_handler]
#[no_mangle]
fn panic(_info: &PanicInfo) -> ! {
    unsafe { intrinsics::abort() }
}

#[no_mangle]
pub unsafe fn main(_argc: isize, _argv: *const *const u8) -> isize {
    let mut screen = debug::screen::DebugScreen::new();
    write!(screen, "This bare-metal is starting to rust!\n");
    psp2::kernel::threadmgr::sceKernelDelayThread(1 * 1000000); // Wait for 1 second
    write!(screen, "See ? I told you !\n");
    psp2::kernel::threadmgr::sceKernelDelayThread(3 * 1000000);
    psp2::kernel::processmgr::sceKernelExitProcess(0);
    return 0;
}

#[start]
#[no_mangle]
pub unsafe fn _start(argc: isize, argv: *const *const u8) -> isize {
    main(argc, argv)
}

And run cargo make vpk

[cargo-make] INFO - cargo-make 0.15.1
[cargo-make] INFO - Using Build File: Makefile.toml
[cargo-make] INFO - Task: vpk
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
+ '[' '!' -f common.toml ']'
[cargo-make] INFO - Setting Up Env.
[cargo-make] INFO - Running Task: init
[cargo-make] INFO - Running Task: get-target-specs
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
+ test '!' -f /Users/limitliu/.rustup/toolchains/nightly-x86_64-apple-darwin/share/targets/armv7-vita-eabihf.json
[cargo-make] INFO - Running Task: xbuild
[cargo-make] INFO - Execute Command: "xargo" "build" "--target=armv7-vita-eabihf" "--release" "-vv" "--all-features"
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ RUSTFLAGS="--sysroot /Users/limitliu/.xargo"
+ "cargo" "build" "--target=armv7-vita-eabihf" "--release" "-vv" "--all-features"
   Compiling psp2-sys v0.2.2 (/Users/limitliu/Desktop/psp2-sys)
     Running `rustc --crate-name build_script_build /Users/limitliu/Desktop/psp2-sys/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' -C metadata=d002191daee1ee27 -C extra-filename=-d002191daee1ee27 --out-dir /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/build/psp2-sys-d002191daee1ee27 -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/deps`
     Running `/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/build/psp2-sys-d002191daee1ee27/build-script-build`
[psp2-sys 0.2.2] cargo:rustc-link-search=/usr/local/vitasdk/arm-vita-eabi/lib
     Running `rustc --crate-name psp2_sys /Users/limitliu/Desktop/psp2-sys/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort --cfg 'feature="default"' -C metadata=590770d2ca5accb7 -C extra-filename=-590770d2ca5accb7 --out-dir /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps --target armv7-vita-eabihf -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/deps --sysroot /Users/limitliu/.xargo -L /usr/local/vitasdk/arm-vita-eabi/lib`
warning: literal out of range for isize
  --> /Users/limitliu/Desktop/psp2-sys/src/dialog/message.rs:10:34
   |
10 |     SCE_MSG_DIALOG_ERROR_PARAM = 0x80100A01, // Illegal parameter
   |                                  ^^^^^^^^^^
   |
   = note: #[warn(overflowing_literals)] on by default
   = note: the literal `0x80100A01` (decimal `2148534785`) does not fit into an `isize` and will become `-2146432511isize`

warning: literal out of range for isize
  --> /Users/limitliu/Desktop/psp2-sys/src/system_param.rs:18:37
   |
18 |     SCE_SYSTEM_PARAM_ID_MAX_VALUE = 0xFFFFFFFF,
   |                                     ^^^^^^^^^^
   |
   = note: the literal `0xFFFFFFFF` (decimal `4294967295`) does not fit into an `isize` and will become `-1isize`

warning: literal out of range for isize
  --> /Users/limitliu/Desktop/psp2-sys/src/system_param.rs:64:39
   |
64 |     SCE_SYSTEM_PARAM_LANG_MAX_VALUE = 0xFFFFFFFF,
   |                                       ^^^^^^^^^^
   |
   = note: the literal `0xFFFFFFFF` (decimal `4294967295`) does not fit into an `isize` and will become `-1isize`

warning: literal out of range for isize
  --> /Users/limitliu/Desktop/psp2-sys/src/system_param.rs:71:47
   |
71 |     SCE_SYSTEM_PARAM_ENTER_BUTTON_MAX_VALUE = 0xFFFFFFFF,
   |                                               ^^^^^^^^^^
   |
   = note: the literal `0xFFFFFFFF` (decimal `4294967295`) does not fit into an `isize` and will become `-1isize`

   Compiling bare_metal_rust v0.1.0 (/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world)
     Running `rustc --crate-name bare_metal_rust src/lib.rs --color always --crate-type staticlib --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto -C metadata=c0b80039208fb390 -C extra-filename=-c0b80039208fb390 --out-dir /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps --target armv7-vita-eabihf -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps -L dependency=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/release/deps --extern psp2_sys=/Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world/target/armv7-vita-eabihf/release/deps/libpsp2_sys-590770d2ca5accb7.rlib --sysroot /Users/limitliu/.xargo -L /usr/local/vitasdk/arm-vita-eabi/lib`
warning: unused `core::result::Result` that must be used
  --> src/lib.rs:26:5
   |
26 |     write!(screen, "This bare-metal is starting to rust!\n");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_must_use)] on by default
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

warning: unused `core::result::Result` that must be used
  --> src/lib.rs:28:5
   |
28 |     write!(screen, "See ? I told you !\n");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

    Finished release [optimized] target(s) in 1.27s
[cargo-make] INFO - Running Task: patch-cc-specs
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
+ test '!' -f target/armv7-vita-eabihf/release/specs
+ cd /Users/limitliu/Desktop/psp2-sys/examples/hello_rust_world
++ dirname target/armv7-vita-eabihf/release/specs
+ mkdir -p target/armv7-vita-eabihf/release
+ arm-vita-eabi-gcc -dumpspecs
+ sed -i 's/%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}//g' target/armv7-vita-eabihf/release/specs
sed: 1: "target/armv7-vita-eabih ...": undefined label 'arget/armv7-vita-eabihf/release/specs'
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Lang item first defined in crate 'panic unwind' (which std depends on)

When i run "cargo make" i end up with this error :

error[E0152]: found duplicate lang item `eh_personality`
  --> src/lib.rs:21:1
   |
21 | pub extern "C" fn eh_personality() {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: the lang item is first defined in crate `panic_unwind` (which `std` depends on)
   = note: first definition in `panic_unwind` loaded from /home/ykafia/.rustup/toolchains/nightly-2021-04-15-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-c2ca47afdcc5e309.rlib
   = note: second definition in the local crate (`vita1`)

I'm using nightly since stable gives me this error :

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /home/ykafia/psp2-sys/src/lib.rs:1:1
  |
1 | #![feature(extern_types)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^

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.