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

Compile Canvas on Apple Silicon Mac using custom library paths and without installling using homebrew #2406

Open
1 task done
SZTankWang opened this issue Jul 17, 2024 · 7 comments

Comments

@SZTankWang
Copy link

SZTankWang commented Jul 17, 2024

Issue or Feature

I'm currently on Mac M1, and am using node canvas for development. The issue is that once other people tries to run my project on other Apple M1 computer, they cannot run the project if they don't have the prerequisite libraries installed (
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python-setuptools). Although this can be solved by installing those libraries first, is there a way to make node canvas compile on Apple M1 computer without using homebrew, so that my users won't need to worry about using homebrew?

An ideal solution would be to include those libraries somewhere in my own node project, but how do I make canvas use custom dependency path when compiling?

Your Environment

  • Version of node-canvas 2.11.2
  • Environment (e.g. node 20.12.2 on macOS 14.2.1):
  • Mac Apple Silicon
@mn4367
Copy link

mn4367 commented Jul 19, 2024

...is there a way to make node canvas compile on Apple M1 computer without using homebrew, so that my users won't need to worry about using homebrew?

Probably not, but work is currently underway to provide standalone Canvas modules for Apple Silicon, please see this issue: #2354.

Currently you'd have to build an Apple Silicon version of canvas containing all the dylibs and ship the module as part of your product. More details about this procedure can be found in the mentioned issue.

@SZTankWang
Copy link
Author

Hi @mn4367, I read your comments in #2354, do you still have a prebuilt M1 version currently, I would love to try it on my computer to see if it works.

Probably not, but work is currently underway to provide standalone Canvas modules for Apple Silicon, please see this issue: #2354.

Currently you'd have to build an Apple Silicon version of canvas containing all the dylibs and ship the module as part of your product. More details about this procedure can be found in the mentioned issue.

@mn4367
Copy link

mn4367 commented Jul 21, 2024

This was built and signed as described in #2036 on a MacBook Air M1 on Sonoma 14.5. Please drop me a note after downloading so that I can delete the Zip from Dropbox.

@SZTankWang
Copy link
Author

@mn4367 thanks a lot, downloaded.

@mn4367
Copy link

mn4367 commented Jul 21, 2024

@SZTankWang, does it work?

@SZTankWang
Copy link
Author

@mn4367 right now mac still prompts security warning, and I have to do sudo spctl --master-disable to make the library loads successful. After that everything works well
`

@mn4367
Copy link

mn4367 commented Jul 22, 2024

I assume you downloaded the Zip with a browser, right? In this case the OS sets a quarantine attribute on the file (and probably all of its content after unpacking). sudo spctl --master-disable is perhaps a bit drastic since it works globally and permanently (as far as I know), instead it should be sufficient to just use xattr -dr com.apple.quarantine <file>. Also the security warning shouldn't appear if the file was downloaded with curl or something similar.

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

2 participants