You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version of node-canvas (output of npm list canvas or yarn list canvas): canvas@2.8.0
Environment (node 16.8.0 on Mac OS X 11.4):
Explanation
On apple silicon, there is no prebuilt version available, so the install command attempt to build this library from source.
I have every dependency required (xcode-select install, and all brew libs or tools).
The first thing that I noticed is that has_lib.js is not searching on the correct folder.
On intel mac homebrew will install its files on /opt/local but on apple silicon the folder will be /opt/homebrew.
There's already a merged pull request that add the folder /opt/homebrew to the lists of folders has_lib is checking but the version of node-canvas available on npm does not yet include this modification. #1872
So I tried to use the library directly from github, but this time I still had problems with both libjpeg and giflib which weren't configured correctly (missing lib search path and include).
I'm not sure why this happened but looking at the binding.gyp file it seems that it's not configuring libjpeg and giflib.
So I tried to modify binding.gyp to include those two missing libs :
Unfortunately pkg-config was not able to locate giflib.
After looking more deeply, libjpeg does have a pkgconfig/libjpeg.pc file but giflib does not.
So I created a giflib.pc file inside /usr/local/lib/pkgconfig with the install path location of giflib on my system
After all that I can correctly build node-canvas from source and use it on macOS apple silicon.
I'll leave this here as a workaround in case somebody has the same problem.
But the thing is, I'm not sure why I had to do all this ?
Is there something wrong on my system configuration, or is there a problem with binding.pyc ?
How the build process is supposed to find libjpeg and giflib without the correct paths configured via binding.gyp ?
The text was updated successfully, but these errors were encountered:
Issue or Feature
Steps to Reproduce
Your Environment
npm list canvas
oryarn list canvas
): canvas@2.8.0Explanation
On apple silicon, there is no prebuilt version available, so the install command attempt to build this library from source.
I have every dependency required (xcode-select install, and all brew libs or tools).
The first thing that I noticed is that has_lib.js is not searching on the correct folder.
On intel mac homebrew will install its files on /opt/local but on apple silicon the folder will be /opt/homebrew.
There's already a merged pull request that add the folder /opt/homebrew to the lists of folders has_lib is checking but the version of node-canvas available on npm does not yet include this modification.
#1872
So I tried to use the library directly from github, but this time I still had problems with both libjpeg and giflib which weren't configured correctly (missing lib search path and include).
I'm not sure why this happened but looking at the binding.gyp file it seems that it's not configuring libjpeg and giflib.
So I tried to modify binding.gyp to include those two missing libs :
Unfortunately pkg-config was not able to locate giflib.
After looking more deeply, libjpeg does have a pkgconfig/libjpeg.pc file but giflib does not.
So I created a giflib.pc file inside /usr/local/lib/pkgconfig with the install path location of giflib on my system
After all that I can correctly build node-canvas from source and use it on macOS apple silicon.
I'll leave this here as a workaround in case somebody has the same problem.
But the thing is, I'm not sure why I had to do all this ?
Is there something wrong on my system configuration, or is there a problem with binding.pyc ?
How the build process is supposed to find libjpeg and giflib without the correct paths configured via binding.gyp ?
The text was updated successfully, but these errors were encountered: