getsentry / profiling-node

The code for this repo now lives in https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node
MIT License
29 stars 10 forks source link

fix: use gnu aarch compiler for arm64 binary #172

Closed bohdanw2 closed 1 year ago

bohdanw2 commented 1 year ago

Despite having BUILD_ARCH=arm64 npm run build:bindings:arm64 step for arm64 precompiled binary final artifact is still of x86-64 format:

Apple silicon (docker):

yarn add @sentry/profiling-node --ignore-scripts

file node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node
node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=df0bbf4844a088ba62b7f53a722cbc646a697a15, not stripped

ldd node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node
        not a dynamic executable

This PR enforces node-gyp to cross compile binaries using already installed gnu compiler.

file node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node
node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=82e0cca86e11898652576d0a0f7df1a94e11147b, not stripped

ldd node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node
linux-vdso.so.1 (0x0000ffffa6eb2000)
        libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffffa6c30000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffa6c00000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffa6a50000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa6e75000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffa69b0000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffa6970000)
bohdanw2 commented 1 year ago

This will most likely fix https://github.com/getsentry/profiling-node/issues/168

JonasBa commented 1 year ago

Thanks for the contribution @bohdanw2, we'll release this today