Remacs: make type error for ARM aarch64 u8/i8

Created on 22 Mar 2019  路  5Comments  路  Source: remacs/remacs

Hi.

I am trying to compile remacs on a Pinebook with ARM processor running Manjaro ARM for aarch64 architecture.

It goes well for quite some time but then during the make process the following error appears:

(this is just a short section of the log)

.
.
   Compiling remacs v0.1.0 (/home/mmw/local/remacs/rust_src)
   Compiling remacs-macros v0.1.0 (/home/mmw/local/remacs/rust_src/remacs-macros)
error[E0308]: mismatched types
  --> src/callproc.rs:62:31
   |
62 |         unsafe { build_string(NULL_DEVICE.as_ptr() as *const i8) }.into()
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`

error[E0308]: mismatched types
  --> src/callproc.rs:69:13
   |
69 |             encoded_file.const_data_ptr() as *const i8,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`

error[E0308]: mismatched types
  --> src/callproc.rs:78:17
   |
78 |                 "Opening process input file".as_ptr() as *const i8,
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`
.
.
.

The actual list of errors is longer and other file are involved, but I guess they are follow up errors? If required I could maybe get the full log.

Any idea how to fix that ?

Most helpful comment

the fix works for me :-)

All 5 comments

Ah, the classic "char" is "unsigned char" on some ARM platforms.

In the remacs port we need to consistently use a data type that matches the platform. Clearly i8 is not it. Can you try libc::c_char and see if that helps. If it does we can switch out any place where a C char pointer is used.

I can try.
How would I do that?
Unfortunately I don"t know much about Rust or programming.
Any pointer would be appreciated.

Based on @shaleh 's advice, I fixed this error and built successfully on a Raspberry Pi with ARM processor running Manjaro ARM (aarch64). If there were no problem, I'll create a PR.

Looks reasonable @jamcha-aa please do

the fix works for me :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edvorg picture edvorg  路  8Comments

hammerandtongs picture hammerandtongs  路  4Comments

simon-frankau picture simon-frankau  路  6Comments

PythonNut picture PythonNut  路  3Comments

brotzeit picture brotzeit  路  5Comments