Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Compilation for Android x86 fails #345

Closed
@vmx

Description

@vmx

I tried to compile rust-mozjs for Android x86. It fails with the error below. I suspect that there's a mismatch between the platform headers and the actual platform. On Android x86 c_char is i8 on ARM it's u8.

I have no clue, why it would expect an ARM-stlye u8 although I compile for x86. I'm happy to work on a fix if anyone tells me where to look.

$ PATH=$PATH:/home/vmx/src/rust/android/android-24-toolchain-x86/bin ANDROID_NDK=/home/vmx/src/rust/android/android-ndk-r12b cargo build --target i686-linux-android --verbose
       Fresh log v0.3.7
       Fresh num-traits v0.1.37
       Fresh lazy_static v0.2.5
       Fresh gcc v0.3.45
       Fresh libc v0.2.21
       Fresh pkg-config v0.3.9
       Fresh cmake v0.1.22
       Fresh heapsize v0.3.9
       Fresh libz-sys v1.0.13
       Fresh mozjs_sys v0.0.0 (https://github.com/servo/mozjs#98c3df63)
   Compiling js v0.1.4 (file:///tmp/rust-mozjs)
     Running `rustc --crate-name js src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=bf95172d2256808a -C extra-filename=-bf95172d2256808a --out-dir /tmp/rust-mozjs/target/i686-linux-android/debug/deps --target i686-linux-android -C ar=/home/vmx/src/rust/android/android-24-toolchain-x86/bin/i686-linux-android-ar -C linker=/home/vmx/src/rust/android/android-24-toolchain-x86/bin/i686-linux-android-gcc -L dependency=/tmp/rust-mozjs/target/i686-linux-android/debug/deps -L dependency=/tmp/rust-mozjs/target/debug/deps --extern lazy_static=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblazy_static-6512ce482ce46607.rlib --extern num_traits=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libnum_traits-69f4129d46397118.rlib --extern mozjs_sys=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libmozjs_sys-97826a5d9cd703db.rlib --extern log=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblog-d4c0e5c2504fbbea.rlib --extern heapsize=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libheapsize-a0ca106bb4f4bbb6.rlib --extern libc=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblibc-5dc7b85e748840b4.rlib -L native=/tmp/rust-mozjs/target/i686-linux-android/debug/build/js-62abd7c6dbea0549/out/lib -l static=jsglue -L native=/tmp/rust-mozjs/target/i686-linux-android/debug/build/mozjs_sys-2cecbe7697181d13/out/js/src`
error[E0308]: mismatched types
  --> src/error.rs:24:11
   |
24 |     name: b"RUSTMSG_TYPE_ERROR\0" as *const _ as *const libc::c_char,
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = help: here are some functions which might fulfill your needs:
           - .offset(...)
           - .wrapping_offset(...)

error[E0308]: mismatched types
  --> src/error.rs:25:13
   |
25 |     format: &ERROR_FORMAT_STRING_STRING as *const libc::c_char,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = help: here are some functions which might fulfill your needs:
           - .offset(...)
           - .wrapping_offset(...)

error[E0308]: mismatched types
  --> src/error.rs:32:11
   |
32 |     name: b"RUSTMSG_RANGE_ERROR\0" as *const _ as *const libc::c_char,
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = help: here are some functions which might fulfill your needs:
           - .offset(...)
           - .wrapping_offset(...)

error[E0308]: mismatched types
  --> src/error.rs:33:13
   |
33 |     format: &ERROR_FORMAT_STRING_STRING as *const libc::c_char,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = help: here are some functions which might fulfill your needs:
           - .offset(...)
           - .wrapping_offset(...)

error: aborting due to 4 previous errors

error: Could not compile `js`.

Caused by:
  process didn't exit successfully: `rustc --crate-name js src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=bf95172d2256808a -C extra-filename=-bf95172d2256808a --out-dir /tmp/rust-mozjs/target/i686-linux-android/debug/deps --target i686-linux-android -C ar=/home/vmx/src/rust/android/android-24-toolchain-x86/bin/i686-linux-android-ar -C linker=/home/vmx/src/rust/android/android-24-toolchain-x86/bin/i686-linux-android-gcc -L dependency=/tmp/rust-mozjs/target/i686-linux-android/debug/deps -L dependency=/tmp/rust-mozjs/target/debug/deps --extern lazy_static=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblazy_static-6512ce482ce46607.rlib --extern num_traits=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libnum_traits-69f4129d46397118.rlib --extern mozjs_sys=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libmozjs_sys-97826a5d9cd703db.rlib --extern log=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblog-d4c0e5c2504fbbea.rlib --extern heapsize=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/libheapsize-a0ca106bb4f4bbb6.rlib --extern libc=/tmp/rust-mozjs/target/i686-linux-android/debug/deps/liblibc-5dc7b85e748840b4.rlib -L native=/tmp/rust-mozjs/target/i686-linux-android/debug/build/js-62abd7c6dbea0549/out/lib -l static=jsglue -L native=/tmp/rust-mozjs/target/i686-linux-android/debug/build/mozjs_sys-2cecbe7697181d13/out/js/src` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions