Skip to content

Commit 5a37c41

Browse files
author
Huahai Yang
committed
try linux build on x86_64
1 parent 3afe0bc commit 5a37c41

File tree

6 files changed

+67
-52
lines changed

6 files changed

+67
-52
lines changed

.cirrus.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ env:
66
task:
77
arm_container:
88
image: ubuntu:focal
9-
# only_if: $CIRRUS_TAG != ''
10-
only_if: "changesInclude('linux-arm64/*', '.cirrus.yml')"
9+
only_if: $CIRRUS_TAG != ''
10+
# only_if: "changesInclude('linux-arm64/*', '.cirrus.yml')"
1111
script: |
1212
DEBIAN_FRONTEND=noninteractive apt-get update -y
1313
DEBIAN_FRONTEND=noninteractive apt-get install -y curl git wget tar openjdk-21-jdk-headless build-essential
1414
1515
git submodule init
1616
git submodule update
1717
18-
script/build-linux-shared
18+
script/build
1919
mkdir -p src/java/datalevin/dtlvnative/linux-arm64
2020
cp src/*.so src/java/datalevin/dtlvnative/linux-arm64/
2121
@@ -40,8 +40,8 @@ task:
4040
task:
4141
macos_instance:
4242
image: ghcr.io/cirruslabs/macos-runner:sonoma
43-
# only_if: $CIRRUS_TAG != ''
44-
only_if: "changesInclude('macosx-arm64/*', '.cirrus.yml')"
43+
only_if: $CIRRUS_TAG != ''
44+
# only_if: "changesInclude('macosx-arm64/*', '.cirrus.yml')"
4545
script: |
4646
git submodule init
4747
git submodule update

.github/workflows/build.yml

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Build
22

3-
on:
4-
release:
5-
types:
6-
- created
3+
on: push
4+
5+
# on:
6+
# release:
7+
# types:
8+
# - created
79

810
jobs:
911
build:
@@ -13,7 +15,8 @@ jobs:
1315
CLOJARS_PASSWORD: ${{secrets.CLOJARSPASSWORD}}
1416
strategy:
1517
matrix:
16-
os: [macos-13, ubuntu-20.04]
18+
# os: [macos-13, ubuntu-20.04]
19+
os: [ubuntu-20.04]
1720

1821
steps:
1922
- name: Checkout repository and submodules
@@ -24,49 +27,62 @@ jobs:
2427
- name: Install Lein
2528
uses: knicknic/[email protected]
2629
with:
27-
macos: brew install leiningen
30+
# macos: brew install leiningen
2831
linux: echo "lein is already installed"
2932

30-
- name: Install Zig
31-
uses: goto-bus-stop/setup-zig@v2
33+
# - name: Install Zig
34+
# uses: goto-bus-stop/setup-zig@v2
3235

33-
- name: Build and deploy static
34-
uses: knicknic/[email protected]
35-
with:
36-
macos: |
37-
script/build
38-
cp src/*.a macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/
39-
cp src/dtlv.h macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/
40-
cp src/lmdb/libraries/liblmdb/lmdb.h macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/lmdb/libraries/liblmdb/
41-
cd macos-latest-amd64
42-
lein deploy clojars
43-
linux: |
44-
sudo script/setup-musl
45-
script/build-musl
46-
cp src/*.a ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/
47-
cp src/dtlv.h ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/
48-
cp src/lmdb/libraries/liblmdb/lmdb.h ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/lmdb/libraries/liblmdb/
49-
cd ubuntu-latest-amd64
50-
lein deploy clojars
36+
# - name: Build and deploy static
37+
# uses: knicknic/[email protected]
38+
# with:
39+
# macos: |
40+
# script/build
41+
# cp src/*.a macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/
42+
# cp src/dtlv.h macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/
43+
# cp src/lmdb/libraries/liblmdb/lmdb.h macos-latest-amd64/resources/dtlvnative/macos-latest-amd64/lmdb/libraries/liblmdb/
44+
# cd macos-latest-amd64
45+
# lein deploy clojars
46+
# linux: |
47+
# sudo script/setup-musl
48+
# script/build-musl
49+
# cp src/*.a ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/
50+
# cp src/dtlv.h ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/
51+
# cp src/lmdb/libraries/liblmdb/lmdb.h ubuntu-latest-amd64/resources/dtlvnative/ubuntu-latest-amd64/lmdb/libraries/liblmdb/
52+
# cd ubuntu-latest-amd64
53+
# lein deploy clojars
5154

5255
- name: Build and deploy shared
5356
uses: knicknic/[email protected]
5457
with:
55-
macos: |
56-
script/build-macos-shared
57-
mkdir -p macos-latest-amd64-shared/resources/dtlvnative/macos-latest-amd64-shared
58-
cp src/lmdb/libraries/liblmdb/liblmdb.dylib macos-latest-amd64-shared/resources/dtlvnative/macos-latest-amd64-shared/
59-
cd macos-latest-amd64-shared
60-
lein deploy clojars
58+
# macos: |
59+
# script/build-macos-shared
60+
# mkdir -p macos-latest-amd64-shared/resources/dtlvnative/macos-latest-amd64-shared
61+
# cp src/lmdb/libraries/liblmdb/liblmdb.dylib macos-latest-amd64-shared/resources/dtlvnative/macos-latest-amd64-shared/
62+
# cd macos-latest-amd64-shared
63+
# lein deploy clojars
6164
linux: |
65+
mkdir -p linux-x86_64/resources/datalevin/dtlvnative/linux-x86_64
66+
mkdir -p src/java/datalevin/dtlvnative/linux-x86_64
67+
6268
script/build
63-
mkdir -p ubuntu-latest-amd64-shared/resources/dtlvnative/ubuntu-latest-amd64-shared
64-
cp src/liblmdb.so ubuntu-latest-amd64-shared/resources/dtlvnative/ubuntu-latest-amd64-shared/
65-
cd ubuntu-latest-amd64-shared
69+
cp src/*.so linux-x86_64/resources/datalevin/dtlvnative/linux-x86_64
70+
71+
cd linux-x86_64
72+
lein deps
73+
74+
cd ../src/java
75+
java -jar ~/.m2/repository/org/bytedeco/javacpp/1.5.11/javacpp-1.5.11.jar datalevin/dtlvnative/DTLV.java
76+
77+
cd ../..
78+
cp src/java/datalevin/dtlvnative/linux-x86_64/*.so linux-x86_64/resources/datalevin/dtlvnative/linux-x86_64/
79+
80+
cd linux-x86_64
81+
lein run
6682
lein deploy clojars
6783
68-
- name: Build and deploy cross compiled shared
69-
uses: knicknic/[email protected]
70-
with:
71-
linux: |
72-
script/build-zig
84+
# - name: Build and deploy cross compiled shared
85+
# uses: knicknic/[email protected]
86+
# with:
87+
# linux: |
88+
# script/build-zig

linux-arm64/project.clj renamed to linux-x86_64/project.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject org.clojars.huahaiy/dtlvnative-linux-arm64 "0.11.1"
1+
(defproject org.clojars.huahaiy/dtlvnative-linux-x86_64 "0.11.1"
22
:description "Native dependency of embedded library version of Datalevin on Linux Arm64"
33
:url "https://github.com/juji-io/dtlvnative"
44
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
@@ -7,6 +7,7 @@
77
[org.bytedeco/javacpp "1.5.11"]]
88
:java-source-paths ["../src/java"]
99
:javac-options ["-Xlint:unchecked" "-Xlint:-options" "--release" "8"]
10+
:jvm-opts ["-Dorg.bytedeco.javacpp.logger.debug=false"]
1011
:main datalevin.dtlvnative.Test
1112
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
1213
:username :env/clojars_username

script/build-linux-shared

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
set -eou pipefail
44

5-
cd src
5+
cd src/lmdb/libraries/liblmdb
66
make -e SOEXT=.so

src/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ libraries := $(lib_lmdb) $(lib_dtlv)$(SOEXT)
99
all: $(libraries)
1010

1111
$(lib_lmdb):
12-
$(MAKE) --directory=$@ liblmdb$(SOEXT)
13-
cp $(lib_lmdb)/liblmdb$(SOEXT) .
12+
$(MAKE) --directory=$@ XCFLAGS="-fPIC" liblmdb.a
13+
cp $(lib_lmdb)/liblmdb.a .
1414

1515
$(lib_dtlv)$(SOEXT): $(lib_lmdb)
1616
$(CC) -pthread -fPIC -O2 -Wall -g -c dtlv.c -o dtlv.o
17-
$(CC) $(LDFLAGS) -pthread -shared -o $@ dtlv.o liblmdb$(SOEXT)
17+
$(CC) $(LDFLAGS) -pthread -shared -fPIC -o $@ dtlv.o -L. -llmdb
1818

1919
clean:
2020
$(RM) *.o *.a *.so *$(SOEXT)

src/java/datalevin/dtlvnative/DTLVConfig.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
includepath = {"../../src/lmdb/libraries/liblmdb/",
1010
"../../src/"},
1111
include = {"lmdb.h", "dtlv.h"},
12-
// preloadpath = {"."},
13-
preload = {"lmdb"},
1412
linkpath = {"../../src/"},
1513
link = {"dtlv"}
1614
),

0 commit comments

Comments
 (0)