-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add static-libtiledb feature #186
Conversation
f7aa6d8
to
7750e68
Compare
44f7367
to
a7417c6
Compare
@rroelke This is reviewable finally. Apologies for forgetting about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments are mostly nits, the exception being
The hard /opt/tiledb/lib path seems wrong
But on top of that, \this seems like something which really ought to have dedicated CI jobs, doesn't it?
A build on Linux and MacOS at least.
tiledb/sys/build/current_os/linux.rs
Outdated
let mut tdb = std::path::PathBuf::from(build_dir); | ||
tdb.extend(["tiledb", "libtiledb.a"]); | ||
if !tdb.is_file() { | ||
panic!("Missing libtiled: {}", tdb.display()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - should be MIssing libtiledb
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually just went with `Missing static library: {}" cause the tdb.display() includes the full path anyway.
tiledb/sys/build/command.rs
Outdated
out.unwrap_or("".to_string()), | ||
err.unwrap_or("".to_string()) | ||
); | ||
return Err(Error::Git(msg)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW the function here runs any subprocess command, there's nothing git-specific here. Seems like this should return up a generic error and then the caller in repo.rs
should wrap Error::Git
around that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was some refactoring gone dumb. I've since removed all of this and the Error::Git variant completely.
tiledb/sys/build/command.rs
Outdated
|
||
// Wait for git to finish executing | ||
loop { | ||
let result = git.poll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not wait
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably because I didn't take the time to read the docs very thoroughly. I happened to stumble over a good example of using std::process::Command
this morning so I've since switched everything to that and its turned out cleaner.
tiledb/sys/build/main.rs
Outdated
libdir | ||
); | ||
|
||
println!("cargo:rustc-env=DYLD_LIBRARY_PATH=/opt/tiledb/lib"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hard /opt/tiledb/lib
path seems wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was, you caught me in the middle of debugging issues I didn't catch until attempting to use this in a separate repository for a complete static binary.
b408abc
to
3db0f84
Compare
@rroelke Originally I was just going to rely on some tests in another repository for the CI checks of static builds, but doing that exposes the fact that its a really terrible way to develop this feature. I've added a nightly workflow on my fork and am currently testing that we get static builds correctly. I'll give you a holler when that's done and reflected in this PR. I just wanted to avoid you having the same 50+ emails about nightlies failing as I do the CI dev work. |
3db0f84
to
e865bb8
Compare
@@ -34,15 +34,11 @@ impl TDBString { | |||
} | |||
|
|||
pub fn to_string(&self) -> TileDBResult<String> { | |||
let mut c_str: *const i8 = out_ptr!(); | |||
let mut c_str = out_ptr!(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are non-obvious, I'll note that the API uses c_char
in its signature. Unfortunately, c_char
's signedness isn't defined and I happened to be the first to find a platform where its u8
. Rather than cast, I've just removed the type and rely on inference now.
e865bb8
to
1566417
Compare
@rroelke Apologies for getting side tracked and not telling you to hold off on your review while I fixed things. But things are now actually really fixed. This includes a new "Static Nightlies" CI workflow that runs on Ubuntu and MacOS and actually asserts that there's no dynamic linkage after the tests complete. I've developed that CI workflow on my personal fork and you can see that its passing here: https://github.com/davisp/tiledb-rs/actions/runs/11749237318 Also, to show that the static assert works on Linux, I ran this temporary commit through the standard PR build with the check enabled and it fails as expected: https://github.com/davisp/tiledb-rs/actions/runs/11749234997/job/32735029329 Unfortunately I can't really link to those on this repo until after this PR is merged, but hopefully the runs on my fork will be convincing enough. |
1566417
to
dd7fd52
Compare
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.
dd7fd52
to
f446234
Compare
let out_dir = utils::out_dir().display().to_string(); | ||
let output = Command::new("git") | ||
.arg("clone") | ||
.arg("https://github.com/TileDB-Inc/TileDB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be environmental so a network connection isn't required. So that you can point at a local filesystem path. That's also potentially useful for testing against non-master.
Similarly, should there be an argument to clone the latest release? or nightly? or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I've not added this as I'm not yet certain how we'll end up specifying versions of tiledb to link against when we get to formalized releases of tiledb-rs. I've opened a story here: https://app.shortcut.com/tiledb-inc/story/59243
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one note about where to clone core from, otherwise let's merge!
This allows for building libtiledb statically.