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

Fixing Docker builds on aarch64 #44

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![](https://github.com/memgraph/rsmgclient/workflows/CI/badge.svg)](https://github.com/memgraph/rsmgclient/actions)

`rsmgclient` is [Memgraph](https://memgraph.com/) database adapter for Rust
programming language. `rsmgclient` crate is the current implementation of the
adapter. It is implemented as a wrapper around
`rsmgclient` is a [Memgraph](https://memgraph.com/) database adapter for Rust
programming language. The `rsmgclient` crate is the current implementation of
the adapter. It is implemented as a wrapper around
[mgclient](https://github.com/memgraph/mgclient), the official Memgraph C/C++
client library.

Expand All @@ -21,8 +21,8 @@ client library.

### Installing from crates.io

Once prerequisites are met, if you want to use `rsmgclient` as library for your
own Rust project, you can install it by using `cargo`:
Once prerequisites are met, if you want to use `rsmgclient` as a library for
your own Rust project, you can install it using `cargo`:

```bash
cargo install rsmgclient
Expand All @@ -33,24 +33,25 @@ if you would like to change that please provide `OPENSSL_LIB_DIR` env variable.

### Building from Source

To contribute into `rsmgclient` or just looking closely how it is made,
To contribute into `rsmgclient` or just to look more closely how it is made,
you will need:

- Cloned [rsmgclient](https://github.com/memgraph/rsmgclient) repository
- Properly initialized [mgclient](https://github.com/memgraph/mgclient), please
take care of the `mgclient` requirements
take care of the `mgclient` requirements.
- [Memgraph Quick Start Guide](https://memgraph.com/docs/memgraph/quick-start)

Once `rsmgclient` is cloned, you will need to build it and then you can run
the test suite to verify it is working correctly:

```bash
git submodule update --init
cargo build
# Please run Memgraph based on the quick start guide
cargo test
```

On MacOS, the build will try to detect OpenSSL by using MacPorts or Brew.
On MacOS, the build will try to detect OpenSSL by using MacPorts or Homebrew.

On Windows, `bindgen` requires `libclang` which is a part of LLVM. If LLVM is
not already installed just go to the [LLVM
Expand Down
3 changes: 2 additions & 1 deletion src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use super::value::{

use std::collections::HashMap;
use std::ffi::CString;
use std::os::raw::c_char;
use std::vec::IntoIter;

/// Parameters for connecting to database.
Expand Down Expand Up @@ -693,7 +694,7 @@ impl Connection {
"Unable to make pull map integer value.",
)));
}
if bindings::mg_map_insert(mg_map, "n".as_ptr() as *const i8, mg_int) != 0 {
if bindings::mg_map_insert(mg_map, "n".as_ptr() as *const c_char, mg_int) != 0 {
self.status = ConnectionStatus::Bad;
bindings::mg_map_destroy(mg_map);
bindings::mg_value_destroy(mg_int);
Expand Down
3 changes: 2 additions & 1 deletion src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::ffi::{CStr, CString};
use std::fmt;
use std::fmt::Formatter;
use std::num::TryFromIntError;
use std::os::raw::c_char;
use std::slice;

/// Representation of parameter value used in query.
Expand Down Expand Up @@ -165,7 +166,7 @@ fn mg_value_float(mg_value: *const bindings::mg_value) -> f64 {
unsafe { bindings::mg_value_float(mg_value) }
}

pub(crate) unsafe fn c_string_to_string(c_str: *const i8, size: Option<u32>) -> String {
pub(crate) unsafe fn c_string_to_string(c_str: *const c_char, size: Option<u32>) -> String {
// https://github.com/rust-lang/rust/blob/master/library/std/src/ffi/c_str.rs#L1230
let c_str = match size {
Some(x) => CStr::from_bytes_with_nul_unchecked(slice::from_raw_parts(
Expand Down