arthurprs / floki

Floki Message Queue
MIT License
91 stars 11 forks source link

32-bit build fails #6

Closed MagaTailor closed 8 years ago

MagaTailor commented 8 years ago

On 32-bit arm, using stable rust 1.5.0, I'm getting the following error:

Compiling floki v0.1.0 (file:///tmp/floki-master)
src/server.rs:109:23: 109:25 error: mismatched types:
 expected `server::NotifyMessage`,
    found `()`
(expected enum `server::NotifyMessage`,
    found ()) [E0308]
src/server.rs:109             Ok(ok) => ok,
                                        ^~
src/server.rs:252:17: 252:96 note: in this expansion of try_or_error! (defined in src/server.rs)
src/server.rs:109:23: 109:25 help: run `rustc --explain E0308` to see a detailed explanation
src/server.rs:109:23: 109:25 error: mismatched types:
 expected `server::NotifyMessage`,
    found `()`
(expected enum `server::NotifyMessage`,
    found ()) [E0308]
src/server.rs:109             Ok(ok) => ok,
                                        ^~
src/server.rs:256:17: 256:82 note: in this expansion of try_or_error! (defined in src/server.rs)
src/server.rs:109:23: 109:25 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:192:30: 192:38 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:192             ptr::null_mut(), file_len,
                                                      ^~~~~~~~
src/queue_backend.rs:191:25: 194:34 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:192:30: 192:38 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:197:13: 197:21 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:197             file_len,
                                     ^~~~~~~~
src/queue_backend.rs:195:9: 198:37 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:197:13: 197:21 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:293:56: 293:74 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:293             mman::msync(self.file_mmap as *mut c_void, sync_offset as u64, mman::MS_SYNC).unwrap();
                                                                                ^~~~~~~~~~~~~~~~~~
src/queue_backend.rs:293:56: 293:74 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:308:13: 308:36 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:308             self.sync_offset as u64,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
src/queue_backend.rs:306:9: 309:35 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:308:13: 308:36 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:384:29: 384:49 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:384         mman::madvise(mmap, self.file_len as u64, mman::MADV_DONTNEED).unwrap();
                                                     ^~~~~~~~~~~~~~~~~~~~
src/queue_backend.rs:384:29: 384:49 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:385:28: 385:48 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:385         mman::munmap(mmap, self.file_len as u64).unwrap();
                                                    ^~~~~~~~~~~~~~~~~~~~
src/queue_backend.rs:385:28: 385:48 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 8 previous errors
Could not compile `floki`.
arthurprs commented 8 years ago

Thank you for the report. I'll check it out.

arthurprs commented 8 years ago

Ok, I beleive I got it fixed on 32bit systems.

It still won't build on stable, but that's expected as the code uses 4 features gates.

MagaTailor commented 8 years ago

Almost, using x86 1.7 :

Compiling floki v0.1.0 (file:///home/petevine/floki-master)
src/queue_backend.rs:188:30: 188:38 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:188             ptr::null_mut(), file_len,
                                                      ^~~~~~~~
src/queue_backend.rs:187:25: 190:34 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:188:30: 188:38 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:193:13: 193:21 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:193             file_len,
                                     ^~~~~~~~
src/queue_backend.rs:191:9: 194:37 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:193:13: 193:21 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:289:56: 289:74 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:289             mman::msync(self.file_mmap as *mut c_void, sync_offset as u64, mman::MS_SYNC).unwrap();
                                                                                ^~~~~~~~~~~~~~~~~~
src/queue_backend.rs:289:56: 289:74 help: run `rustc --explain E0308` to see a detailed explanation
src/queue_backend.rs:304:13: 304:36 error: mismatched types:
 expected `u32`,
    found `u64`
(expected u32,
    found u64) [E0308]
src/queue_backend.rs:304             self.sync_offset as u64,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
src/queue_backend.rs:302:9: 305:35 note: in this expansion of try! (defined in <std macros>)
src/queue_backend.rs:304:13: 304:36 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 4 previous errors
Could not compile `floki`.
arthurprs commented 8 years ago

Finally fixed on 8b88891fe3fd109bd7bd87d88a3649cad438366a

I'll leave this open until I add a 32bit compilation job in travis.

MagaTailor commented 8 years ago

Yep, the 32-bit issue is fixed. Now, if you want to allow building on arm, this breakage causes errors like these:

Compiling nix v0.3.9
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/fcntl.rs:102:28: 102:41 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/fcntl.rs:102         unsafe { ffi::open(cstr.as_ptr(), oflag.bits(), mode.bits() as mode_t) }
                                                                                                               ^~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/fcntl.rs:101:14: 103:8 note: in this expansion of try! (defined in <std macros>)
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/fcntl.rs:102:28: 102:41 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:105:30: 105:43 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:105         unsafe { ffi::umount(cstr.as_ptr()) }
                                                                                                                 ^~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:104:15: 106:8 note: in this expansion of try! (defined in <std macros>)
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:105:30: 105:43 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:113:31: 113:44 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:113         unsafe { ffi::umount2(cstr.as_ptr(), flags.bits) }
                                                                                                                  ^~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:112:15: 114:8 note: in this expansion of try! (defined in <std macros>)
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mount.rs:113:31: 113:44 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:80:37: 80:50 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:80     let res = unsafe { ffi::mq_open(name.as_ptr(), oflag.bits(), mode.bits() as mode_t, attr as *const MqAttr) };
                                                                                                                        ^~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:80:37: 80:50 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:90:39: 90:52 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:90     let res = unsafe { ffi::mq_unlink(name.as_ptr()) };
                                                                                                                          ^~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:90:39: 90:52 help: run `rustc --explain E0308` to see a detailed explanation
   Compiling env_logger v0.3.2
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:112:31: 112:47 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:112     let len = unsafe { strlen(message.as_ptr()) as size_t };
                                                                                                                   ^~~~~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:112:31: 112:47 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:113:44: 113:60 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:113     let res = unsafe { ffi::mq_send(mqdes, message.as_ptr(), len, msq_prio) };
                                                                                                                                ^~~~~~~~~~~~~~~~
/home/odroid/.cargo/git/checkouts/nix-rust-410e385daf3c9671/master/src/mqueue.rs:113:44: 113:60 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/nix-0.3.9/src/fcntl.rs:74:28: 74:41 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]

and so on. In most cases they can be fixed by simple casts as *const _

arthurprs commented 8 years ago

I guess these should go on the nix repository

MagaTailor commented 8 years ago

Well yeah, that was just an illustration of the problem. Or are you saying you're certain the final stage (your own code) would be free of this kind of error?