Code Monkey home page Code Monkey logo

croaring-rs's People

Contributors

a14e avatar andreas avatar antiochp avatar ariesdevil avatar besquared avatar carols10cents avatar dependabot[bot] avatar dr-emann avatar frostred avatar hashmap avatar kerollmops avatar lemire avatar linxgnu avatar malbarbo avatar malthe avatar nemo157 avatar quentinlesceller avatar roncohen avatar saulius avatar trevyn avatar vorot93 avatar yihuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

croaring-rs's Issues

Treemap::andnot_inplace clears the treemap when comparing to empty treemap

I dont know of this is intended behavior or a bug, but if you have two treemaps with one empty, it will clear the other one as well. Running the following code reproduces the error:

let mut treemap1 = Treemap::create();

treemap1.add(15);

let mut treemap2 = Treemap::create();

treemap1.andnot_inplace(&treemap2);

assert_eq!(treemap1.cardinality(), 1);
assert!(treemap1.contains(15));

The test will fail, and if read the documentation right it should not.

Serialization always starts with same bytes

I don't have enough time to dive into the serialization code, however, it appears that the first bytes of every serialized bitmap are 0x3b 30 00 00 01 00 00.

Are there any cases in which these are different? Can these be removed and added back on my end?

build failing on musl libc

croaring-rs is failing on musl libc distributions like alpine (podman run --rm -it alpine:3.15)
steps:

apk add clang lld curl git openssh-client build-base protoc openssl3-dev llvm-dev && \
curl -q --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -qy && \
source $HOME/.cargo/env && \
git clone --recursive https://github.com/saulius/croaring-rs /croaring-rs && \
cd /croaring-rs/croaring-sys/ && \
RUST_BACKTRACE=full cargo build

backtrace:

   Compiling croaring-sys v0.5.1 (/croaring-rs/croaring-sys)
error: failed to run custom build command for `croaring-sys v0.5.1 (/croaring-rs/croaring-sys)`

Caused by:
  process didn't exit successfully: `/croaring-rs/target/debug/build/croaring-sys-c8f4e4f44dbf8fe6/build-script-build` (exit status: 101)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-musl")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-musl")
  CC_x86_64-unknown-linux-musl = None
  CC_x86_64_unknown_linux_musl = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-musl = None
  CFLAGS_x86_64_unknown_linux_musl = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/croaring-rs/target/debug/build/croaring-sys-fcf69fc1be8b5492/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
  exit status: 0
  AR_x86_64-unknown-linux-musl = None
  AR_x86_64_unknown_linux_musl = None
  HOST_AR = None
  AR = None
  running: "ar" "cq" "/croaring-rs/target/debug/build/croaring-sys-fcf69fc1be8b5492/out/libroaring.a" "/croaring-rs/target/debug/build/croaring-sys-fcf69fc1be8b5492/out/CRoaring/roaring.o"
  exit status: 0
  running: "ar" "s" "/croaring-rs/target/debug/build/croaring-sys-fcf69fc1be8b5492/out/libroaring.a"
  exit status: 0
  cargo:rustc-link-lib=static=roaring
  cargo:rustc-link-search=native=/croaring-rs/target/debug/build/croaring-sys-fcf69fc1be8b5492/out

  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib/libclang.so.12 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2144:31
  stack backtrace:
     0:     0x7f715375ed1c - std::backtrace_rs::backtrace::libunwind::trace::hc1bc96ddb4426aa4
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
     1:     0x7f715375ed1c - std::backtrace_rs::backtrace::trace_unsynchronized::h923980a653d66493
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x7f715375ed1c - std::sys_common::backtrace::_print_fmt::h9c757c85a437b931
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:67:5
     3:     0x7f715375ed1c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4daee6a3bf7c86e
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:46:22
     4:     0x7f71537998ec - core::fmt::write::hb92fcd00ba9c1ad2
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/fmt/mod.rs:1163:17
     5:     0x7f715375a785 - std::io::Write::write_fmt::he1040163a0175759
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/io/mod.rs:1696:15
     6:     0x7f71537609e0 - std::sys_common::backtrace::_print::h41aed1f85e85fe81
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:49:5
     7:     0x7f71537609e0 - std::sys_common::backtrace::print::h80502ae1de52b70b
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:36:9
     8:     0x7f71537609e0 - std::panicking::default_hook::{{closure}}::ha8bcafa5b9176f3f
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:210:50
     9:     0x7f7153760595 - std::panicking::default_hook::hfaee58ed0a065bec
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:227:9
    10:     0x7f7153761094 - std::panicking::rust_panic_with_hook::h8ce3328d937db5aa
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:624:17
    11:     0x7f7153760b70 - std::panicking::begin_panic_handler::{{closure}}::h1f2295b855ba5030
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:521:13
    12:     0x7f715375f1c4 - std::sys_common::backtrace::__rust_end_short_backtrace::h17092a58b60b0566
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:139:18
    13:     0x7f7153760ad9 - rust_begin_unwind
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
    14:     0x7f71531d6631 - core::panicking::panic_fmt::hcf6bd03e382adeab
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
    15:     0x7f71531d6723 - core::result::unwrap_failed::h831f708977462148
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/result.rs:1616:5
    16:     0x7f71533055a3 - core::result::Result<T,E>::expect::hd3f8e832994fe1f2
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/result.rs:1258:23
    17:     0x7f715324736d - <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref::__static_ref_initialize::h89ea8f15e31a9c42
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2144:13
    18:     0x7f715324736d - core::ops::function::FnOnce::call_once::h39b02bfd30e8e1bc
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
    19:     0x7f715327c8b7 - lazy_static::lazy::Lazy<T>::get::{{closure}}::h2e574b30351a1a1a
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:31:29
    20:     0x7f715327d57e - std::sync::once::Once::call_once::{{closure}}::hde3635e6eaafb54f
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sync/once.rs:262:41
    21:     0x7f71531d5858 - std::sync::once::Once::call_inner::hc80c2db9bc163fc9
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sync/once.rs:419:21
    22:     0x7f715327d465 - std::sync::once::Once::call_once::hb9c2f4150c255309
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sync/once.rs:262:9
    23:     0x7f7153269a56 - lazy_static::lazy::Lazy<T>::get::h7d7d6f5f8addc658
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:30:9
    24:     0x7f7153269a56 - <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref::__stability::h037f866cd6989a59
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:142:21
    25:     0x7f7153269a56 - <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref::hb65f708a7f889169
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:144:17
    26:     0x7f7153261025 - bindgen::ensure_libclang_is_loaded::hccdd5926b9352c21
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2152:33
    27:     0x7f71532615fa - bindgen::Bindings::generate::h76bd14a9da93f2a1
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2211:9
    28:     0x7f715325f6a3 - bindgen::Builder::generate::hb3d6f799a7d70937
                                 at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:1478:9
    29:     0x7f71531d839a - build_script_build::main::h134bd2bc72ec9086
                                 at /croaring-rs/croaring-sys/build.rs:17:20
    30:     0x7f71531d85fb - core::ops::function::FnOnce::call_once::h18d42bc5e7b50183
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
    31:     0x7f71531d8aee - std::sys_common::backtrace::__rust_begin_short_backtrace::h510065a4f94d5d6b
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:123:18
    32:     0x7f71531d70d1 - std::rt::lang_start::{{closure}}::hc335cc61f4150ebc
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/rt.rs:146:18
    33:     0x7f715375e9f1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37d528e2b7386a19
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:259:13
    34:     0x7f715375e9f1 - std::panicking::try::do_call::h21f3d980e271aebe
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:403:40
    35:     0x7f715375e9f1 - std::panicking::try::h6366c75894a5ee3f
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:367:19
    36:     0x7f715375e9f1 - std::panic::catch_unwind::hbab33c6a69c714f4
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panic.rs:133:14
    37:     0x7f715375e9f1 - std::rt::lang_start_internal::{{closure}}::h4a2c188522fb7f4a
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/rt.rs:128:48
    38:     0x7f715375e9f1 - std::panicking::try::do_call::h9b4b672a4b3537ad
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:403:40
    39:     0x7f715375e9f1 - std::panicking::try::h9c95acfa69428cd5
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:367:19
    40:     0x7f715375e9f1 - std::panic::catch_unwind::h137c802160173f20
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panic.rs:133:14
    41:     0x7f715375e9f1 - std::rt::lang_start_internal::h89221b25a17002da
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/rt.rs:128:20
    42:     0x7f71531d70a0 - std::rt::lang_start::hc122dfcc67f5fe2f
                                 at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/rt.rs:145:17
    43:     0x7f71531d859c - main

Consider supporting a later version of the bindgen

In croaring-sys Cargo.toml, it require bindgen's version cannot exceed 0.49.

bindgen = ">= 0.37, <= 0.49"

If a project depends on other C wrappers, a compilation error will occur.

error:  multiple packages link to native library `clang`, but a native library can be linked only once

Possible Breaking changes to make

It seems we want to do some breaking changes

Trying to use this as a list of possible breaking changes we might want to make

  • Refactor Serialization for Bitmaps and Treemaps to use traits like in #106.

    Should we also try to future proof ourselves to have a ViewDeserializer vs UncheckedViewDeserializer (I'm expecting a safe view function at some point)

  • I would love to change Bitmap/Treemap::create to Bitmap/Treemap::new, to match usual rust types

  • Likewise, create_with_capacity -> with_capacity (like Vec)

Make -march=native entirely optional to the build in croaring-sys

The -march=native flag severely limits compatibility with a variety of hardware other than the cpu it was built on and direct descendants of it. So it can be pretty destructive if you are trying to release binaries and not have people compile it them themselves. To create portable binaries this flag must not be present.

The current problem is this flag is included in the build if the compiler supports it, which means that in a great majority of cases this flag will be passed where in many cases this is not the desired result that the programmer is trying to achieve.

Admittedly I have run into this footgun before.

This needs to be removed:
https://github.com/saulius/croaring-rs/blob/cf74f5749fd77d485e74002cd20ca27be23b53ad/croaring-sys/build.rs#L10-L11

I'd suggest rather assigning this to an environment variable where it can be checked by the build.rs script and used if needed. You could also probably indicate that this flag be put into the CFLAGS and CXXFLAGS variables which would be picked up by the C compiler at build time.

macOS Sonoma builds fail

Hi, when building for macOS or iOS on macOS Sonoma using Rust versions 1.67.1 or 1.72.0, I get the following errors:

error: expected one of `:`, `;`, or `=`, found `(`
 --> /Users/user/src/stack_wallet/crypto_plugins/flutter_libepiccash/scripts/ios/build/rust/target/aarch64-apple-ios/release/build/stack-croaring-sys-1c707c2e04b5e3ce/out/croaring-sys.rs:3:3660
  |
3 | ...st SERIALIZATION_CONTAINER : u32 = 2 ; pub const enum_(unnamed_at_CRoaring/roaring_h_27_1)_ROARING_VERSION_MAJOR : enum_(unnamed_at_CRoaring/ro...
  |                                                          ^ expected one of `:`, `;`, or `=`

error: missing type for `const` item
 --> /Users/user/src/stack_wallet/crypto_plugins/flutter_libepiccash/scripts/ios/build/rust/target/aarch64-apple-ios/release/build/stack-croaring-sys-1c707c2e04b5e3ce/out/croaring-sys.rs:3:3660
  |
3 | ...IALIZATION_CONTAINER : u32 = 2 ; pub const enum_(unnamed_at_CRoaring/roaring_h_27_1)_ROARING_VERSION_MAJOR : enum_(unnamed_at_CRoaring/roaring_...
  |                                                    ^ help: provide a type for the item: `: <type>`

The following warnings were emitted during compilation:

warning: CRoaring/roaring.c:11924:13: warning: variable 'run_count' set but not used [-Wunused-but-set-variable]
warning:         int run_count = 0;
warning:             ^
warning: CRoaring/roaring.c:248:20: warning: unused function 'croaring_avx2' [-Wunused-function]
warning: static inline bool croaring_avx2() {
warning:                    ^
warning: CRoaring/roaring.c:456:19: warning: unused function 'hammingbackup' [-Wunused-function]
warning: static inline int hammingbackup(uint64_t x) {
warning:                   ^
warning: CRoaring/roaring.c:1704:20: warning: unused function 'array_container_clear' [-Wunused-function]
warning: static inline void array_container_clear(array_container_t *array) {
warning:                    ^
warning: CRoaring/roaring.c:1929:20: warning: unused function 'array_container_add' [-Wunused-function]
warning: static inline bool array_container_add(array_container_t *arr, uint16_t value) {
warning:                    ^
warning: CRoaring/roaring.c:2057:20: warning: unused function 'array_container_add_range' [-Wunused-function]
warning: static inline void array_container_add_range(array_container_t *array,
warning:                    ^
warning: CRoaring/roaring.c:2224:20: warning: unused function 'bitset_container_unset' [-Wunused-function]
warning: static inline void bitset_container_unset(bitset_container_t *bitset,
warning:                    ^
warning: CRoaring/roaring.c:2337:20: warning: unused function 'bitset_container_nonzero_cardinality' [-Wunused-function]
warning: static inline bool bitset_container_nonzero_cardinality(
warning:                    ^
warning: CRoaring/roaring.c:2884:20: warning: unused function 'run_container_clear' [-Wunused-function]
warning: static inline void run_container_clear(run_container_t *run) {
warning:                    ^
warning: CRoaring/roaring.c:3186:20: warning: unused function 'run_container_add_range' [-Wunused-function]
warning: static inline void run_container_add_range(run_container_t* run,
warning:                    ^
warning: CRoaring/roaring.c:4301:27: warning: unused function 'get_container_name' [-Wunused-function]
warning: static inline const char *get_container_name(uint8_t typecode) {
warning:                           ^
warning: CRoaring/roaring.c:7045:20: warning: unused function 'tellmeall' [-Wunused-function]
warning: static inline void tellmeall() {
warning:                    ^
warning: 12 warnings generated.

error: could not compile `stack-croaring-sys` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
[ERROR cargo_lipo] Failed to build "epic-cash-wallet" for "aarch64-apple-ios": Executing CARGO="/Users/user/.rustup/toolchains/1.72.0-aarch64-apple-darwin/bin/cargo" CARGO_HOME="/Users/user/.cargo" DYLD_FALLBACK_LIBRARY_PATH="/Users/user/.rustup/toolchains/1.72.0-aarch64-apple-darwin/lib:/Users/user/lib:/usr/local/lib:/usr/lib" HOME="/Users/user" LANG="en_US.UTF-8" LOGNAME="user" OLDPWD="/Users/user/src/stack_wallet/crypto_plugins/flutter_libepiccash/scripts/ios" PATH="/Users/user/.cargo/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin" PWD="/Users/user/src/stack_wallet/crypto_plugins/flutter_libepiccash/scripts/ios/build/rust" RUSTUP_HOME="/Users/user/.rustup" RUSTUP_TOOLCHAIN="1.72.0-aarch64-apple-darwin" RUST_RECURSION_COUNT="1" SHELL="/bin/zsh" SHLVL="2" SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.5d5S4icp7v/Listeners" TERM="xterm-256color" TERM_PROGRAM="Apple_Terminal" TERM_PROGRAM_VERSION="452" TERM_SESSION_ID="2A09CD6A-DF76-4313-B8F6-68EEF68C8942" TMPDIR="/var/folders/m9/b_mpdj7s2pq7l9kmbyq55c2w0000gn/T/" USER="user" XPC_FLAGS="0x0" XPC_SERVICE_NAME="0" _="/Users/user/.cargo/bin/cargo" __CFBundleIdentifier="com.apple.Terminal" __CF_USER_TEXT_ENCODING="0x1F5:0x0:0x0" "/Users/user/.rustup/toolchains/1.72.0-aarch64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "epic-cash-wallet" "--target" "aarch64-apple-ios" "--release" "--lib" finished with error status: exit status: 101

Any tips?

Deserialize on invalid bytes produces invalid Bitmap

Current implementation of deserialize uses ffi::roaring_bitmap_portable_deserialize which returns NULL when deserialization fails. Bitmap::deseralize then uses this NULL pointer to initialize Bitmap struct.

Accoring to croaring documentation roaring_bitmap_portable_deserialize is unsafe:
This function is unsafe in the sense that if there is no valid serialized bitmap at the pointer, then many bytes could be read, possibly causing a buffer overflow

I created PR: #57

One question would be whether you want to return Option or some kind of Result<Bitmap, SomeError> from try_deserialize.

Support for native serialization format

It appears the native serialization format from CRoaring currently is not supported, i.e. serialization using the functions roaring_bitmap_serialize, roaring_bitmap_deserialize_safe and roaring_bitmap_size_in_bytes.

I'd be happy to give it a try with adding support for that, if there's interest in such a change? If so, would you prefer just adding more functions, or perhaps consolidating (de-)serialization functions with a "format" parameter?

failed to build on macOS 11.0.1 (Big Sur)

It seems like a clang issue, any idea on how to solve this?

error: failed to run custom build command for croaring-sys v0.4.5`

Caused by:
process didn't exit successfully: /Users/ming/work/play-rust/influxdb_iox/target/debug/build/croaring-sys-1ba99382f57c2a0e/build-script-build (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("cmpxchg16b,fxsr,sse,sse2,sse3,ssse3")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("cmpxchg16b,fxsr,sse,sse2,sse3,ssse3")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-march=native" "-o" "/Users/ming/work/play-rust/influxdb_iox/target/debug/build/croaring-sys-0acda869f1d2a874/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
exit code: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "crs" "/Users/ming/work/play-rust/influxdb_iox/target/debug/build/croaring-sys-0acda869f1d2a874/out/libroaring.a" "/Users/ming/work/play-rust/influxdb_iox/target/debug/build/croaring-sys-0acda869f1d2a874/out/CRoaring/roaring.o"
exit code: 0
cargo:rustc-link-lib=static=roaring
cargo:rustc-link-search=native=/Users/ming/work/play-rust/influxdb_iox/target/debug/build/croaring-sys-0acda869f1d2a874/out
cargo:warning=couldn't execute llvm-config --prefix (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to the full path to a valid llvm-config executable (including the executable itself)

--- stderr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4777:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4805:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4830:10: error: invalid conversion between vector type '__m256i' (vector of 4 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4859:12: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4888:12: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4917:12: error: invalid conversion between vector type '__m128i' (vector of 2 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:36:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:42:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:60:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:66:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:84:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:90:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:108:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:114:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:956:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:993:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1089:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1111:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1133:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4777:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4805:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4830:10: error: invalid conversion between vector type '__m256i' (vector of 4 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4859:12: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4888:12: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avxintrin.h:4917:12: error: invalid conversion between vector type '__m128i' (vector of 2 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:36:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:42:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:60:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:66:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:84:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:90:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:108:10: error: invalid conversion between vector type '__m128' (vector of 4 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/fmaintrin.h:114:10: error: invalid conversion between vector type '__m128d' (vector of 2 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:956:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:993:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1089:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1111:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/avx512fintrin.h:1133:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
fatal error: too many errors emitted, stopping now [-ferror-limit=], err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /Users/ming/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/croaring-sys-0.4.5/build.rs:24:10
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace`

Build error on WSL (Ubuntu 18.04)

Hi, I am getting the following build error:

Compiling croaring-sys v0.3.5
error: failed to run custom build command for croaring-sys v0.3.5
process didn't exit successfully: /home/mike/projects/test/target/debug/build/croaring-sys-cb06c0ed71cb48f6/build-script-build (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-std=c11" "-march=native" "-O3" "-Wall" "-Wextra" "-o" "/home/mike/projects/test/target/debug/build/croaring-sys-3d1f6d6d130d590f/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
exit code: 0
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
AR_x86_64-unknown-linux-gnu = None
AR_x86_64_unknown_linux_gnu = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
running: "ar" "crs" "/home/mike/projects/test/target/debug/build/croaring-sys-3d1f6d6d130d590f/out/libroaring.a" "/home/mike/projects/test/target/debug/build/croaring-sys-3d1f6d6d130d590f/out/CRoaring/roaring.o"
exit code: 0
TARGET = Some("x86_64-unknown-linux-gnu")
cargo:rustc-link-lib=static=roaring
cargo:rustc-link-search=native=/home/mike/projects/test/target/debug/build/croaring-sys-3d1f6d6d130d590f/out

--- stderr
thread 'main' panicked at 'called Option::unwrap() on a None value', libcore/option.rs:335:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:463
5: std::panicking::begin_panic_fmt
at libstd/panicking.rs:350
6: rust_begin_unwind
at libstd/panicking.rs:328
7: core::panicking::panic_fmt
at libcore/panicking.rs:71
8: core::panicking::panic
at libcore/panicking.rs:51
9: <core::option::Option>::unwrap
at /checkout/src/libcore/macros.rs:20
10: clang_sys::load_manually::build::find
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.23.0/src/../build.rs:244
11: clang_sys::load_manually::build::find_shared_library
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.23.0/src/../build.rs:308
12: clang_sys::load_manually
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.23.0/src/link.rs:120
13: clang_sys::load
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-0.23.0/src/link.rs:142
14: core::ops::function::FnOnce::call_once
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/src/lib.rs:1567
at /checkout/src/libcore/ops/function.rs:223
15: <lazy_static::lazy::Lazy>::get::{{closure}}
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.0.1/src/lazy.rs:24
16: std::sync::once::Once::call_once::{{closure}}
at /checkout/src/libstd/sync/once.rs:227
17: std::sync::once::Once::call_inner
at libstd/sync/once.rs:340
18: std::sync::once::Once::call_once
at /checkout/src/libstd/sync/once.rs:227
19: <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.0.1/src/lazy.rs:23
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/<__lazy_static_internal macros>:13
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/<__lazy_static_internal macros>:14
20: bindgen::ensure_libclang_is_loaded
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/src/lib.rs:1574
21: bindgen::Bindings::generate
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/src/lib.rs:1589
22: bindgen::Builder::generate
at /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.37.4/src/lib.rs:1139
23: build_script_build::main
at ./build.rs:15
24: std::rt::lang_start::{{closure}}
at /checkout/src/libstd/rt.rs:74
25: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
26: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
27: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:374
at libstd/rt.rs:58
28: std::rt::lang_start
at /checkout/src/libstd/rt.rs:74
29: main
30: __libc_start_main
31: _start

rust version 1.27

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Any idea what's wrong?

Use after free in as_slice

I was just taking a look at the implementation of as_slice and noticed it involves a use after free bug. To reproduce save the following code as examples/as_slice.rs, build it with cargo +nightly build --example as_slice (assuming you're using rustup) then run it with valgrind ./target/debug/examples/as_slice

#![feature(alloc_system)]
extern crate alloc_system;
extern crate croaring;

fn main() {
    let mut bitmap = croaring::Bitmap::create();
    bitmap.add(15);
    bitmap.add(25);

    println!("{:?}", bitmap.as_slice());
}

I would recommend dropping as_slice and just have a to_vec method instead, as_* methods are normally used for "free" conversions where you're just re-interpreting existing data, to_* methods are used when you need to do something like allocate a buffer to put the result into.

Also, compiling and running in release mode exposes the bug on my machine:

โ†’ cargo +nightly run --release --example as_slice
    Finished release [optimized] target(s) in 0.0 secs
     Running `target/release/examples/as_slice`
[196203520, 1]

Error message:

==29782== Invalid read of size 4
==29782==    at 0x10000FBBB: core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$u32$GT$::fmt::hb0fd23de4e4c8444 (num.rs:44)
==29782==    by 0x10000186F: _$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Debug$GT$::fmt::hf7ae65296e931643 (in ./target/debug/examples/as_slice)
==29782==    by 0x10000E6F5: core::fmt::write::h7c6d4f6e544ce448 (mod.rs:831)
==29782==    by 0x10000E07D: core::fmt::builders::DebugInner::entry::h2b48d6622574edf6 (mod.rs:1136)
==29782==    by 0x10000E11D: core::fmt::builders::DebugList::entry::h0984c85733c836dd (builders.rs:305)
==29782==    by 0x10000122F: core::fmt::builders::DebugList::entries::h01ac09bce5e8da50 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001086: _$LT$$u5b$T$u5d$$u20$as$u20$core..fmt..Debug$GT$::fmt::h2b2cb0c142f82994 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001823: _$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Debug$GT$::fmt::hf1d658030b75d0b8 (in ./target/debug/examples/as_slice)
==29782==    by 0x10000E6F5: core::fmt::write::h7c6d4f6e544ce448 (mod.rs:831)
==29782==    by 0x10000654B: _$LT$std..io..stdio..Stdout$u20$as$u20$std..io..Write$GT$::write_fmt::h7d3ae6f2d8e4a7f1 (mod.rs:1015)
==29782==    by 0x100006B3C: std::io::stdio::_print::ha1f12b7210ca1a83 (stdio.rs:638)
==29782==    by 0x100002278: as_slice::main::h4c6931c7cbcdc113 (in ./target/debug/examples/as_slice)
==29782==  Address 0x100ab3980 is 0 bytes inside a block of size 8 free'd
==29782==    at 0x10003F2F7: free (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==29782==    by 0x100001B1C: alloc::heap::deallocate::hb0e1ba7d2ef88065 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001CF6: _$LT$alloc..raw_vec..RawVec$LT$T$GT$$u20$as$u20$core..ops..Drop$GT$::drop::ha11eed681d313a76 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001760: drop::haacca81f6e28f076 (in ./target/debug/examples/as_slice)
==29782==    by 0x100000D18: drop_contents::h32788810180988b3 (in ./target/debug/examples/as_slice)
==29782==    by 0x10000171B: drop::h32788810180988b3 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001F7E: croaring::imp::_$LT$impl$u20$croaring..Bitmap$GT$::as_slice::h331dab2b14559960 (in ./target/debug/examples/as_slice)
==29782==    by 0x1000021DC: as_slice::main::h4c6931c7cbcdc113 (in ./target/debug/examples/as_slice)
==29782==    by 0x10000BE3A: __rust_maybe_catch_panic (lib.rs:98)
==29782==    by 0x10000B716: std::rt::lang_start::hefd96b70277e8a4a (panicking.rs:434)
==29782==    by 0x1000022F9: main (in ./target/debug/examples/as_slice)
==29782==  Block was alloc'd at
==29782==    at 0x10003EEBB: malloc (in /usr/local/Cellar/valgrind/3.11.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==29782==    by 0x100001B7C: alloc::heap::allocate::h73c191c61327e81c (in ./target/debug/examples/as_slice)
==29782==    by 0x100000F99: _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::with_capacity::he922122f4deff615 (in ./target/debug/examples/as_slice)
==29782==    by 0x100000EDA: _$LT$collections..vec..Vec$LT$T$GT$$GT$::with_capacity::h83fdc699f8fd98b9 (in ./target/debug/examples/as_slice)
==29782==    by 0x100001EB4: croaring::imp::_$LT$impl$u20$croaring..Bitmap$GT$::as_slice::h331dab2b14559960 (in ./target/debug/examples/as_slice)
==29782==    by 0x1000021DC: as_slice::main::h4c6931c7cbcdc113 (in ./target/debug/examples/as_slice)
==29782==    by 0x10000BE3A: __rust_maybe_catch_panic (lib.rs:98)
==29782==    by 0x10000B716: std::rt::lang_start::hefd96b70277e8a4a (panicking.rs:434)
==29782==    by 0x1000022F9: main (in ./target/debug/examples/as_slice)

Bundle pre-bindgen'd bindings for -sys package

Since we're bundling the version of CRoaring, we should be able to create the bindings offline, and update them manually when we bump the bundled version. This would remove bindgen from the build dependencies, which should have a pretty big build-time speed up, and avoid having dependencies on libclang (to fix #76).

Iterating over all values in bitmap seems slow

Hi,

I'm using croaring to maintain some indexes for me. At some point I need to iterate through my bitmap of indexes, lookup some values at those indexes in another slice, and sum the values. I have found through some performance testing that for my usecase this:

let mut res =  0;
let vec = bm.to_vec();
for v in vec {
    res += self.values[v as usize];
}

is almost twice as fast as this:

let mut res =  0;
for v in row_ids.iter() {
     res += self.values[v];
}

There are about 60,000 possible indexes, and typically the bitmaps contain hundreds to upto maybe 20,000 values. What I find interesting is that to_vec() plus the Rust loop involves the same amount of iteration, so I think something is perhaps off with exposed iterator implementation on BitMap?

Build error when targeting Apple iOS (ARM64 & ARMV7s)

I get the following error when building for ARM64 & ARMV7 (Apple iOS Device) targets:

error: failed to run custom build command for croaring-sys v0.3.7
process didn't exit successfully: ~/Documents/GitHub/grin/target/release/build/croaring-sys-d06121a04b7f2071/build-script-build (exit code: 101)
--- stdout
TARGET = Some("aarch64-apple-ios")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
CC_aarch64-apple-ios = None
CC_aarch64_apple_ios = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_aarch64-apple-ios = None
CFLAGS_aarch64_apple_ios = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
Detecting iOS SDK path for iphoneos
running: "cc" "-O3" "-fPIC" "-arch" "arm64" "-miphoneos-version-min=7.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" "-fembed-bitcode" "-Wall" "-Wextra" "-std=c11" "-march=native" "-O3" "-o" "/Users/haoshenyang/Documents/GitHub/grin/target/aarch64-apple-ios/release/build/croaring-sys-c1c1e6f302648533/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
cargo:warning=clang: error: the clang compiler does not support '-march=native'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O3" "-fPIC" "-arch" "arm64" "-miphoneos-version-min=7.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" "-fembed-bitcode" "-Wall" "-Wextra" "-std=c11" "-march=native" "-O3" "-o" "/Users/haoshenyang/Documents/GitHub/grin/target/aarch64-apple-ios/release/build/croaring-sys-c1c1e6f302648533/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c" with args "cc" did not execute successfully (status code exit code: 1).

', /Users/haoshenyang/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.25/src/lib.rs:2260:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
[ERROR cargo_lipo] Failed to build "grin_wallet" for "aarch64-apple-ios": Executing "/Users/haoshenyang/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "grin_wallet" "--target" "aarch64-apple-ios" "--release" "--lib" finished with error status: exit code: 101

Add support for remove_range

CRoaring now has a function void roaring_bitmap_remove_range(roaring_bitmap_t *ra, uint64_t min, uint64_t max).

How to manually open AVX2 support in CRoaring?

Hi,

I just find that in my target croaring not be compile with AVX2 support, it uses intersect_uint16 rather than intersect_vector16 to get the intersection between two bitmaps, but I am really sure that my CPU (Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz) fully supports AVX2, so are there any configurations can manually open AVX2 support?

Hope for your reply, thanks.

image

Support for bitmaps > 2^32

This is just a tracking issue for this repository for addition of support for 64 bit maps. It's highly related to RoaringBitmap/CRoaring#1 seeing as we're binding the C layer (although if we could bind the C++ layer, that already appears to have an implementation?).

Failed to build on Apple Silicon

Freshly installed llvm with brew and added to the path.
Compiling roaring-rs on Apple M1 fails with:

error: failed to run custom build command for `croaring-sys-mw v0.4.5`

Caused by:
  process didn't exit successfully: `/Users/jean-x/grin/target/debug/build/croaring-sys-mw-0f526048a015a91a/build-script-build` (exit code: 101)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = None
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = None
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = None
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-Wall" "-Wextra" "-std=c11" "-O3" "-DDISABLEAVX=1" "-o" "/Users/jean-x/grin/target/debug/build/croaring-sys-mw-cd0884b564780a2b/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
  exit code: 0
  AR_aarch64-apple-darwin = None
  AR_aarch64_apple_darwin = None
  HOST_AR = None
  AR = None
  running: "ar" "crs" "/Users/jean-x/grin/target/debug/build/croaring-sys-mw-cd0884b564780a2b/out/libroaring.a" "/Users/jean-x/grin/target/debug/build/croaring-sys-mw-cd0884b564780a2b/out/CRoaring/roaring.o"
  exit code: 0
  cargo:rustc-link-lib=static=roaring
  cargo:rustc-link-search=native=/Users/jean-x/grin/target/debug/build/croaring-sys-mw-cd0884b564780a2b/out

  --- stderr
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  If you encounter an error missing from this list, please file an issue or a PR!', /Users/jean-x/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/ir/context.rs:573:15
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

add support for checked operations

CRoaring got two new functions which should be wrapped...

roaring_bitmap_add_checked
roaring_bitmap_remove_checked

They return true or false depending on whether the value was already present.

Unable to build on macOS

Trying to build, getting this error:
System

  • macOS 10.14.2
  • rustc 1.32.0-nightly (14997d56a 2018-12-05)
error: failed to run custom build command for `croaring-sys v0.3.8`
process didn't exit successfully: `/Users/dignifiedquire/opensource/bitsets/target/debug/build/croaring-sys-8bf71ee2990c8b3c/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-std=c11" "-march=native" "-O3" "-o" "/Users/dignifiedquire/opensource/bitsets/target/debug/build/croaring-sys-14aec6d1f467ffd7/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
exit code: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "crs" "/Users/dignifiedquire/opensource/bitsets/target/debug/build/croaring-sys-14aec6d1f467ffd7/out/libroaring.a" "/Users/dignifiedquire/opensource/bitsets/target/debug/build/croaring-sys-14aec6d1f467ffd7/out/CRoaring/roaring.o"
exit code: 0
cargo:rustc-link-lib=static=roaring
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/bitsets/target/debug/build/croaring-sys-14aec6d1f467ffd7/out

--- stderr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:3427:10: error: returning 'int' from a function with incompatible result type '__m128' (vector of 4 'float' values)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:2228:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3115:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3133:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:971:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:982:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:992:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1021:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1032:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1042:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1126:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1136:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1144:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1154:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1164:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1172:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1182:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1192:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1200:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:3427:10: error: returning 'int' from a function with incompatible result type '__m128' (vector of 4 'float' values), err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:2228:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3115:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3133:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:971:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:982:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:992:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1021:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1032:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1042:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1126:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1136:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1144:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1154:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1164:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1172:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1182:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1192:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1200:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
fatal error: too many errors emitted, stopping now [-ferror-limit=], err: true
thread 'main' panicked at 'Unable to generate bindings: ()', src/libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Build error when targeting Apple iOS

I get the following error when building for iOS target:

   Compiling grin_keychain v0.4.0 (/Users/michal/Projects/grin/keychain)                                                                                                          
   Compiling croaring-sys v0.3.6                                                                                                                                                  
   Compiling tokio v0.1.11                                                                                                                                                        
error: failed to run custom build command for `croaring-sys v0.3.6`                                                                                                               
process didn't exit successfully: `/Users/michal/Projects/grin/target/release/build/croaring-sys-9abd17aa1d17ccbd/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("aarch64-apple-ios")
OPT_LEVEL = Some("3")
TARGET = Some("aarch64-apple-ios")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("aarch64-apple-ios")
TARGET = Some("aarch64-apple-ios")
HOST = Some("x86_64-apple-darwin")
CC_aarch64-apple-ios = None
CC_aarch64_apple_ios = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
CROSS_COMPILE = None
TARGET = Some("aarch64-apple-ios")
HOST = Some("x86_64-apple-darwin")
CFLAGS_aarch64-apple-ios = None
CFLAGS_aarch64_apple_ios = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
TARGET = Some("aarch64-apple-ios")
Detecting iOS SDK path for iphoneos
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-miphoneos-version-min=7.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" "-std=c11" "-march=native" "-O3" "-Wall" "-Wextra" "-o" "/Users/michal/Projects/grin/target/aarch64-apple-ios/release/build/croaring-sys-ba1883b7e741d0b5/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
cargo:warning=clang: error: the clang compiler does not support '-march=native'
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-miphoneos-version-min=7.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" "-std=c11" "-march=native" "-O3" "-Wall" "-Wextra" "-o" "/Users/michal/Projects/grin/target/aarch64-apple-ios/release/build/croaring-sys-ba1883b7e741d0b5/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c" with args "cc" did not execute successfully (status code exit code: 1).

', /Users/michal/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.55/src/lib.rs:1672:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

I'm using MacOS Mojave. The build works just fine when building for MacOS on my computer. Can you help with that? How could I get more details about the failure?

Build failed

build failed

error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-DDISABLE_X64" "-Wno-unused-function" "-o" "/workspace/rust/roarningbitmap/target/debug/build/croaring-sys-7cd393670621a907/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c" with args "cc" did not execute successfully (status code exit status: 1).

Support for frozen methods

Hi there, thanks for this library. It doesn't look like the roaring_bitmap_frozen_* and roaring_bitmap_portable_deserialize_frozen methods are available, which are useful for faster loading of bitmaps from disk. The methods were introduced in PRs #199 and #421. Is it possible to safely introduce these in the croaring Rust library? It looks like all methods except roaring_bitmap_portable_deserialize_frozen are already available in croaring_sys.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.