Skip to content

Commit

Permalink
Fix build on windows (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
wForget authored Nov 28, 2024
1 parent 0b3fb9f commit 685d0a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
10 changes: 7 additions & 3 deletions build-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ set -e
cd "$(dirname "$0")"
profile="$1"

libname=libblaze
if [ "$(uname)" == "Darwin" ]; then
libsuffix=dylib
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
libsuffix=so
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
libname=blaze
libsuffix=dll
else
echo "Unsupported platform $(uname)"
exit 1
Expand All @@ -25,7 +29,7 @@ checksum() {
exit 1
fi

find Cargo.toml Cargo.lock native-engine target/$profile/libblaze."$libsuffix" | \
find Cargo.toml Cargo.lock native-engine target/$profile/$libname."$libsuffix" | \
xargs $hash_cmd 2>&1 | \
sort -k1 | \
$hash_cmd
Expand Down Expand Up @@ -53,8 +57,8 @@ else
fi

mkdir -p dev/mvn-build-helper/assembly/target/classes
rm -f dev/mvn-build-helper/assembly/target/classes/libblaze.{dylib,so}
cp target/$profile/libblaze."$libsuffix" dev/mvn-build-helper/assembly/target/classes
rm -f dev/mvn-build-helper/assembly/target/classes/$libname.{dylib,so,dll}
cp target/$profile/$libname."$libsuffix" dev/mvn-build-helper/assembly/target/classes

new_checksum="$(checksum)"
echo "build-checksum updated: $new_checksum"
Expand Down
7 changes: 5 additions & 2 deletions dev/mvn-build-helper/assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<executable>./build-native.sh</executable>
<commandlineArgs>${releaseMode}</commandlineArgs>
<executable>bash</executable>
<arguments>
<argument>./build-native.sh</argument>
<argument>${releaseMode}</argument>
</arguments>
<workingDirectory>../../../</workingDirectory>
<useMavenLogger>true</useMavenLogger>
</configuration>
Expand Down
4 changes: 3 additions & 1 deletion native-engine/blaze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ datafusion-ext-plans = { workspace = true }
futures = "0.3"
jni = "0.20.0"
log = "0.4.22"
jemallocator = { version = "0.5.0", features = ["disable_initial_exec_tls"] }
once_cell = "1.20.2"
panic-message = "0.3.0"
paste = "1.0.15"
prost = "0.13.3"
tokio = "1.41"

[target.'cfg(not(windows))'.dependencies]
jemallocator = { version = "0.5.0", features = ["disable_initial_exec_tls"] }
3 changes: 2 additions & 1 deletion native-engine/blaze/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use std::{
},
};

#[global_allocator]
#[cfg(not(windows))]
#[cfg_attr(not(windows), global_allocator)]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;

// only used for debugging
Expand Down

0 comments on commit 685d0a1

Please sign in to comment.