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

Break out Lib from UI as seperate Package #31

Closed
greenfox1505 opened this issue Dec 25, 2024 · 10 comments
Closed

Break out Lib from UI as seperate Package #31

greenfox1505 opened this issue Dec 25, 2024 · 10 comments

Comments

@greenfox1505
Copy link
Contributor

I use RBoy as a library. But when compiling, I have to compile the entire prerequisite chain. This adds build time, but isn't the end of the world. I have to build winit and glium, which I don't believe the library needs. When compiling on Linux, I have to make sure I install libasound2-dev before attempting to compile, or I'll hit an an error Alsa-Sys. This is all manageable, but annoying.

Today, I tried to compile on aarch64 on x86_64. It failed because AlsaSys doesn't support cross compiling. I can compile just fine from aarch64 to aarch64 (on a Rock 5b+) , but not from my x86 build server.

The lib.rs portion of the project could still be integrated into the same repo, as long as I can reference it properly in my Cargo.toml file.

@mvdnes
Copy link
Owner

mvdnes commented Dec 26, 2024

Great to hear you using the project!

I understand your problems. I think it is a good idea to split it.
To test this change, I have created a branch librboy. If this works for you, I think it would be a good idea to merge into the main branch.

@greenfox1505
Copy link
Contributor Author

I did this: https://github.com/greenfox1505/rboy/tree/bin-as-package

I tried a thing with features as well in another branch.

@mvdnes
Copy link
Owner

mvdnes commented Dec 26, 2024

You can test my version with the following dependency specification:

[dependencies]
librboy = { git = "https://github.com/mvdnes/rboy", branch = "librboy" }

@greenfox1505
Copy link
Contributor Author

greenfox1505 commented Dec 26, 2024

I did:

[dependencies]
rboy = { git = "https://github.com/mvdnes/rboy", branch = "librboy",  package = "librboy"}

Which help minimize my changes this pass. Seems to work.

@greenfox1505
Copy link
Contributor Author

This has been working, but now I'm struggling getting it to compile for Android. Looks like blip_buff's c lib binding is breaking it now. I'm guessing this one will be harder to remove...

warning: [email protected]: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?

error: failed to run custom build command for `blip_buf-sys v0.1.4`

Caused by:
  process didn't exit successfully: `/home/greenfox/Projects/godot-boy/target/release/build/blip_buf-sys-f26917509b8caa24/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/greenfox/Projects/godot-boy/target/aarch64-linux-android/release/build/blip_buf-sys-3aa98806c53cae63/out)
  OPT_LEVEL = Some(3)
  TARGET = Some(aarch64-linux-android)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=CC_aarch64-linux-android
  CC_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CC_aarch64_linux_android
  CC_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-linux-android
  CFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_linux_android
  CFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some()

  --- stderr


  error occurred in cc-rs: Failed to find tool. Is `aarch64-linux-android-clang` installed?

@greenfox1505
Copy link
Contributor Author

Okay, I got it compiling for Android... by porting BlipBuf to pure Rust. I noticed your branch that you started like 10 years ago and just finished that.

image

This is RBoy->GodotRust GDExtention->Godot->Android.

#32
mvdnes/blip_buf-rs#3

@mvdnes
Copy link
Owner

mvdnes commented Jan 2, 2025

Wow, great to see my project used in such a way!

In the coming week I will have a bit more time to look into the best way to address this issue and that of blip_buf-rs.

@greenfox1505
Copy link
Contributor Author

greenfox1505 commented Jan 2, 2025

That issue was BlipBuf needing a C compiler. Now that it's pure-Rust, it's not an issue any more. Keeping librboy as a separate thing is a solid fix. I can close this. If BlipBuf pure-rust implementation becomes Master/Main branch, that would solve my issue.

@mvdnes
Copy link
Owner

mvdnes commented Jan 4, 2025

Does the branch gui-feature also work for your use-case?

I think this may be a better approach to appeal both to people that want to run the emulator, as those who want to use this as a library.

@mvdnes mvdnes reopened this Jan 4, 2025
@mvdnes
Copy link
Owner

mvdnes commented Jan 8, 2025

I have merged the gui-feature branch into the main branch.

@mvdnes mvdnes closed this as completed Jan 8, 2025
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

2 participants