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

Enhancement: provide prebuilt binaries for linux-riscv64 #223

Open
dimitarangelkov opened this issue Mar 13, 2024 · 5 comments
Open

Enhancement: provide prebuilt binaries for linux-riscv64 #223

dimitarangelkov opened this issue Mar 13, 2024 · 5 comments

Comments

@dimitarangelkov
Copy link

dimitarangelkov commented Mar 13, 2024

Any chance to get RiscV64 build? I am looking to build sharp for RiscV64 and the lack of riscv64 support in sharp-libvips is blocking me.

@lovell
Copy link
Owner

lovell commented Mar 13, 2024

RISC-V support is definitely something I'd like to offer.

Please can you explain your comment about "skia-canvas" as I don't understand its relevance to this repo.

@dimitarangelkov
Copy link
Author

dimitarangelkov commented Mar 13, 2024

here is the error I am getting while executing sharp's --build-from-source on a qemu riscV64 vm with linux Ubuntu

ubuntu@qemu:~/sharp-node/sharp$ npm install --build-from-source

> [email protected] install
> node install/check

sharp: Detected --build-from-source flag
sharp: Attempting to build from source via node-gyp
sharp: Found node-addon-api
sharp: Found node-gyp version 10.0.1
sharp: See https://sharp.pixelplumbing.com/install#building-from-source
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | riscv64
gyp info chdir src
gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"

gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/ubuntu/sharp-node/sharp/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/ubuntu/sharp-node/sharp/src/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/ubuntu/sharp-node/sharp/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/ubuntu/.cache/node-gyp/20.8.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/ubuntu/.cache/node-gyp/20.8.0',
gyp info spawn args '-Dnode_gyp_dir=/home/ubuntu/sharp-node/sharp/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/ubuntu/.cache/node-gyp/20.8.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/ubuntu/sharp-node/sharp/src',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/ubuntu/sharp-node/sharp/src/build'
  CC(target) Release/obj.target/nothing/../node_modules/node-addon-api/nothing.o
rm -f Release/obj.target/../node_modules/node-addon-api/nothing.a Release/obj.target/../node_modules/node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../node_modules/node-addon-api/nothing.a`
ar crs Release/obj.target/../node_modules/node-addon-api/nothing.a @Release/obj.target/../node_modules/node-addon-api/nothing.a.ar-file-list
  COPY Release/nothing.a
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp-linux-riscv64/common.o
In file included from /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/glib/galloca.h:34,
                 from /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/glib.h:32,
                 from /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/gobject/gbinding.h:30,
                 from /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/glib-object.h:24,
                 from /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/vips/vips8:35,
                 from ../common.cc:13:
/home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/glib/gtypes.h:34:10: fatal error: glibconfig.h: No such file or directory
   34 | #include <glibconfig.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [sharp-linux-riscv64.target.mk:142: Release/obj.target/sharp-linux-riscv64/common.o] Error 1
make: Leaving directory '/home/ubuntu/sharp-node/sharp/src/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/home/ubuntu/sharp-node/sharp/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 6.5.0-25-generic
gyp ERR! command "/usr/local/lib/node/nodejs/bin/node" "/home/ubuntu/sharp-node/sharp/node_modules/.bin/node-gyp" "rebuild" "--directory=src"
gyp ERR! cwd /home/ubuntu/sharp-node/sharp/src
gyp ERR! node -v v20.8.0
gyp ERR! node-gyp -v v10.0.1
gyp ERR! not ok
npm ERR! code 1
npm ERR! path /home/ubuntu/sharp-node/sharp
npm ERR! command failed
npm ERR! command sh -c node install/check

Looks like /home/ubuntu/sharp-node/sharp/node_modules/@img/sharp-libvips-dev/include/glib-2.0/glib/gtypes.h:34:10: fatal error: glibconfig.h: No such file or directory is failing the build.

@lovell
Copy link
Owner

lovell commented Mar 13, 2024

I don't see anything in this comment about skia or canvas, could their mention in your first comment have been a mistake?

To use sharp on platforms where prebuilt binaries are not provided, you'll need to ensure a globally-installed libvips is made available, and in this case you'll probably need to compile from source.

https://sharp.pixelplumbing.com/install#custom-libvips
https://www.libvips.org/install.html#building-libvips-from-source
https://github.com/libvips/libvips#optional-dependencies

@dimitarangelkov
Copy link
Author

Oh, yes sorry it was mistake. I am evaluating both skia-canvas and sharp on RiscV64 and typed the wrong one. I'll play with the libvips and will see if my issue with the sharp build will go away. Thank you for your prompt replies!

@lovell lovell changed the title RiscV64 build? Enhancement: provide prebuilt binaries for linux-riscv64 Mar 13, 2024
@dimitarangelkov
Copy link
Author

@lovell just to let you know that building libvips in the riscv machine did the job. Now I have sharp running beautifully with nodejs on RiscV64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants