Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Don't link libsnappy explicitly #4841

Merged
merged 1 commit into from
Mar 10, 2017
Merged

Don't link libsnappy explicitly #4841

merged 1 commit into from
Mar 10, 2017

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Mar 9, 2017

It is already linked by rocksdb-sys which is a dependency.
Should help with #4836

@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Mar 9, 2017
@gavofyork
Copy link
Contributor

gavofyork commented Mar 10, 2017

if we switch from rocksdb to lmdb, wouldn't this break our linking? (it seems like we would be relying on an undocumented side-effect)

@debris
Copy link
Collaborator

debris commented Mar 10, 2017

if we switch from rocksdb to lmdb, wouldn't this break our linking?

Yes

what do you think about small hack with features?

Cargo.toml

[features]
default = ["rocksb"]

snappy.rs

// snappy is already linked by rocksdb
#[cfg(non(features='rocksb'))]
mod non_rocksb {
    #[link(name = "snappy", kind = "static")]
    extern {}
}

@arkpar
Copy link
Collaborator Author

arkpar commented Mar 10, 2017

#[link(name = "snappy", kind = "static")] is wrong anyway, because it assumes that there's a library already available in the system. If at some point we'd remove rocksdb it would break in even worse way. It would use the system library that some systems have and some don't and it won't work with cross-compiling scenarios.
Proper way is to have libsnappy-sys and libsnappy rust bindings is a separate crate. if we switch from rocksdb to lmdb this will indeed break things and we'll have add that crate eventually.

@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 10, 2017
@gavofyork gavofyork merged commit bc9464f into master Mar 10, 2017
@gavofyork gavofyork deleted the snappy-link branch March 10, 2017 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants