Closed
Description
When trying to build for x86_64-unknown-linux-gnux32, a lot of errors are shown (the first ones not related to x32). It would be nice to see support for this. The problem is that many places use libc::c_long
, which for x86_64-unknown-linux-gnux32 is i32
, where the actual types to use are i64
for compatibility with x86_64-unknown-linux-gnu.
I am just reporting this as an issue for the moment: I had taken a stab at fixing this myself, but quickly found I don't really know Rust well enough yet. If someone else doesn't get it working first, I will try again when I have some more time to learn the language properly.
$ cargo build --target=x86_64-unknown-linux-gnux32
Updating crates.io index
Compiling libc v0.2.85
Compiling bitflags v1.2.1
Compiling cfg-if v1.0.0
Compiling nix v0.19.0 (/home/harald/rust-nix)
error[E0308]: mismatched types
--> src/mqueue.rs:47:29
|
47 | (*p).mq_flags = mq_flags;
| ^^^^^^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `mq_flags.into()`
error[E0308]: mismatched types
--> src/mqueue.rs:48:30
|
48 | (*p).mq_maxmsg = mq_maxmsg;
| ^^^^^^^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `mq_maxmsg.into()`
error[E0308]: mismatched types
--> src/mqueue.rs:49:31
|
49 | (*p).mq_msgsize = mq_msgsize;
| ^^^^^^^^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `mq_msgsize.into()`
error[E0308]: mismatched types
--> src/mqueue.rs:50:31
|
50 | (*p).mq_curmsgs = mq_curmsgs;
| ^^^^^^^^^^
| |
| expected `i64`, found `i32`
| help: you can convert an `i32` to an `i64`: `mq_curmsgs.into()`
error[E0308]: mismatched types
--> src/mqueue.rs:56:9
|
55 | pub fn flags(&self) -> c_long {
| ------ expected `i32` because of return type
56 | self.mq_attr.mq_flags
| ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
56 | self.mq_attr.mq_flags.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/mqueue.rs:154:31
|
154 | ... oldattr.mq_attr.mq_maxmsg,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
154 | oldattr.mq_attr.mq_maxmsg.try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/mqueue.rs:155:31
|
155 | ... oldattr.mq_attr.mq_msgsize,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
155 | oldattr.mq_attr.mq_msgsize.try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/mqueue.rs:156:31
|
156 | ... oldattr.mq_attr.mq_curmsgs);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
156 | oldattr.mq_attr.mq_curmsgs.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/mqueue.rs:166:31
|
166 | ... oldattr.mq_attr.mq_maxmsg,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
166 | oldattr.mq_attr.mq_maxmsg.try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/mqueue.rs:167:31
|
167 | ... oldattr.mq_attr.mq_msgsize,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
167 | oldattr.mq_attr.mq_msgsize.try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/mqueue.rs:168:31
|
168 | ... oldattr.mq_attr.mq_curmsgs);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
168 | oldattr.mq_attr.mq_curmsgs.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/statfs.rs:102:16
|
102 | FsType(self.0.f_type)
| ^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
102 | FsType(self.0.f_type.try_into().unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/statfs.rs:142:9
|
141 | pub fn optimal_transfer_size(&self) -> libc::c_long {
| ------------ expected `i32` because of return type
142 | self.0.f_bsize
| ^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
142 | self.0.f_bsize.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:181:9
|
180 | pub fn block_size(&self) -> libc::c_long {
| ------------ expected `i32` because of return type
181 | self.0.f_bsize
| ^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
181 | self.0.f_bsize.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:223:9
|
222 | pub fn maximum_name_length(&self) -> libc::c_long {
| ------------ expected `i32` because of return type
223 | self.0.f_namelen
| ^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
223 | self.0.f_namelen.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:267:9
|
266 | pub fn blocks(&self) -> libc::c_ulong {
| ------------- expected `u32` because of return type
267 | self.0.f_blocks
| ^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
267 | self.0.f_blocks.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:305:9
|
304 | pub fn blocks_free(&self) -> libc::c_ulong {
| ------------- expected `u32` because of return type
305 | self.0.f_bfree
| ^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
305 | self.0.f_bfree.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:343:9
|
342 | pub fn blocks_available(&self) -> libc::c_ulong {
| ------------- expected `u32` because of return type
343 | self.0.f_bavail
| ^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
343 | self.0.f_bavail.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:381:9
|
380 | pub fn files(&self) -> libc::c_ulong {
| ------------- expected `u32` because of return type
381 | self.0.f_files
| ^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
381 | self.0.f_files.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/statfs.rs:419:9
|
418 | pub fn files_free(&self) -> libc::c_ulong {
| ------------- expected `u32` because of return type
419 | self.0.f_ffree
| ^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
419 | self.0.f_ffree.try_into().unwrap()
|
error[E0308]: mismatched types
--> src/sys/sysinfo.rs:39:24
|
39 | self.scale_mem(self.0.totalswap)
| ^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
39 | self.scale_mem(self.0.totalswap.try_into().unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/sysinfo.rs:44:24
|
44 | self.scale_mem(self.0.freeswap)
| ^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
44 | self.scale_mem(self.0.freeswap.try_into().unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/sysinfo.rs:49:24
|
49 | self.scale_mem(self.0.totalram)
| ^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
49 | self.scale_mem(self.0.totalram.try_into().unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/sysinfo.rs:58:24
|
58 | self.scale_mem(self.0.freeram)
| ^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
58 | self.scale_mem(self.0.freeram.try_into().unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/sys/time.rs:76:22
|
76 | tv_nsec: duration.subsec_nanos() as c_long
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i64`, found `i32`
error[E0308]: mismatched types
--> src/sys/time.rs:151:37
|
151 | ... tv_nsec: nanos as c_long })
| ^^^^^^^^^^^^^^^ expected `i64`, found `i32`
error[E0308]: mismatched types
--> src/sys/time.rs:192:9
|
191 | pub fn tv_nsec(&self) -> c_long {
| ------ expected `i32` because of return type
192 | self.0.tv_nsec
| ^^^^^^^^^^^^^^ expected `i32`, found `i64`
|
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
192 | self.0.tv_nsec.try_into().unwrap()
|
error: aborting due to 27 previous errors
For more information about this error, try `rustc --explain E0308`.
error: could not compile `nix`
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
No labels