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

Remove cmake #17

Merged
merged 67 commits into from
Feb 14, 2022
Merged

Remove cmake #17

merged 67 commits into from
Feb 14, 2022

Conversation

Jasper-Bekkers
Copy link
Contributor

@Jasper-Bekkers Jasper-Bekkers commented Feb 2, 2022

Why?

Currently because of the way this crate is set up (calling cmake) it requires that any user of this crate has cmake on their system installed. We think this badly impacts developer experience when using zmq (or our own downstream crates). As an example of where this shows up (not just our Traverse Research crates), is for example in Google's evcxr setup instructions for all platforms.

What?

It's become pretty standard in the Rust ecosystem to avoid cmake and instead to mirror it's buildscripts directly in Rust, usually it's relatively straight forward (just move over some defines and point it to some cpp files).

This switches over to the cc crate so that people using this crate don't need cmake to be installed on their system, but instead can just use cargo build without any additional requirements. The setup for this PR mirrors for example the setup used in breakpad-sys by Embark Studios.

As a result of switching to cc directly - we can enable parallel builds, and speed up the build times for zmq quite a bit when using the vendored feature - potentially making the non-vendored use-case of this crate obsolete.

Platform support

  • Windows
  • Linux
  • macOS

@jean-airoldie
Copy link
Owner

jean-airoldie commented Feb 4, 2022

Hi, removing cmake dep is of course a good idea. From what i recall, I only used the cmake build because building zmq without it was god awfull. If you can make this to work with only cc as a dependency, I'll happily merge this.

However the are a couple things i would like to see before I can merge:

  • Add a linux CI build (looks travis doesn't provide free OSS credit anymore, so anything else will do, for instance appveyor seems to work find).
  • Provide the same functionality, unless you show that said functionality is useless or deprecated.
  • If you add support for other platforms, please add CI builds for these.

src/lib.rs Outdated Show resolved Hide resolved
@Jasper-Bekkers
Copy link
Contributor Author

I'll switch the entire CI step to run on GitHub actions then if you don't mind, and work on getting more or less feature parity with what was there before.

How attached are you to breaking/non-breaking changes to this crate? Right now I've kept the API mostly the same but there's quite a few things that aren't being used upstream, or not needed anymore (for example the profile always seems to get set to the current building profile - however cc also does that so it'd be pretty easy to override though Cargo.toml instead).

@Jasper-Bekkers
Copy link
Contributor Author

@jean-airoldie
Copy link
Owner

Like mentioned previously, I'm fine with going the full static linking route everywhere as long we also vendor libsodium behind a curve feature and we remove the static feature.

@jean-airoldie
Copy link
Owner

jean-airoldie commented Feb 8, 2022

Also update the .gitmodule file to the proper libzmq branch. I'm guessing it should be v4.3.4.

@jean-airoldie
Copy link
Owner

Also checkout the vendor repo to the v4.3.4 branch.

@Jasper-Bekkers
Copy link
Contributor Author

Like mentioned previously, I'm fine with going the full static linking route everywhere as long we also vendor libsodium behind a curve feature and we remove the static feature.

Right now it's set up such that if libsodium is enabled, we automatically enable the curve feature. Would you want it the other way around? Or just to have one feature for both?

@jean-airoldie
Copy link
Owner

Right now it's set up such that if libsodium is enabled, we automatically enable the curve feature. Would you want it the other way around? Or just to have one feature for both?

It's better to have one feature. I think its better to use the CURVE feature because most users don't really care about implementation details of what exact encryption library is used.

@Jasper-Bekkers
Copy link
Contributor Author

Jasper-Bekkers commented Feb 8, 2022

It's better to have one feature. I think its better to use the CURVE feature because most users don't really care about implementation details of what exact encryption library is used.

I see what you mean - the reason it is the way it is, is because the libsodium feature requires some additional info to know where to locate it and it's headers. Want me to switch it - we'll have to move the libsodium params to the curve feature which also doesn't quite sound ideal?

@jean-airoldie
Copy link
Owner

jean-airoldie commented Feb 8, 2022

I see what you mean - the reason it is the way it is, is because the libsodium feature requires some additional info to know where to locate it and it's headers. Want me to switch it - we'll have to move the libsodium params to the curve feature which also doesn't quite sound ideal?

What I was thinking was to depend on libsodium-sys-stable and enable it via the curve feature. This way we also vendor libsodium. I can do that part on another PR before the release if you want me to.

testcrate/src/lib.rs Outdated Show resolved Hide resolved
@Jasper-Bekkers
Copy link
Contributor Author

Jasper-Bekkers commented Feb 8, 2022

@jean-airoldie I /think/ I've addressed most of your feedback - thanks, and I've made sure the build is green. I'm calling it quits for tonight, please let me know if there is any more feedback and I'll address it during the week.

@Jasper-Bekkers
Copy link
Contributor Author

@jean-airoldie We've been running with this for a few days now - do you think it's mergable and if so could you also spin a new release?

@jean-airoldie
Copy link
Owner

Sorry, I totally forgot about this, i'll do this today.

@jean-airoldie
Copy link
Owner

I'm thinking I'm gonna merge, then do some of the changes I wanted to do myself, so its faster. In this case I was thinking of removing the artifact structure entirely and link against libsodium automatically when curve is enabled.

@jean-airoldie jean-airoldie merged commit 649b49e into jean-airoldie:master Feb 14, 2022
@jean-airoldie
Copy link
Owner

Thanks for your work! I'm sure making this build work was painful.

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.

3 participants