Failed to compile rust bindings (tvm-common)



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/


100 | device_type: ctx.device_type as i32,

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

error[E0308] : mismatched types

–> common/src/


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/

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.


@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/


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


to “” 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.


thank you @paddyhoran