Failed to compile rust bindings (tvm-common)

Hi

I just started with tvm rust and got the following error message when I tried to build the resnet example on macOS:

Compiling tvm-common v0.1.0 (/Users/usr/tvm/rust/common)

error[E0308] : mismatched types

–> common/src/array.rs:100:26

|

100 | device_type: ctx.device_type as i32,

| ^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308] : mismatched types

–> common/src/packed_func.rs:87:25

|

87 | DLDataTypeCode_kDLInt => Int($value.v_int64),

| ^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32

143 | / TVMPODValue! {

144 | | /// A borrowed TVMPODValue. Can be constructed using into() but the preferred way

145 | | /// to obtain a TVMArgValue is automatically via call_packed!.

146 | | TVMArgValue<'a> {

|

159 | | }

160 | | }

| |_- in this macro invocation

|

= note : expected type **i32**

found type **u32**

error[E0308] : mismatched types

–> common/src/packed_func.rs:88:25

Any idea what could cause this error?

Hey @sepia

I submitted a PR to fix type mismatches here. Now I’m wondering if this is platform specific. I’m on windows. Are you on Linux/Mac?

Can you revert the changes in the above PR and test, I’m assuming that’s the issue. If you can confirm, I’ll submit a PR to fix it.

Thanks @paddyhoran

Yes, I’m on Mac and reverting the changes from the PR fixed the issue.

Ok, there might be a better solution but for now I’ll submit a PR to conditionally compile for windows. Thanks for testing.

1 Like

@sepia I posted a fix for this here. If you get a chance will you confirm that it works for you?

@paddyhoran unfortunately no. I get the following error when compiling:

Compiling tvm-common v0.1.0 (/Users/tvm/rust/common)

error : enum variants on type aliases are experimental

–> common/src/packed_func.rs:213:21

|

213 | Self::$variant(val as $inner_ty)

| ^^^^^^^^^^^^^^

253 | impl_pod_value!(Int, i64, [i8, i16, i32, i64, isize]);

| ------------------------------------------------------ in this macro invocation

|

= help : add #![feature(type_alias_enum_variants)] to the crate attributes to enable

I also added the

#![feature(type_alias_enum_variants)]

to “packed_func.rs” which didn’t resolve the issue.

When compiling “runtime tests” I got another error

@sepia, type_alias_enum_variants feature has been stabalized. If you update your version of Rust that error should go away.

1 Like

thank you @paddyhoran