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

Build fails if jpeg library not found on Windows 10 x64 #1593

Closed
Sakari369 opened this issue May 25, 2020 · 4 comments
Closed

Build fails if jpeg library not found on Windows 10 x64 #1593

Sakari369 opened this issue May 25, 2020 · 4 comments

Comments

@Sakari369
Copy link
Contributor

Issue or Feature

Trying to build node-canvas 2.6.1 on Windows 10 x64 fails if the (optional) jpeg library and headers are not installed.

Steps to Reproduce

Install all the other Windows build pre-requisites, but don't install the libjpeg-turbo as mentioned in the wiki.

Trying to build manually to see the errors (inside the node_modules/canvas):

node-gyp configure
node-gyp build

Results in the following output:

C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas (windows) (canvas@2.6.1)
λ node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.16.3 | win32 | x64
gyp info find Python using Python version 3.8.2 found at "C:\Python38\python.exe"
gyp info find VS using VS2019 (16.6.30114.105) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python38\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\sakari\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\sakari\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\sakari\\AppData\\Local\\node-gyp\\Cache\\12.16.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\sakari\\AppData\\Local\\node-gyp\\Cache\\12.16.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\sakari\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\sakari\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.16.3\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas',
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   'C:\\Users\\sakari\\dvl\\omg-standalone\\electron\\node_modules\\canvas\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok

C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas (windows) (canvas@2.6.1)
λ node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.16.3 | win32 | x64
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  PdfBackend.cc
  SvgBackend.cc
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\src\closure.h(6,10): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\PdfBackend.cc) [C:\Users\sakari\d vl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\src\closure.h(6,10): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\SvgBackend.cc) [C:\Users\sakari\d vl\omg-standalone\electron\node_modules\canvas\build\canvas.vcxproj]
  Backends.cc
  Canvas.cc
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\src\closure.h(6,10): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Backends.cc) [C:\Users\sakari\dvl\omg-sta ndalone\electron\node_modules\canvas\build\canvas.vcxproj]
  closure.cc
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\src\closure.h(6,10): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Canvas.cc) [C:\Users\sakari\dvl\omg-stand alone\electron\node_modules\canvas\build\canvas.vcxproj]
C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas\src\closure.h(6,10): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\closure.cc) [C:\Users\sakari\dvl\omg-stan dalone\electron\node_modules\canvas\build\canvas.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\sakari\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sakari\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Users\sakari\dvl\omg-standalone\electron\node_modules\canvas
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

Building with the jpeg libraries in place, results in compiled node. But the JPEG -library is still missing MSVCR100.dll, so the module does not load properly. Would probably be good to mention that MSVCR100.dll is also required by the jpeg support, will test out if just adding this dll in the lib library will help with this.

Your Environment

  • node-canvas 2.6.1
  • node v12.16.3 on Windows 10 x64 latest update.
  • msvc2019 community edition
@Sakari369
Copy link
Contributor Author

Allright seems the code was missing some #ifdef HAVE_JPEGs in the code.
Fixed by adding. I've attached a patch with the missing #ifdefs which will allow to compile without JPEG support.

canvas_jpeg_def.patch.zip

@zbjornson
Copy link
Collaborator

Nice, feel like opening a PR with that patch?

@Sakari369
Copy link
Contributor Author

Nice, feel like opening a PR with that patch?

Thanks. Sure, can do.

@Sakari369
Copy link
Contributor Author

Created pr: #1594

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