fernandobatels / rsfbclient

Rust Firebird Client
MIT License
76 stars 11 forks source link

Error Testing the firebird combine with rust using MacOS catalina #83

Closed a3pelawi closed 4 years ago

a3pelawi commented 4 years ago
use rsfbclient::{prelude::*, ConnectionBuilder, FbError};

fn main() {
    #[cfg(feature = "dynamic_loading")]
        let mut conn = ConnectionBuilder::with_client("/Library/Frameworks/Firebird.framework/Versions/A/Libraries/libfbclient.dylib")
        .embedded()
        .db_name("/tmp/examples.fdb")
        .user("SYSDBA")
        .connect()?;

    println!("Hello, world!");
}
Message:
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L"  /Users/.../..........
  = note: ld: library not found for -llibfbclient
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
dancingbug commented 4 years ago

are you using cargo?

please try replacing your rsfbclient dependency in Cargo.toml as follows

[dependencies]
rsfbclient = { version = "0.11.0", default_features = false, features = ["dynamic_loading","date_time"] }

and retry. Please report back with the result.

what's probably happening: the linking feature is enabled by default for rsfbclient, in your case causing the crate to look for the lib at link time and not finding it in the default library search paths of your system

other notes:

i think we will try to improve this situation in the future, it's definitely a bad out-of-the-box experience.

a3pelawi commented 4 years ago

Yes, I'm using cargo. And firebird 3.0.3. Everything is ok, I have try using Qt5 and DB Manager DBEaver, and work fine.

Ok. i'll try your advice. Sorry for my english Thanx sir 👍

a3pelawi commented 4 years ago

I have test it, and everything running well 💯 This my code,

use rsfbclient::{prelude::*, ConnectionBuilder, FbError};

fn main() -> Result<(), FbError> { let mut conn = ConnectionBuilder::pure_rust() .host("localhost") .db_name("/Path_your_db/db_test.fdb") .user("SYSDBA") .pass("masterkey") .connect()?;

let rows: Vec<(String, String, f32, i32)> = conn.query("select kode, ket, nilai, qty from tb_test", ())?;
for r in rows {
    println!("{:?}", r);
}

Ok(())

}

And for Cargo.toml

[dependencies] rsfbclient = { version = "0.11.0", default_features = false, features = ["pure_rust", "date_time"] }

Thanx sir 👍