38 / d4-format

The D4 Quantitative Data Format
MIT License
156 stars 20 forks source link

Does not compile on M1 mac #58

Closed jdidion closed 1 year ago

jdidion commented 2 years ago

I am trying to build this in an ubuntu-based Docker image on an M1 mac and get the error:

#0 120.2 error[E0308]: mismatched types
#0 120.2    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/d4-hts-0.3.7/src/alignment/bamfile.rs:102:52
#0 120.2     |
#0 120.2 102 |             let raw_name = unsafe { CStr::from_ptr(*raw_name as *const i8) };
#0 120.2     |                                     -------------- ^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
#0 120.2     |                                     |
#0 120.2     |                                     arguments to this function are incorrect
#0 120.2     |
#0 120.2     = note: expected raw pointer `*const u8`
#0 120.2                found raw pointer `*const i8`

Here is the Dockerfile:

FROM ubuntu:focal

ARG VERSION

ENV PATH="/root/.cargo/bin:${PATH}"

RUN apt update \
    && apt install -y build-essential curl git \
    && curl https://sh.rustup.rs -sSf | sh -s -- -y \
    && cargo install d4tools@${VERSION}
ggozad commented 2 years ago

This also breaks pyd4 on m1 inside a docker container.

dotinspace commented 1 year ago

It appears this can be worked around by letting the compiler infer type, i.e.

let raw_name = unsafe { CStr::from_ptr(*raw_name as *const _) };

But since I am no rust dev, I have no idea if that is considered good practice or not.

38 commented 1 year ago

Hi all, sorry for the delay. I just committed a fix for this issue, but not sure if it helps on M1 since I don't have any M1 device on my hand. It would be nice if anyone who can confirm if the latest commit compiles with M1. Close the issue for now, feel free to reopen the issue if the problem persists. Thanks!

ggozad commented 1 year ago

Hey thanks for the fix! This compiles fine on arm64 on my M1. A release would be greatly appreciated :)