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

V13: relay-compiler not running in CI #3725

Closed
reckter opened this issue Jan 7, 2022 · 7 comments
Closed

V13: relay-compiler not running in CI #3725

reckter opened this issue Jan 7, 2022 · 7 comments
Labels
help wanted rust Related to the compiler written in Rust

Comments

@reckter
Copy link

reckter commented Jan 7, 2022

I cannot get relay-compiler to run successfully in our CI environment.
It runs fine on my (Apple silicon) Mac, but running yarn relay in our CI fails with the following message:

Using Yarn PnP, with relay-compiler being unplugged:

$ yarn relay
node:events:368
      throw er; // Unhandled 'error' event
      ^
Error: spawn /builds/2ig-copernicus/copernicus-frontend/.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /builds/2ig-copernicus/copernicus-frontend/.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay',
  path: '/builds/2ig-copernicus/copernicus-frontend/.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay',
  spawnargs: [  ]
}

I've checked the folder, and the file is indeed there, but for some reason it refuses to run:

$ ls  ./.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64
relay
$ chmod +x ./.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64
$ ./.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay
/bin/sh: eval: line 147: ./.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay: not found

Even using npx relay-compiler it doesn't work:

$ npx relay-compiler
npm WARN exec The following package was not found and will be installed: relay-compiler
node:events:368
      throw er; // Unhandled 'error' event
      ^
Error: spawn /root/.npm/_npx/e508777759744f19/node_modules/relay-compiler/linux-x64/relay ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /root/.npm/_npx/e508777759744f19/node_modules/relay-compiler/linux-x64/relay',
  path: '/root/.npm/_npx/e508777759744f19/node_modules/relay-compiler/linux-x64/relay',
  spawnargs: []
}

AFAIK the CI running machine is a G5a instance on AWS.

$ uname -a
Linux runner-q3nct6-project-29845990-concurrent-0 5.11.0-1022-aws #23~20.04.1-Ubuntu SMP Mon Nov 15 14:03:19 UTC 2021 x86_64 Linux

If you have any idea, what we could try to get this solved / debug better, I am very open to all suggestions!
Thanks in advance for any help, I hope It's ok to post this here, ran out of options to try sadly.

@alunyov
Copy link
Contributor

alunyov commented Jan 7, 2022

Hmm, this is very strange... I'm not an expert in CI/Linux.
It is possible that there is some configuration in our build that is not fully correct.

Currently, we're compiling using this target: https://github.com/facebook/relay/blob/main/.github/workflows/ci.yml#L84
Maybe for these machines, it needs to be something else.

Additionally, maybe there are some configuration/security settings in these machines the prevent the execution of these binaries (but unlikely).

@reckter
Copy link
Author

reckter commented Jan 7, 2022

Going down the rabit whole:
using ldd, it seems like it's missing /lib64/ld-linux-x86-64.so.2, which according to my googling, means no glibc in installed. (because alpine uses musl and these are all alpine images).

Installing gcompat at least changes the error message:

Error relocating /app/.yarn/unplugged/relay-compiler-npm-13.0.0-51a3d4ad15/node_modules/relay-compiler/linux-x64/relay: __res_init: symbol not found

@reckter
Copy link
Author

reckter commented Jan 7, 2022

I've got it to work in the alpine Dockerfile with :

# from https://github.com/TobiasDeBruijn/SkinFixer-API/blame/aeda56fd5a227d5ab5de32754b1137a0bf67a686/Dockerfile
ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
ENV GLIBC_VERSION=2.30-r0
RUN set -ex && \
    apk --update add libstdc++ curl ca-certificates && \
    for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \
        do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
    apk add --allow-untrusted /tmp/*.apk && \
    rm -v /tmp/*.apk && \
    /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib

But it feels weird for sure.
I am unsure if this is a thing that relay can fix easily (maybe there is a different compile target, that makes this much easier?).
Another workaround is not using alpine based images (or well rather just using images that are using glibc), but seing how big alpine is in the docker-image space this seems non-ideal as well.

Maybe this https://users.rust-lang.org/t/building-executable-for-alpine-linux/13568 could work? I have no idea what other things that might brake though.

@alunyov alunyov added help wanted rust Related to the compiler written in Rust labels Jan 7, 2022
@alunyov
Copy link
Contributor

alunyov commented Jan 7, 2022

Thanks for looking into this!

@alunyov
Copy link
Contributor

alunyov commented Jan 19, 2022

Hey @reckter the fix by @ch1ffa just landed and available on NPM as relay-compiler@main. Can you verify if it fixes the issue for you?

Thank you!

@MikeSha
Copy link

MikeSha commented Jan 24, 2022

Seems to be relay-compiler@main is fine

@reckter
Copy link
Author

reckter commented Jan 24, 2022

relay-compilar@main fixed it, without any more workarounds 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted rust Related to the compiler written in Rust
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants