libzmq-rs icon indicating copy to clipboard operation
libzmq-rs copied to clipboard

WIP: Fix compilation for windows

Open jean-airoldie opened this issue 4 years ago • 4 comments

This fixes #127.

jean-airoldie avatar Jan 18 '20 01:01 jean-airoldie

pub const EBADF: c_int = 9; is missing from libzmq-rs/libzmq-sys/src/windows.rs

There are also Unix modules popping up in the Windows build:

Compiling libzmq v0.2.1 (C:\Dev\libzmq-rs\libzmq)
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> libzmq\src\poll.rs:20:5
   |
20 |     unix::io::{AsRawFd, RawFd},
   |     ^^^^ could not find `unix` in `os`

error[E0412]: cannot find type `RawFd` in this scope
   --> libzmq\src\poll.rs:131:8
    |
131 |     Fd(RawFd),
    |        ^^^^^ not found in this scope

error[E0405]: cannot find trait `AsRawFd` in this scope
   --> libzmq\src\poll.rs:136:8
    |
136 |     T: AsRawFd,
    |        ^^^^^^^ not found in this scope

error[E0412]: cannot find type `RawFd` in this scope
   --> libzmq\src\poll.rs:500:13
    |
500 |         fd: RawFd,
    |             ^^^^^ not found in this scope

error[E0412]: cannot find type `RawFd` in this scope
   --> libzmq\src\poll.rs:607:33
    |
607 |     fn remove_fd(&mut self, fd: RawFd) -> Result<(), Error> {
    |                                 ^^^^^ not found in this scope

error[E0412]: cannot find type `RawFd` in this scope
   --> libzmq\src\poll.rs:681:33
    |
681 |     fn modify_fd(&mut self, fd: RawFd, trigger: Trigger) -> Result<(), Error> {
    |                                 ^^^^^ not found in this scope

error: aborting due to 6 previous errors

hbgl avatar Jan 18 '20 02:01 hbgl

I added EBADF and I think the RawFd import should be good now.

jean-airoldie avatar Jan 18 '20 02:01 jean-airoldie

The problem is that std::os::unix::io::AsRawFd and std::os::unix::io::RawFd are used in poll.rs and RawFd is part of the public interface. I think somebody who is seriously interested in using libzmq on Windows should work with you on fixing the issue. I am not even sure if I will be using ZeroMQ for my own project so for now I will try out rust-zmq to learn more about ZeroMQ.

hbgl avatar Jan 18 '20 02:01 hbgl

I think somebody who is seriously interested in using libzmq on Windows should work with you on fixing the issue.

Indeed, I don't use windows personally nor do I own a windows machine. Realistically a windows CI env should be setup etc.

I am not even sure if I will be using ZeroMQ for my own project so for now I will try out rust-zmq to learn more about ZeroMQ.

I'm personally not using ZeroMQ anymore due to the many issues it has. Checkout my comment in this issue: https://github.com/jean-airoldie/libzmq-rs/issues/125#issuecomment-570551319. This might save you some time.

jean-airoldie avatar Jan 18 '20 03:01 jean-airoldie