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

Dynamic Libraries cant be found with CLI (on certain platforms) #2

Closed
lee-orr opened this issue Aug 19, 2023 · 12 comments
Closed

Dynamic Libraries cant be found with CLI (on certain platforms) #2

lee-orr opened this issue Aug 19, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@lee-orr
Copy link
Owner

lee-orr commented Aug 19, 2023

Version

0.0.4

Operating system & version

Linux

Additional information

Currently a potential solution to this would involve the cargo crate directly for at least the initial compilation of the library, which would allow the CLI to grab the environment info more easily and pass it to the dynamic linker. See for reference: https://github.com/rust-lang/cargo/blob/80eca0e58fb2ff52c1e94fc191b55b37ed73e0e4/src/cargo/core/compiler/compilation.rs#L286

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 22, 2023

Updated & released a likely fix in 0.0.6 (https://github.com/lee-orr/dexterous_developer/actions/runs/5944419939) - awaiting feedback from original reporter before closing.

@lee-orr lee-orr added the bug Something isn't working label Aug 22, 2023
@wtfamidoingrn
Copy link

wtfamidoingrn commented Aug 23, 2023

I think this bug still persist.
When running dexterous_developer_cli (v0.0.7) on linux, I get Error loading library: DlOpen { desc: "libbevy_dylib-15d68d742ee77b1e.so: cannot open shared object file: No such file or directory" }.

Is there currently any known workaround?

Update: When running cargo b while dexterous_developer is running it seems to find the library but instantly crashes with Can't find main function.

Update 2: When adding both the dexterous_developer/hot_internal and bevy/dynamic_linking features to cargo b it does not find the library again. However, if I only add dexterous_developer/hot_internal, it loads the library and finds the main function but tries to allocate 1091072630197896323 bytes and crashes while building the Hot Reload Plugin.

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 23, 2023

I did just test a potential workaround, though I can't guarantee it on linux since I've had some issues setting up a linux environment...

What you can do is create a new launcher crate in your workspace, adding a single dependency:

[dependencies]
dexterous_developer = { version = "0.0.7", default-features = false, features = [
    "hot",
    "cli",
] }

and then in main.rs for this launcher crate, run the app like so:

use dexterous_developer::HotReloadOptions;

fn main() {
    dexterous_developer::run_reloadabe_app(HotReloadOptions {
        package: Some("NAME_OF_YOUR_GAME_PACKAGE".to_string()),
        ..Default::default()
    })
}

You should then be able to use cargo run -p launcher to get the app to run.

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 23, 2023

I did add this process to the docs, though they are still building ATM so I replicated it here. LMK i fthat works!

@wtfamidoingrn
Copy link

I still get the same error message...

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 23, 2023

OK - good to know. In that case, unfortunately I'm not aware of any workarounds ATM. I'm currently working on creating some automated tests that I'd be able to run on linux, mac & CI since so far all my tests were windows based. I'll update here when I have a solution.

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 28, 2023

@wtfamidoingrn - It took some time, but I finally think this issue is actually resolved, and am able to get automated tests validating it on windows, linux & mac. However, I wanted to ask if you'd be willing to check it in your setup after updating the CLI & dependency to 0.0.8?

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 28, 2023

(Closing for now, will re-open if the issue persists for @wtfamidoingrn)

@lee-orr lee-orr closed this as completed Aug 28, 2023
@wtfamidoingrn
Copy link

wtfamidoingrn commented Aug 29, 2023

It works perfectly fine now. Thanks alot.
It took me some time to get things working because I use mold as a linker and I didn't have lld installed and messed things up during installation but that's entirely due to my own incompetence...

Only things I see that could be a bug is it saying "Running None with []" twice upon starting dexterous_developer_cli and an error log saying Reloadable App Error: LibraryHolderNotSet.

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 29, 2023

Awesome! I'm gald it works. I really should add support for mold as well, just haven't used it myself yet... Did the correct error show up letting you know that lld wasn't installed?

As for those errors - they are not a problem, but I can see why they look like an issue. I'll see if I can clean that up, so it doesn't end cause concern.

@wtfamidoingrn
Copy link

Yes it did say something like "Can't find lld".

@lee-orr
Copy link
Owner Author

lee-orr commented Aug 30, 2023

Perfect - thanks! I'll ping you for the next release, which should have mold support. (ATM there's a few other features I want in, but it's already merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants