Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build liblmdb, associated tools and tests with zig build system #1

Merged
merged 16 commits into from
Sep 30, 2024

Conversation

Ultra-Code
Copy link
Collaborator

Add CI script and ensure it builds on Linux, macOS, and Windows
Add steps to install liblmdb, build tools and install test
Add a Zig module that provides an interface to the liblmdb headers
Test it out with recblock to ensure things are working as expected

add strip and lto options
use zig native backend and linker in debug mode

test is still not compiling, look into it
The test step runs all the test, they currently are all failing
this would be fixed in a future commit

The tool step installs all the lmdb binary tools

Rename some varibles to make their intent clear
The step currently isn't robust but will fix it soon
check if addIncludePath is available else use addIncludeDir
don't set preferred mode to allow library users to specify optimize mode

always translate the headers in debug mode
from discussions on discord step dependencies are run concurrently
so when create_testdb is run as a dependency of install-test it is
usually run early, my assumption is because it performs a simple
operation

to fix this I made the make fn of create_testdb the make of the
install-step, this ensures that is is only run after all dependencies
have runned

another way to go would be

```zig
    const install_test_step = b.step("test", "install testdb");
    const create_testdb_step = create_testdb.create_testdb(b);
    install_test_step.dependOn(create_testdb_step);
    create_testdb_step.dependOn(create_test_step);

```
as was suggested by @kprotty on discord but I chose the solution
in this commit because it has the benefit that it is simple
and it won't show up in `zig build` so that users don't just run
the `create_testdb` step without actually installing the test
test 3 and 5 panic with illegal instruction when built with -fsanitize-c
And don't use lld on macos
pass -D_DARWIN_C_SOURCE to macos builds, from my reading online this
macro defines some legacy typedefs from BSD that are still lingering
in macos headers
@Ultra-Code Ultra-Code merged commit 2b71976 into main Sep 30, 2024
11 of 18 checks passed
@Ultra-Code Ultra-Code deleted the test-with-recblock branch September 30, 2024 10:51
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.

1 participant