0

I am trying to set up Solana to Windows 10, when I run the "cargo test" command after build, I get an error message like:

error[E0433]: failed to resolve: could not find `unix` in `os`
   --> geyser-plugin-manager\src\geyser_plugin_manager.rs:395:43
    |
395 |             Library::from(libloading::os::unix::Library::this()),
    |                                           ^^^^ could not find `unix` in `os`
    |
help: consider importing one of these items
    |
380 +     use crate::geyser_plugin_manager::Library;
    |
380 +     use libloading::Library;
    |
380 +     use libloading::os::windows::Library;
    |
help: if you import `Library`, refer to it directly
    |
395 -             Library::from(libloading::os::unix::Library::this()),
395 +             Library::from(Library::this()),
    |

This part is in geyser_plugin_manager.rs file, the related code part:

pub(super) fn dummy_plugin_and_library<P: GeyserPlugin>(
        plugin: P,
        config_path: &'static str,
    ) -> (Box<dyn GeyserPlugin>, Library, &'static str) {
        (
            Box::new(plugin),
            Library::from(libloading::os::windows::Library::this()),
            config_path,
        )
    }

When I changed this line with

Library::from(Library::this()),

I get this error:

error[E0599]: no function or associated item named `this` found for struct `libloading::Library` in the current scope
   --> geyser-plugin-manager\src\geyser_plugin_manager.rs:395:36
    |
395 |             Library::from(Library::this()),
    |                                    ^^^^ function or associated item not found in `Library`

In addition, When I try

Library::from(libloading::os::windows::Library::this()),

I get this error:

Type mismatch 
[E0308] expected `libloading::os::windows::Library`, but found `Result<libloading::os::windows::Library, Error>`

enter image description here

How can I fix it?

1 Answer 1

0

It looks like this() is inconsistent between unix and windows. On unix, it returns Library, but on windows, it returns Result<Library, Error>. If you want to fix the last bug you're seeing, you can simply do:

Library::from(libloading::os::windows::Library::this().unwrap()),

But to be honest, I'm not sure that geyser will work on Windows. I hope I'm wrong on that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.