-
Notifications
You must be signed in to change notification settings - Fork 193
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
Windows build environment for dynamic linking of ZeroMQ #249
Conversation
This failing-rustc-1.35.0-nightly-2019-03-25-Ubuntu.txt |
Sorry, I haven't had time to give your build system changes a proper review, but here are some initial thoughts:
|
Hi Andreas, Thank you for the response:
Your thoughts? |
Having more extensive instructions would be great! I'd feel more comfortable with that than with scripts I cannot be bothered to understand ;-). Maybe it makes sense to wait on how PR #262 works out, befor adding more extensive Windows build instructions, as that PR will have implications on the build instructions for all platforms.
I'm aware of that, but the thing I'm not comfortable with is that users in the future might be running into issues with these scripts, reporting them on github, and no-one can help them out. |
Hi Andreas, I updated the Windows build instructions for dynamic linking and removed the batch files from the system (but left a GitHub gist link in case anyone want to use them). I checked out PR #262; my proposed changes can easily be integrated and is not conflicting in any way. Regards |
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.
IIUC, what verify_windows_build_environment
is verifying that the user has set up their PATH
correctly, so that the libzmq DLL can be found at runtime (e.g. when running tests). I think this is not the build scripts' business to check. The code you wrote will also be invoked when cross-compiling from Linux to the x86_64-pc-windows-gnu
target, which works fine on current master
and release/v0.8
branches, but will fail with your changes. So, I think checking this in build.rs
is not reasonable.
Furthermore, the code seems to only add a level of indirection -- it doesn't actually verify that zmq.dll
can be found in the PATH
environment variable, but only that another environment variable, namely ZMQ_BIN_DIR
is set and found in PATH
. If you get setting that environment variable wrong, you will end up with same error message, presumably that zmq.dll
could not be found, when trying to run (note: not build) zmq.
So overall, I'd propose removing any references to LIBZMQ_BIN_DIR
from the instructions, and mention what really counts: that the shared library produced by the MSVC build must be named zmq.dll
and be placed in a directory that is found in PATH
. Then, the change to the appveyor batch file is superfluous. If I'm not wrong in my analysis, and this is indeed the one thing Windows developers have to ensure, the links to your complex .bat
scripts also seem to have little value.
So unless I've misunderstood the situation, please drop all code changes and the .bat
link and let's make this PR just about Windows build instructions.
zmq-sys/build.rs
Outdated
@@ -3,6 +3,27 @@ extern crate metadeps; | |||
use std::env; | |||
use std::path::Path; | |||
|
|||
fn verify_windows_build_environment() { | |||
let target = env::var("TARGET").ok().unwrap(); | |||
println!("cargo:target={:?}", target); |
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 is this cargo:target
config necessary? According to the cargo book, TARGET
should already refer to the target triplet selected, so this looks like a no-op to me. Also, I could not find any mention of the cargo:target
key in the build script section of the book.
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 cannot answer you really, just wanted to determine if the target is Windows, and this got the job done.
I just used the reference to cargo:target
to print some meaningful information for the user in the event that the code panics.
Will remove fn verify_windows_build_environment()
altogether as suggested to default back to the original, so this will be resolved.
|
||
- When building `libzmq` from sources, the library must be renamed | ||
to `zmq.lib` from the auto named `libzmq-v***-mt-gd-*_*_*.lib`, | ||
`libzmq.lib`, `libzmq-mt-*_*_*.lib`, etc. |
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.
Stylistic note: I assume you intend to have a paragraph break after etc.
. If so, you need a separate blank line. If not, you should your IDE/editor's facilities to block-justify the whole (then single) paragraph. Right now, it looks like a missing blank line (i.e., paragraph break). Similiar instances below. .
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.
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.
Oh, sorry, I missed this dashes next to the plus signs of the diff.
zmq-sys/build.rs
Outdated
let dll_path = prefix_dir("LIBZMQ_BIN_DIR", "bin"); | ||
match &dll_path { | ||
Some(dll_path) => { | ||
println!("cargo:dll_path={}", &dll_path); |
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.
Likewise, I couldn't dig up any documentation about cargo:dll_path
.
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 just used the reference to cargo:dll_path
to print some meaningful information for the user in the event that the code panics.
Will remove fn verify_windows_build_environment()
altogether as suggested, so this will be resolved.
Oh, and additionally, please squash (and if, applicable, rebase) your changes, giving the resulting squashed commit a fitting commit message. I prefer to have a simple git history, instead of preserving the the evolution of each PR for posterity in the git repository, as you would get when adding fixup commits to a PR. A PR should only contain multiple commits if they are separate logical units, which can be understood on their own. I really need to write up that |
Hi Andreas, All suggestions implemented. Just need to do the squash & rebase bit. ... Done! |
…-zmq into release/v0.8 Updated Windows build instructions for dynamic linking of ZeroMQ
I've now squash-merged your |
This change to assist Widows users to build rust-zmq when using ZeroMQ dynamic link libraries. Changes incorporated: