Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" } #4895

Open
zN3utr4l opened this issue May 30, 2024 · 4 comments

Comments

@zN3utr4l
Copy link

Bug description

pi@raspberrypi:~/prisma-engines $ RUST_BACKTRACE=full cargo build --release
   Compiling query-engine v0.1.0 (/home/pi/prisma-engines/query-engine/query-engine)
   Compiling tracing-subscriber v0.3.17
   Compiling napi-derive-backend v1.0.59
   Compiling libsqlite3-sys v0.26.0
error: failed to run custom build command for `query-engine v0.1.0 (/home/pi/prisma-engines/query-engine/query-engine)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/pi/prisma-engines/target/release/build/query-engine-e514c681439b31c2/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at query-engine/query-engine/build.rs:4:75:
  called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  stack backtrace:
     0:   0x4b8c8c - <unknown>
     1:   0x4d9dbc - <unknown>
     2:   0x4b6890 - <unknown>
     3:   0x4b8a70 - <unknown>
     4:   0x4ba2b0 - <unknown>
     5:   0x4b9eac - <unknown>
     6:   0x4ba958 - <unknown>
     7:   0x4ba66c - <unknown>
     8:   0x4b91c8 - <unknown>
     9:   0x4ba434 - <unknown>
    10:   0x494ee4 - <unknown>
    11:   0x4952bc - <unknown>
    12:   0x4984c8 - <unknown>
    13:   0x49872c - <unknown>
    14:   0x495dc0 - <unknown>
    15:   0x495790 - <unknown>
    16:   0x4957f0 - <unknown>
    17:   0x4b3810 - <unknown>
    18:   0x4957c8 - <unknown>
    19:   0x498754 - <unknown>
    20: 0xb6d50740 - __libc_start_main
                         at ./csu/libc-start.c:308:16
warning: build failed, waiting for other jobs to finish...
    Building [====================>    ] 773/900: tracing-subscriber, napi-derive-backend

rust-lang/cargo#13983

How to reproduce

https://github.com/prisma/prisma-engines?tab=readme-ov-file#building-prisma-engines

Expected behavior

No response

Prisma information

Build

Environment & setup

cargo 1.78.0 (54d8815d0 2024-03-26)
release: 1.78.0
commit-hash: 54d8815d04fa3816edc207bbc4dd36bf18014dbc
commit-date: 2024-03-26
host: armv7-unknown-linux-gnueabihf
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Raspberry Pi OS 11 (bullseye) [32-bit]

Prisma Version

latest

@zN3utr4l zN3utr4l added the kind/bug A reported bug. label May 30, 2024
@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. tech/engines Issue for tech Engines. domain/client labels May 30, 2024
@janpio janpio transferred this issue from prisma/prisma May 30, 2024
@janpio
Copy link
Contributor

janpio commented May 30, 2024

You can see in our CI that we are successfully using cargo build to build our engines. What problem do you want to report to us here? What action do you expect from us?

@zN3utr4l
Copy link
Author

I downloaded the zip of the 5.14.0 tag and performed the operations in the section https://github.com/prisma/prisma-engines/tree/5.14.0?tab=readme-ov-file#building-prisma-engines, which are mentioned in this comment:
prisma/prisma#1505 (comment).

I also tried to install and perform all the operations with root instead of with the basic user of the raspberry, but same error.

image

this is the operating system information:

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~ $ uname -m
armv7l
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.21-v7l+ #1642 SMP Mon Apr  3 17:22:30 BST 2023 armv7l GNU/Linux

@zN3utr4l
Copy link
Author

zN3utr4l commented May 31, 2024

I should have solved it by modifying the Dockerfile of this repository: https://github.com/pantharshit00/prisma-rpi-builds/tree/master.

Apparently the problem was the Raspberry, I don't know why but the build didn't go directly there.

  • Since I create the node_modules in windows and then move it to linux, with all these changes, what are the windows engines that can be eliminated to save some space?

  • Since the release folder weighs 1 GB, it is necessary to copy only these 3 files PRISMA_QUERY_ENGINE_BINARY, PRISMA_SCHEMA_ENGINE_BINARY, PRISMA_FMT_BINARY or do we need the whole folder?

docker build -t prisma-engines . && docker run -it prisma-engines
RUN
rustup target add armv7-unknown-linux-gnueabihf
cargo build --target armv7-unknown-linux-gnueabihf --release
docker cp <container_id>:/prisma-engines/target/armv7-unknown-linux-gnueabihf/release ./prisma-engines

# most steps taken from: https://stackoverflow.com/questions/60821697/how-to-build-openssl-for-arm-linux
FROM debian:latest  AS builder

ENV PATH=/root/.cargo/bin:$PATH

RUN apt-get update && apt-get -y install wget curl git make direnv build-essential clang libz-dev libsqlite3-dev openssl libssl-dev pkg-config gzip mingw-w64 g++ libmpc-dev libmpfr-dev libgmp-dev gcc-arm-linux-gnueabihf libc6-dev-armhf-cross g++-arm-linux-gnueabihf libmagic-dev

# cross compile OpenSSL
# latest version can be found here: https://www.openssl.org/source/
ENV OPENSSL_VERSION=openssl-3.3.0
RUN wget https://www.openssl.org/source/$OPENSSL_VERSION.tar.gz && tar zxf $OPENSSL_VERSION.tar.gz
RUN cd $OPENSSL_VERSION && ./Configure linux-armv4 --cross-compile-prefix=/usr/bin/arm-linux-gnueabihf- --prefix=/opt/openssl-arm --openssldir=/opt/openssl-arm -static && make install
# This env var configures rust-openssl to use the cross compiled version
ENV OPENSSL_DIR=/opt/openssl-arm

ENV ZLIB_VERSION=1.3.1
RUN cd /tmp && \
    curl -fLO "http://zlib.net/zlib-$ZLIB_VERSION.tar.gz" && \
    tar xzf "zlib-$ZLIB_VERSION.tar.gz" && cd "zlib-$ZLIB_VERSION" && \
    CHOST=arm CC=/usr/bin/arm-linux-gnueabihf-gcc \
    AR=/usr/bin/arm-linux-gnueabihf-ar RANLIB=/usr/bin/arm-linux-gnueabihf-ranlib \
    ./configure --static --prefix=/opt/zlib && \
    make && make install && \
    rm -r /tmp/*

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER="/linux-runner armv7"
ENV CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc
ENV CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
ENV QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
ENV LIBZ_SYS_STATIC=1

RUN echo 'eval "$(direnv hook bash)"' >> ~/.bashrc

# Clone prisma-engines repository and check out the specified tag
WORKDIR /prisma-engines
ENV PRISMA_ENGINES_TAG=5.14.0
RUN wget https://github.com/prisma/prisma-engines/archive/refs/tags/$PRISMA_ENGINES_TAG.tar.gz && \
  tar xzf $PRISMA_ENGINES_TAG.tar.gz --strip-components=1 && \
  direnv allow

@zN3utr4l
Copy link
Author

zN3utr4l commented Jun 3, 2024

Are these last 3 folders necessary?
deps takes up 870mb

image

@janpio janpio removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. tech/engines Issue for tech Engines. domain/client labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants