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

Support Windows #17

Open
justinkambic opened this issue Feb 18, 2021 · 2 comments
Open

Support Windows #17

justinkambic opened this issue Feb 18, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@justinkambic
Copy link
Owner

It's generally known that Windows is the most difficult platform to debug for node-gyp. I've spent considerable amounts of time trying to configure multiple versions of MSBuild to get a working build for Windows. My desire is to support Windows, Linux, and macOS, but at this point it has been consuming too much of my time to pursue this any further, and I don't have access to an easily-cleaned build machine like I do for macOS, and I use Docker when supporting Ubuntu.

It's possible to build libraw.js for Windows if you build/install LibRaw and are able create a viable native node executable on Windows 10. I've gotten to the point where node-gyp reports a successful build, but opening the output file with Dependency Walker shows a number of Windows libs are missing, and libraw.dll is also absent when it's required. Below is the segment of the node-gyp binding.

['OS=="win"', {
  "msvs_settings": {
    "VCCLCompilerTool": {
      "AdditionalOptions": ["/EHsc"]
      }
    },
    "dll_files" : [
      r'{...path}\LibRaw-0.19.5-Win64\LibRaw-0.19.5\bin\libraw.dll'
    ],
    "libraries": [
      r"{...path}\LibRaw-0.19.5-Win64\LibRaw-0.19.5\lib\libraw.lib"
    ],
    "defines": ["NAPI_CPP_EXCEPTIONS"],
    "include_dirs": [
      r"{...path}\LibRaw-0.19.5-Win64\LibRaw-0.19.5",
      r"{...path}\LibRaw-0.19.5-Win64\LibRaw-0.19.5\bin"
    ]
}]

I also had difficulty building LibRaw on Windows. I attempted doing this with the Windows instructions, MingW, and Cygwin; all of them ended up erroring out when running make. This is probably a result of issues in my native environment.

To resolve this issue, I'd love if we could create a GitHub Action similar to the CI process that configures a Windows build pipeline, and can successfully run the tests. If you're experienced with C++ builds and running node-gyp successfully on Windows I'd love your input here.

@justinkambic justinkambic added the help wanted Extra attention is needed label Feb 18, 2021
@labsforge
Copy link

labsforge commented Jan 20, 2023

Hi @justinkambic,

I think I hit the same wall.. instead of setting the path to the binaries, I had set libraw as a git submodule, node-gyp builds ok but running prebuildify says at the end Could not find build

prebuildify log:

$ prebuildify --napi --target=15.14.0 --debug
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.7.7 found at "C:\Users\AppData\Local\Programs\Python\Python37-32\python.exe"
gyp info find VS using VS2022 (17.4.33213.308) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\AppData\Local\Programs\Python\Python37-32\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\AppData\\Roaming\\nvm\\v15.14.0\\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:\\libraw.js\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\AppData\\Roaming\\nvm\\v15.14.0\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Temp\\prebuildify\\node\\15.14.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=C:\\Temp\\prebuildify\\node\\15.14.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\AppData\\Roaming\\nvm\\v15.14.0\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Temp\\\\prebuildify\\\\node\\\\15.14.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\libraw.js',
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:\\libraw.js\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn←[0m C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m [
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m   'build/binding.sln',
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m   '/clp:Verbosity=minimal',
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m   '/nologo',
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m   '/p:Configuration=Debug;Platform=x64'
←[0m←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mspawn args←[0m ]
←[0mBuilding the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  index.cpp
  libraw_wrapper.cpp
  wraptypes.cpp
  win_delay_load_hook.cc
  node_libraw_binding.vcxproj -> C:\libraw.js\build\Debug\\node_libraw_binding.lib
  dcraw_common.cpp
C:\libraw.js\vendor\LibRaw\src\utils\utils_dcraw.cpp(159,40): warning C4305: 'initializing': truncation from 'double' to 'const float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\tables\colordata.cpp(1752,59): warning C4305: 'initializing': truncation from 'double' to 'const float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\decoders_dcraw.cpp(217,3): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\decoders_dcraw.cpp(785,37): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\decoders_dcraw.cpp(786,37): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\kodak_decoders.cpp(93,19): warning C4804: '<=': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\smal.cpp(37,17): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\smal.cpp(93,13): warning C4018: '>=': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\cr3_parser.cpp(301,9): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\canon.cpp(593,35): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\fuji.cpp(579,41): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\fuji.cpp(654,33): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\fuji.cpp(1140,31): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\pentax.cpp(433,33): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\pentax.cpp(436,33): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\tiff.cpp(987,61): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\tiff.cpp(1843,48): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\ciff.cpp(164,15): warning C4018: '>=': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\ciff.cpp(272,39): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\ciff.cpp(327,55): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\ciff.cpp(335,39): warning C4018: '<': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(1121,27): warning C4804: '>>': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2018,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2019,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2020,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2027,22): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2028,22): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2029,22): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2812,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2813,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\identify.cpp(2814,23): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\misc_parsers.cpp(74,3): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\metadata\misc_parsers.cpp(105,3): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\postprocessing\postprocessing_aux.cpp(40,63): warning C4305: 'initializing': truncation from 'double' to 'const float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\postprocessing\postprocessing_aux.cpp(280,69): warning C4305: 'initializing': truncation from 'double' to 'const float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\postprocessing\postprocessing_aux.cpp(283,69): warning C4305: 'initializing': truncation from 'double' to 'const float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\xtrans_demosaic.cpp(65,23): warning C4804: '<<': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
  dcraw_fileio.cpp
  demosaic_packs.cpp
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(747,15): warning C4305: '/=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(748,15): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(854,15): warning C4305: '/=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(855,15): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(928,17): warning C4305: '/=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(929,17): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(930,17): warning C4305: '/=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\demosaic\dht_demosaic.cpp(931,17): warning C4305: '*=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
  libraw_cxx.cpp
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(350,25): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(459,18): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(579,32): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(641,36): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(655,34): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(746,27): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(760,27): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(833,20): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(847,20): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(873,28): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(925,28): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(941,26): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\crx.cpp(1088,9): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\decoders_libraw.cpp(508,3): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(193,56): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(205,60): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(219,58): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(234,54): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(265,40): warning C4018: '>': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\decoders\unpack.cpp(361,32): warning C4101: 'ee': unreferenced local variable [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\utils\init_close_utils.cpp(82,76): warning C4305: '=': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\utils\open.cpp(221,38): warning C4018: '>=': signed/unsigned mismatch [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\utils\open.cpp(991,32): warning C4101: 'ee': unreferenced local variable [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\utils\phaseone_processing.cpp(98,28): warning C4101: 'err': unreferenced local variable [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\utils\thumb_utils.cpp(120,78): warning C4305: 'initializing': truncation from 'double' to 'float' [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\preprocessing\raw2image.cpp(103,29): warning C4804: '<<': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\preprocessing\raw2image.cpp(213,33): warning C4804: '<<': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\preprocessing\raw2image.cpp(383,30): warning C4804: '>>': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
C:\libraw.js\vendor\LibRaw\src\preprocessing\raw2image.cpp(423,26): warning C4804: '>>': unsafe use of type 'bool' in operation [C:\libraw.js\build\vendor\libraw.vcxproj]
  libraw_datastream.cpp
C:\libraw.js\vendor\LibRaw\src\libraw_datastream.cpp(659,3): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\libraw.js\build\vendor\libraw.vcxproj]
  libraw_c_api.cpp
C:\libraw.js\vendor\LibRaw\src\libraw_c_api.cpp(34,5): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\libraw.js\build\vendor\libraw.vcxproj]
  win_delay_load_hook.cc
  libraw.vcxproj -> C:\libraw.js\build\Debug\\libraw.lib
←[37;40mgyp←[0m ←[0m←[32minfo←[0m ←[0m←[35mok←[0m 
←[0mCould not find build

Was this you were getting?
image

@justinkambic
Copy link
Owner Author

Hi @labsforge - sorry for the ultra-late response here. Did you ever get this to work ok? To be honest, it has been literal years since I tried to get libraw.js to work cleanly on Windows and I still don't have access to a reliable Windows dev environment.

If you or anyone else is able to configure libraw.js in a manner that works, I'd be super excited to accept a PR that generates the binary properly so I can build it and include it in the next release. My open source time is extremely constrained these days, so it's not something I am likely to add on my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants