eilvelia / tdl

Node.js bindings to TDLib 🥒
MIT License
403 stars 53 forks source link

tdl-tdlib-addon failed to build #94

Closed quetzalsly closed 3 years ago

quetzalsly commented 3 years ago

Several issues encountered on win7 node 15.1.0 npm 7.0.8 TDL version 7.0.0.beta1 and addon version 0.8.0.

  1. npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: test@1.0.0
    npm ERR! Found: tdl@7.0.0-beta.1
    npm ERR! node_modules/tdl
    npm ERR!   tdl@"7.0.0-beta.1" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer tdl@">= 6.0.0" from tdl-tdlib-addon@0.8.0
    npm ERR! node_modules/tdl-tdlib-addon
    npm ERR!   tdl-tdlib-addon@"0.8.0" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

--force lets it install but does not build anything.

2.

cd node_modules
cd tdl-tdlib-addon
npm run install

gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@15.1.0 | win32 | x64
gyp info find Python using Python version 3.7.1 found at "C:\python3x\python.exe
"
gyp info find VS using VS2017 (15.9.28307.718) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\python3x\python.exe
gyp info spawn args [
gyp info spawn args   'E:\\Node\\node_modules\\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   'E:\\test\\test\\node_modules\\tdl-tdlib-addon\\build\\c
onfig.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\Node\\node_modules\\npm\\node_modules\\node-gyp\\addo
n.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\dev\\AppData\\Local\\node-gyp\\Cache\\15.1.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:\\Users\\dev\\AppData\\Local\\node-gy
p\\Cache\\15.1.0',
gyp info spawn args   '-Dnode_gyp_dir=E:\\Node\\node_modules\\npm\\node_modules\
\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\dev\\\\AppData\\\\Local\
\\\node-gyp\\\\Cache\\\\15.1.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=E:\\test\\test\\node_modules\\tdl-tdl
ib-addon',
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   'E:\\test\\test\\node_modules\\tdl-tdlib-addon\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Warning: Missing input files:
E:\test\test\node_modules\tdl-tdlib-addon\build\..\win32-dlfcn.cpp
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MS
Build\15.0\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.
  nothing.vcxproj -> E:\test\test\node_modules\tdl-tdlib-addon\build\Release\
  \nothing.lib
  td.cpp
e:\test\test\node_modules\tdl-tdlib-addon\td.cpp(4): fatal error C1083: Canno
t open include file: 'win32-dlfcn.h': No such file or directory [E:\test\test
\node_modules\tdl-tdlib-addon\build\td.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enter
prise\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\Node\node_modules\npm\node_modules
\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:327:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_p
rocess:277:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "E:\\Node\\node.exe" "E:\\Node\\node_modules\\npm\\node_modules
\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\test\test\node_modules\tdl-tdlib-addon
gyp ERR! node -v v15.1.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok

So the result is ofcourse Error: Cannot f ind module '../build/Release/td.node'

Right now going back to ffi I dont even know the difference between ffi and addon but addon just is not usable for me.

eilvelia commented 3 years ago

Speaking of the first issue, npm doesn't include -beta.x versions in >= ... ranges, so it's unfortunately required to use --legacy-peer-deps (or --force) on npm v7 to install beta versions. npm v6 shows a warning, not an error, by default. tdl-tdlib-ffi should have the same issue here.

About the second issue, it looks like I forgot to add Windows-only files to the files field in package.json, sorry. I just released tdl-tdlib-addon@0.8.2 that fixes this.