Skip to content

Commit 6bd87a1

Browse files
authored
Merge pull request #3 from scalableminds/ubuntu-arm64
add arm64 for linux
2 parents c073dc9 + 9b837d4 commit 6bd87a1

5 files changed

Lines changed: 98 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build_bloscjni:
88
strategy:
99
matrix:
10-
os: [ ubuntu-latest, windows-latest, macos-12 ]
10+
os: [ ubuntu-latest, windows-latest, macos-latest ]
1111
runs-on: ${{ matrix.os }}
1212
steps:
1313
- uses: actions/checkout@v3
@@ -41,8 +41,14 @@ jobs:
4141
-shared -o ..\\src\\main\\resources\\libbloscjni.dll \
4242
bloscjni.c ..\\c-blosc\\build\\blosc\\libblosc.a
4343
44+
- name: Install CMake 3.x (Mac)
45+
if: ${{ matrix.os == 'macos-latest' }}
46+
uses: lukka/get-cmake@latest
47+
with:
48+
cmakeVersion: "~3"
49+
4450
- name: Build c-blosc (Mac arm64)
45-
if: ${{ matrix.os == 'macos-12' }}
51+
if: ${{ matrix.os == 'macos-latest' }}
4652
run: |
4753
cd c-blosc
4854
mkdir build-arm64
@@ -57,19 +63,20 @@ jobs:
5763
cmake --build . -j8 --config Release --target blosc_static
5864
5965
- name: Build c-blosc (Mac x86_64)
60-
if: ${{ matrix.os == 'macos-12' }}
66+
if: ${{ matrix.os == 'macos-latest' }}
6167
run: |
6268
cd c-blosc
6369
mkdir build-x86_64
6470
cd build-x86_64
6571
cmake .. \
72+
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
6673
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
6774
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
6875
-DCMAKE_BUILD_TYPE=Release
6976
cmake --build . -j8 --config Release --target blosc_static
7077
7178
- name: Build bloscjni (Mac universal)
72-
if: ${{ matrix.os == 'macos-12' }}
79+
if: ${{ matrix.os == 'macos-latest' }}
7380
run: |
7481
cd bloscjni
7582
cc \
@@ -110,7 +117,7 @@ jobs:
110117
docker run -i -v$(pwd):/app -w /app centos7-jdk8 bash <<EOF
111118
cd bloscjni
112119
gcc -I"\$JAVA_HOME/include" -I"\$JAVA_HOME/include/linux" \
113-
-shared -lc -fPIC -o ../src/main/resources/libbloscjni.so -O3 \
120+
-shared -lc -fPIC -o ../src/main/resources/libbloscjni-amd64.so -O3 \
114121
bloscjni.c ../c-blosc/build/blosc/libblosc.a
115122
EOF
116123
@@ -120,13 +127,66 @@ jobs:
120127
- name: Test blosc-java
121128
run: mvn test
122129

123-
- uses: actions/upload-artifact@v3
130+
- uses: actions/upload-artifact@v4
124131
with:
125132
name: bloscjni-${{ matrix.os }}
126133
path: src/main/resources
127134

135+
build_bloscjni_linux_arm64:
136+
runs-on: ubuntu-24.04-arm
137+
steps:
138+
- uses: actions/checkout@v3
139+
with:
140+
submodules: true
141+
- uses: actions/setup-java@v4
142+
with:
143+
distribution: 'zulu'
144+
java-version: '8'
145+
cache: 'maven'
146+
147+
- name: Prepare resources folder
148+
run: mkdir src/main/resources
149+
150+
- name: Build ubuntu20 arm64 docker
151+
run: |
152+
cd bloscjni
153+
docker build -t ubuntu20-arm64-jdk8 -f Dockerfile.ubuntu20-arm64 .
154+
155+
- name: Build c-blosc (Linux arm64)
156+
run: |
157+
docker run -i -v$(pwd):/app -w /app/c-blosc ubuntu20-arm64-jdk8 bash << EOF
158+
mkdir build
159+
cd build
160+
cmake .. \
161+
-DDEACTIVATE_AVX2=ON \
162+
-DDEACTIVATE_SSE2=ON \
163+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
164+
-DCMAKE_BUILD_TYPE=Release
165+
cmake --build . -j8 --config Release
166+
EOF
167+
168+
- name: Build bloscjni (Linux arm64)
169+
run: |
170+
docker run -i -v$(pwd):/app -w /app ubuntu20-arm64-jdk8 bash <<EOF
171+
cd bloscjni
172+
gcc -I"\$JAVA_HOME/include" -I"\$JAVA_HOME/include/linux" \
173+
-shared -lc -fPIC -o ../src/main/resources/libbloscjni-aarch64.so -O3 \
174+
bloscjni.c ../c-blosc/build/blosc/libblosc.a
175+
EOF
176+
177+
- name: Build blosc-java
178+
run: mvn compile
179+
180+
- name: Test blosc-java
181+
run: mvn test
182+
183+
- uses: actions/upload-artifact@v4
184+
with:
185+
name: bloscjni-linux-arm64
186+
path: src/main/resources
187+
128188
build_publish_jar:
129-
needs: [ build_bloscjni ]
189+
needs: [ build_bloscjni, build_bloscjni_linux_arm64 ]
130190
runs-on: ubuntu-latest
131191
steps:
132192
- uses: actions/checkout@v3
@@ -138,7 +198,7 @@ jobs:
138198
java-version: '8'
139199
cache: 'maven'
140200

141-
- uses: actions/download-artifact@v3
201+
- uses: actions/download-artifact@v4
142202
with:
143203
path: src/main/resources
144204

@@ -151,15 +211,15 @@ jobs:
151211
- name: Assemble JAR
152212
run: mvn package
153213

154-
- uses: actions/upload-artifact@v3
214+
- uses: actions/upload-artifact@v4
155215
with:
156216
name: blosc-jar
157217
path: target/*.jar
158218

159219
- name: Publish to Maven Central
160220
env:
161-
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
162-
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
221+
JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
222+
JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
163223
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
164224
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
165225
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}

bloscjni/Dockerfile.ubuntu20-arm64

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM arm64v8/ubuntu:20.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y \
5+
openjdk-8-jdk gcc make curl && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
RUN cd /usr/local/src && \
9+
curl -LO https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-linux-aarch64.tar.gz && \
10+
tar -xf cmake-3.22.2-linux-aarch64.tar.gz && \
11+
mv cmake-3.22.2-linux-aarch64 /usr/local/cmake
12+
13+
ENV PATH="/usr/local/cmake/bin:$PATH"
14+
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64

c-blosc

Submodule c-blosc updated 375 files

pom.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.scalableminds</groupId>
88
<artifactId>blosc-java</artifactId>
9-
<version>0.2-1.21.4</version>
9+
<version>0.3-1.21.6</version>
1010
<inceptionYear>2023</inceptionYear>
1111

1212
<name>blosc-java</name>
@@ -76,7 +76,7 @@
7676
<plugin>
7777
<groupId>org.jreleaser</groupId>
7878
<artifactId>jreleaser-maven-plugin</artifactId>
79-
<version>1.7.0</version>
79+
<version>1.15.0</version>
8080
<configuration>
8181
<jreleaser>
8282
<signing>
@@ -85,17 +85,13 @@
8585
</signing>
8686
<deploy>
8787
<maven>
88-
<nexus2>
89-
<maven-central>
88+
<mavenCentral>
89+
<sonatype>
9090
<active>ALWAYS</active>
91-
<url>https://oss.sonatype.org/service/local</url>
92-
<snapshotUrl>https://oss.sonatype.org/content/repositories/snapshots/
93-
</snapshotUrl>
94-
<closeRepository>false</closeRepository>
95-
<releaseRepository>false</releaseRepository>
91+
<url>https://central.sonatype.com/api/v1/publisher</url>
9692
<stagingRepositories>target/staging-deploy</stagingRepositories>
97-
</maven-central>
98-
</nexus2>
93+
</sonatype>
94+
</mavenCentral>
9995
</maven>
10096
</deploy>
10197
</jreleaser>

src/main/java/com/scalableminds/bloscjava/Blosc.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ private static File loadLibraryFromJarToTemp() throws IOException {
172172

173173
// attempt to look up the static library in the jar file
174174
String libraryFileName = filePrefix + extension;
175+
// On Linux, select arch-specific library
176+
if (extension.equals(".so")) {
177+
String arch = System.getProperty("os.arch").toLowerCase();
178+
libraryFileName = filePrefix + "-" + arch + extension;
179+
}
175180
is = Blosc.class.getClassLoader().getResourceAsStream(libraryFileName);
176181

177182
if (is == null) {

0 commit comments

Comments
 (0)