Closed tkoeppen closed 3 months ago
when compiling the code with rust 1.79 inside docker on aarch64 (MacOS Silicon) I get the below error.
reproduced with a Dockerfile example in https://github.com/tkoeppen/klickhouse/blob/hotfix/lz4_c_char_aarch64/Dockerfile
#10 15.70 Running `/usr/local/rustup/toolchains/1.79.0-aarch64-unknown-linux-gnu/bin/rustc --crate-name klickhouse --edition=2021 klickhouse/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="compression"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="klickhouse_derive"' --cfg 'feature="lz4"' --cfg 'feature="serde"' --cfg 'feature="serde_json"' -C metadata=95d52022669563e7 -C extra-filename=-95d52022669563e7 --out-dir /opt/src/target/release/deps -C strip=debuginfo -L dependency=/opt/src/target/release/deps --extern async_trait=/opt/src/target/release/deps/libasync_trait-cbb1f3d0b39770d7.so --extern chrono=/opt/src/target/release/deps/libchrono-100359c7ade06c65.rmeta --extern chrono_tz=/opt/src/target/release/deps/libchrono_tz-fa8334a6aff677c7.rmeta --extern cityhash_rs=/opt/src/target/release/deps/libcityhash_rs-5162020ef922ef17.rmeta --extern compiler_tools=/opt/src/target/release/deps/libcompiler_tools-89ba83729eec2a46.rmeta --extern compiler_tools_derive=/opt/src/target/release/deps/libcompiler_tools_derive-30107f894dcf0d21.so --extern futures_util=/opt/src/target/release/deps/libfutures_util-ae0f35fec58ea5af.rmeta --extern indexmap=/opt/src/target/release/deps/libindexmap-f99571e849f70cd5.rmeta --extern klickhouse_derive=/opt/src/target/release/deps/libklickhouse_derive-8be53db06c68471f.so --extern log=/opt/src/target/release/deps/liblog-5cbbf148b2ce1f12.rmeta --extern lz4=/opt/src/target/release/deps/liblz4-fa9dd2c85b38dbf4.rmeta --extern paste=/opt/src/target/release/deps/libpaste-3039d1657a8642cf.so --extern serde=/opt/src/target/release/deps/libserde-b4948574bec5e67e.rmeta --extern serde_json=/opt/src/target/release/deps/libserde_json-9a7adaee943b2e21.rmeta --extern thiserror=/opt/src/target/release/deps/libthiserror-4bc005881d62485d.rmeta --extern tokio=/opt/src/target/release/deps/libtokio-a6a1c08df12dea03.rmeta --extern tokio_stream=/opt/src/target/release/deps/libtokio_stream-1f5e64eb08103632.rmeta --extern uuid=/opt/src/target/release/deps/libuuid-cba5744063e343c3.rmeta -L native=/opt/src/target/release/build/lz4-sys-7ec8232658b40aba/out --cfg const_generics` #10 16.09 error[E0308]: arguments to this function are incorrect #10 16.09 --> klickhouse/src/compression.rs:24:9 #10 16.09 | #10 16.09 24 | lz4::liblz4::LZ4_compress_default( #10 16.09 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #10 16.09 | #10 16.09 note: expected `*const u8`, found `*const i8` #10 16.09 --> klickhouse/src/compression.rs:25:13 #10 16.09 | #10 16.09 25 | raw.as_ptr() as *const c_char, #10 16.09 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #10 16.09 = note: expected raw pointer `*const u8` #10 16.09 found raw pointer `*const i8` #10 16.09 note: expected `*mut u8`, found `*mut i8` #10 16.09 --> klickhouse/src/compression.rs:26:13 ... 16.32 --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/lz4-sys-1.9.4/src/lib.rs:139:12 16.32 | 16.32 139 | pub fn LZ4_decompress_safe (source: *const c_char, dest: *mut c_char, compressedSize: c_int, maxDecompressedSize: c_int) -> c_int; 16.32 | ^^^^^^^^^^^^^^^^^^^ 16.32 17.06 For more information about this error, try `rustc --explain E0308`.
using std:ffi is also recommended [1] https://doc.rust-lang.org/std/os/raw/ [2] https://stackoverflow.com/questions/44436515/should-i-use-libcc-char-or-stdosrawc-char
when compiling the code with rust 1.79 inside docker on aarch64 (MacOS Silicon) I get the below error.
reproduced with a Dockerfile example in https://github.com/tkoeppen/klickhouse/blob/hotfix/lz4_c_char_aarch64/Dockerfile