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

zeromq-src #257

Closed
AxelNennker opened this issue May 7, 2019 · 12 comments
Closed

zeromq-src #257

AxelNennker opened this issue May 7, 2019 · 12 comments

Comments

@AxelNennker
Copy link

I suggest to follow the example of rust-openssl to build the library from source if needed or when the developer requests it.

rust-openssl has a crate feature 'vendored' which gets the openss source code by using the openssl-src crate.
https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/Cargo.toml#L15
Then ./configure --prefix=OUTDIR/... && make && make install is run.
Afterwards the openssl libraries are available in OUTDIR/...
The right compiler is found using the CC crate.

This would enable zeromq to be used when e.g. cross-compiling to e.g. Android without struggle of the developer.

Currently cargo build --target= requires the developer to build libzmq for that target beforehand. By supporting building from from we could avoid this.

@jean-airoldie
Copy link
Contributor

Something like this?

@AxelNennker
Copy link
Author

Yes, but here for this crate

@jean-airoldie
Copy link
Contributor

The crate I linked is compatible with this lib, so it would be trivial to add support.

@rotty
Copy link
Collaborator

rotty commented May 19, 2019

@jean-airoldie I think there could (should?) probably be a shared libzmq-src (or rather zeromq-src, as @AxelNennker suggested) crate shared between the libzmq crate and the zmq crate.

I've tried to explain this review how this might work out.

@jean-airoldie
Copy link
Contributor

jean-airoldie commented May 20, 2019

I do agree with this approach. It might be interesting to create a new repo entirely. It should probably be named zeromq-sys or libzmq-sys to follow the rust cffi conventions.

The approach I went with was to use a libzmq git submodule and allow the user to decide whether to link statically or dynamically (or build with DRAFT API etc.). I also generate bindings with every build (which add a clang-6 dependency). From what I understand that's pretty much what you where looking to do.

In all cases I would be interested in helping maintain such a crate since I have a couple applications that would depend on it.

@AxelNennker
Copy link
Author

@jean-airoldie Thanks, Jean. How about you create a PR to rust-zmq that adds compile-from-src support and see what rust-zmq maintainers say to that?

My motivation is that I would like to see cargo build --target=aarch64-linux-android working. There are more step needed to that goal but compiling zmq from source is an important one in that direction.

@jean-airoldie
Copy link
Contributor

I just not convinced that such a crate should live here as this repo is not as active as I would like. If I have to wait several months for my PRs to be reviewed and merged its no good. That's why I'm interested to see what @rotty thinks.

@AxelNennker
Copy link
Author

AxelNennker commented May 20, 2019

Why would the src-crate have to live here? Couldn't you publish your zeromq-src crate at crates.io like openssl does and use that crate here and where ever it is needed/useful?
https://crates.io/crates/openssl-src

Where the repo for this zeromq-src lives is not so interesting. I assume that you and @rotty and others will contribute if necessary. It seems easy to set up and probably does not need much maintenance except for the occasional src-update

@jean-airoldie
Copy link
Contributor

Right this makes a lot of sense. I did not think about making the src and sys crate separate.

I am personally using the library from the master branch since I submit occasional PRs, so that would require little bit of maintenance in the form of occasion version bumps.

@jean-airoldie
Copy link
Contributor

Alright, so I made this crate which provides the basic tooling as well as the libzmq source code. I'll make a PR to integrate it in zmq-sys.

@rotty
Copy link
Collaborator

rotty commented May 26, 2019

This will be resolved when #267 lands, which is almost ready.

@rotty
Copy link
Collaborator

rotty commented May 27, 2019

PR #267 has been merged, so this should be resolved now.

@rotty rotty closed this as completed May 27, 2019
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 a pull request may close this issue.

3 participants