tursodatabase / tursodatabase/libsql

Compile error for libsql-ffi feature sqlean-extension-regexp under macOS arm64

Open
#2,179 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Thanks to @sivukhin for bundling sqlean's regexp extension in PR #2160. It works for me under Linux, but under macOS arm64 I get a compiler error ld: archive member '9b5fb81abcc0eb79-pcre2_internal.o' not a mach-o file in '[...]libsql/target/debug/build/libsql-ffi-27754f27da3d637e/out/liblibsql.a'

My system: macOS 15.5, Apple M4 Pro processor, rustc 1.85.0 (4d91de4e4 2025-02-17).

Steps to reproduce:

git clone https://github.com/tursodatabase/libsql.git
cd libsql/libsql-ffi
cargo build # succeeds
cargo test # succeeds
cargo build --features sqlean-extension-regexp # succeeds
cargo test --features sqlean-extension-regexp # compiler error

Line 258 of libsql-ffi/build.rs says sqlean_patterns.push("regexp/pcre2/pcre2_internal.h");, which is the only sqlean_patterns line that includes an .h file.

https://github.com/tursodatabase/libsql/blob/71906fa55418d60db48e9747c7b7ec9619af322b/libsql-ffi/build.rs#L258

When I comment that line out compilation succeeds, but when I run the code, the regexp functions don't seem to be defined: I get runtime errors like SqliteFailure(1, "no such function: regexp_like").

This is not an area I know much about. Happy to provide more information.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libsql-ffi/build.rs around line 258 and reproduce with cargo test --features sqlean-extension-regexp on macOS arm64. Inspect how the regexp/pcre2/pcre2_internal.h entry contributes to target/debug/build/libsql-ffi-*/out/liblibsql.a and compare the generated archive members with the successful Linux build. Done means the feature builds and tests successfully on macOS arm64, with regexp_like available at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust, sqlite
Domain
build-system, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.