fernandobatels / rsfbclient

Rust Firebird Client
MIT License
76 stars 11 forks source link

Link failure #118

Closed denis-papin closed 3 years ago

denis-papin commented 3 years ago

I tried to compile and run the examples on my Windows 10 machine. I bumped into a list of error messages like

  = note: librsfbclient_native-2add0a40d62a8955.rlib(rsfbclient_native-2add0a40d62a8955.rsfbclient_native.3bddf0c6-cgu.15.rcgu.o) : error LNK2019: unresolved external symbol isc_attach_database referenced in function _ZN90_$LT$rsfbclient_native..ibase..IBaseLinking$u20$as$u20$rsfbclient_native..ibase..IBase$GT$19isc_attach_database17h75cb47fbbf5608e5E

So I setup my LIBRARY_PATH and LD_LIBRARY_PATH to a folder this all the firebird DLL Nothing worked.

I have also copied those DLLs in my System32 folder. Same failure.

rustc 1.56.0-nightly Windows 10 (uptodate) Firefox 4 (and tried also with Firefox 3.0.7)

What am I not doing well ?

fernandobatels commented 3 years ago

How are you running the examples? Have you tried the pure_rust or the dynamic loading?

denis-papin commented 3 years ago

I have tried all the modes, but for example, I created a simple fb_test.rs in my project :

#[allow(clippy::unnecessary_wraps)]
pub fn fb() -> anyhow::Result<()> {

    let db_file = r#"C:\Users\denis\app\fb\examples\empbuild\EMPLOYEE.FDB"#;

    let mut _conn = rsfbclient::builder_native()
        .with_dyn_load("./fbclient_ms.lib")
        .with_remote()
        .db_name(db_file)
        .user("sysdba")
        .pass("masterkey")
        .connect()?;

    Ok(())
}

#[cfg(test)]
mod tests {
    use crate::fb_test::fb;
    #[test]
    fn run() {
        fb();
    }
}

Then I enabled the "dynamic_loading" feature in the Cargo.toml

rsfbclient = { version = "0.17.0", features = ["dynamic_loading"] }

And when I do a cargo build, I run into the LINK ERROR.

Even with the "pure_rust", I get the same LINK ERROR, which is very strange.

I am going to put the code on github in a few minutes.

denis-papin commented 3 years ago

source

Actually, when I build on this test project, it's fine. But when I run my test

cargo test --package fb_test --bin fb_test fb_test::tests

I get the link error.

fernandobatels commented 3 years ago

I don't have a windows environment here. But I think you need to specify the firebird.lib instead of firebird_ms.lib. Like this example.

fernandobatels commented 3 years ago

Even with the "pure_rust", I get the same LINK ERROR, which is very strange.

Please, try disable the default features when using the pure_rust:

rsfbclient = { version = "0.17.0", features = ["pure_rust"], default-features = false }
denis-papin commented 3 years ago

It works in "pure_rust" mode with "default-features = false".