Skip to content

Commit

Permalink
Add ability to use static builds of libtiledb (#186)
Browse files Browse the repository at this point in the history
This updates the tiledb-sys crate to be able to build a static version
of libtiledb. This allows Rust projects to create statically linked
binaries for distribution.
  • Loading branch information
davisp authored Nov 12, 2024
1 parent 64bfa73 commit b8ccc88
Show file tree
Hide file tree
Showing 29 changed files with 1,515 additions and 327 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/macos-check-static-linkage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

otool -L target/debug/examples/quickstart_dense-* | grep tiledb
if [ "$?" -eq "0" ]; then
echo "Detected dynamic linkage to libtiledb.dylib"
exit 1
fi
7 changes: 7 additions & 0 deletions .github/scripts/ubuntu-check-static-linkage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

ldd target/debug/examples/quickstart_dense-* | grep tiledb
if [ "$?" -eq "0" ]; then
echo "Detected dynamic linkage to libtiledb.so"
exit 1
fi
50 changes: 50 additions & 0 deletions .github/workflows/nightly-static-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Static Nightlies
on:
schedule:
# runs every day at 1:45 UTC
- cron: "45 01 * * *"
workflow_dispatch:

jobs:
test:
name: Test Static Build
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Test
run: cargo test --all-targets --all-features
env:
# Building against a static version of libtiledb
TILEDB_SYS_STATIC: true
# Limit parallel compilation jobs to avoid exhausting RAM
TILEDB_SYS_JOBS: 4
- name: Assert Static Linkage
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: .github/scripts/ubuntu-check-static-linkage.sh
- name: Assert Static Linkage
if: ${{ startsWith(matrix.os, 'macos-') }}
run: .github/scripts/macos-check-static-linkage.sh

create_issue_on_fail:
name: Create Issue on Fail
permissions:
issues: write
runs-on: ubuntu-latest
needs: test
if: failure() || cancelled()
steps:
- uses: actions/checkout@v3
- name: Create Issue on Failure
uses: TileDB-Inc/github-actions/open-issue@main
with:
name: Nightly Build Failure
label: nightly-failure
assignee: davisp,rroelke
Loading

0 comments on commit b8ccc88

Please sign in to comment.