Skip to content

Fix/ci precompiled pipeline#4

Open
adiibanez wants to merge 33 commits intoLeapsight:developfrom
adiibanez:fix/ci-precompiled-pipeline
Open

Fix/ci precompiled pipeline#4
adiibanez wants to merge 33 commits intoLeapsight:developfrom
adiibanez:fix/ci-precompiled-pipeline

Conversation

@adiibanez
Copy link
Copy Markdown

ci precompilations for mac, linux, windows

Adrian Ibañez and others added 30 commits January 27, 2026 15:01
Phase 1 - CI Fixes:
- Fix broken version extraction (sed command on single line, src.cozodb.app.src -> src/cozodb.app.src)
- Split build dependencies by platform (Linux apt-get, macOS brew)
- Add liburing-dev for cozorocks build on Linux
- Add checksum generation for release artifacts

Phase 2 - Precompiled NIF consumption:
- Add cozodb_nif_loader module for downloading precompiled NIFs from GitHub Releases
- Update cargo.hrl macro to try precompiled first, fall back to source
- Add crypto, inets, ssl dependencies for HTTP client

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Cross.toml to install libclang-dev in cross containers (fixes bindgen)
- Make io-uring feature opt-in instead of default for Linux targets
- Install cross from git to get latest version with pre-build support
- Remove target-specific io-uring dependency that broke cross-compilation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update Cross.toml to install LLVM 14 from official LLVM apt repository
- Add Cross.toml to repo root as fallback
- Set LIBCLANG_PATH environment variable for cross builds

The default cross images have libclang 3.8.x but bindgen requires 5.0+

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The rustler-precompiled-action output path may not match expected location.
Added debugging output and fallback to search for .tar.gz files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The tzdata package was prompting for timezone selection, blocking the build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added debugging to show Cross.toml content during build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Branch names like fix/ci-precompiled-pipeline were creating invalid paths.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use ghcr.io/cross-rs images which may have newer base OS
- Simplified pre-build to just install libclang-dev from default repos
- Added more debugging output for cross configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…data error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
RocksDB uses C++20 features like defaulted comparison operators and
'using enum'. Without -std=c++20, the build fails with compiler errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cross-compilation containers have older GCC that doesn't recognize
-std=c++20 but supports -std=c++2a (older name for C++20 draft).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
RocksDB requires C++20 features (defaulted comparisons, using enum).
The cross-compilation containers have GCC 9 which doesn't support these.

Working targets (4):
- aarch64-apple-darwin
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu

Disabled targets (need custom cross images with GCC 10+):
- arm-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create Dockerfiles for 4 targets with GCC 10+ for C++20 support:
  - aarch64-unknown-linux-gnu
  - arm-unknown-linux-gnueabihf
  - aarch64-unknown-linux-musl
  - x86_64-unknown-linux-musl
- Add build-cross-images.yml workflow to build/push images to GHCR
- Update Cross.toml to use custom images
- Re-enable all cross-compilation targets in release.yml
- Add fix/** branches to release workflow trigger

RocksDB requires C++20 features (defaulted comparisons) that older
GCC cross-compilers don't support. These custom images provide GCC 10
which fully supports -std=c++2a.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cross-rs images use crosstool-ng compilers with target-prefixed names
like arm-unknown-linux-gnueabihf-g++, but we were only updating the
Debian-style names like arm-linux-gnueabihf-g++.

This fix creates wrapper scripts in /usr/local/bin that:
- Match the exact target triplet names used by cross-rs
- Delegate to the GCC 10 cross-compilers
- Are added first in PATH to take precedence

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cc crate sets CXX_<target>=<debian-style-compiler>, e.g.:
  CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++

The previous fix created wrapper scripts with Rust triplet names but
the cc crate bypasses those by directly using the Debian-style names.

This fix uses update-alternatives to make the Debian compiler commands
(aarch64-linux-gnu-g++, arm-linux-gnueabihf-g++, etc.) point to GCC 10.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cross-rs images use different naming conventions per target:
- aarch64-unknown-linux-gnu: uses aarch64-linux-gnu-g++ (Debian)
- arm-unknown-linux-gnueabihf: uses arm-unknown-linux-gnueabihf-g++ (Rust triplet)

This fix:
1. Sets up update-alternatives for Debian-style names
2. Creates symlinks for Rust triplet names
3. Overrides compilers in /x-tools (crosstool-ng) if present

All variants now point to GCC 10 for C++20 support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use standard cross-rs image with clang instead of custom Docker images
- Force clang as C++ compiler via CXX_aarch64_unknown_linux_gnu env var
- Reduce targets to 4 for faster iteration:
  - macOS aarch64 (working)
  - macOS x86_64 (working)
  - Linux x86_64 native (working)
  - Linux aarch64 cross (testing clang)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add x86_64-pc-windows-msvc native build on windows-latest
- Install LLVM via chocolatey for libclang

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use correct `variables = [["KEY", "value"]]` syntax instead of
direct key assignments. This should properly set CXX to clang++.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cross-compilation env vars not being picked up by cozorocks build.rs.
Use GitHub's native ubuntu-24.04-arm runner instead - same approach
as x86_64 which already works.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cozorocks build.rs hardcodes C++17 for all platforms.
RocksDB requires C++20. This is an upstream issue.

Focus on Linux ARM native build first.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Set CXXFLAGS=/std:c++20 to override C++17 default.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use --no-default-features to exclude jemalloc feature on Windows.
jemalloc headers not available on Windows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove extra quotes causing feature parsing issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of comma-separated, use multiple --features flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
See if default features work or if jemalloc.h error returns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add windows-default feature that mirrors default but excludes jemalloc
since jemalloc is not available on Windows/MSVC. The cozo/rocksdb-jemalloc
feature was causing RocksDB to require jemalloc.h which doesn't exist on Windows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The pinned dependencies (serde_json, lazy_static, crossbeam, etc.)
were accidentally placed inside the [target.'cfg(not(target_env = "msvc"))']
section due to TOML section scoping rules. This caused them to be
excluded from Windows/MSVC builds.

Fixed by moving them before the target-specific jemalloc dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update workflow to use standard rustler_precompiled artifact naming
  (lib{crate}-v{version}-nif-{nif_version}-{target}.{ext}.tar.gz)
- Remove custom artifact renaming - use native rustler_precompiled output
- Require tags in v* format (e.g., v0.3.2) for releases
- Add contents:write permission for GitHub releases
- Simplify release publishing with make_latest and generate_release_notes

- Update cozodb_nif_loader.erl:
  - Change default GitHub repo to adiibanez/cozodb
  - Add COZODB_GITHUB_REPO env var override
  - Use rustler_precompiled artifact naming format
  - Handle library extraction and renaming to standard cozodb name
  - Support .dll extension for Windows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
nif_alloc_rocksdb_jemalloc = ["nif_alloc", "tikv-jemalloc-ctl", "tikv-jemalloc-sys", "cozo/rocksdb-jemalloc"]

[target.'cfg(target_os = "linux")'.dependencies]
cozo = { git = "https://github.com/aramallo/cozo.git", tag = "v0.8.2-leapsight", features = ["io-uring"] }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adiibanez we need my fork at the moment as we have additional features not in cozo

Cross.toml Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adiibanez This file is a duplicate of the one in native/cozodb so I guess you should delete it?

@aramallo aramallo changed the base branch from main to develop February 11, 2026 17:45
Adrian Ibañez and others added 2 commits February 20, 2026 13:07
- Delete duplicate root Cross.toml (keep native/cozodb/Cross.toml only)
- Resolve Cargo.toml conflicts: adopt upstream's v0.8.3-leapsight tag,
  opt-in jemalloc-profiling feature, and improved io-uring docs
- Resolve rebar.config conflicts: adopt upstream's Makefile-based build
  hooks (pre_hooks/post_hooks) replacing rebar3_cargo provider hooks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants