xingrz / node-cp2102n

Cross-platform Node.js binding for controlling GPIOs on Silicon Labs CP2102N
MIT License
0 stars 0 forks source link

Can't build missing libusb #1

Open adminy opened 4 months ago

adminy commented 4 months ago
23:54:56 ~ λ nix-shell --extra-experimental-features flakes -p cmake libusb    
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

[nix-shell:~]# npm install --save cp2102n
npm ERR! code 1
npm ERR! path /root/node_modules/cp2102n
npm ERR! command failed
npm ERR! command sh -c node scripts/check-prebuild.cjs || npm run build:addon
npm ERR! > cp2102n@0.3.0 build:addon
npm ERR! > cmake-js compile
npm ERR! 
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is GNU 13.2.0
npm ERR! -- The CXX compiler identification is GNU 13.2.0
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/gcc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/g++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
npm ERR! -- Checking for one of the modules 'libusb-1.0'
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is GNU 13.2.0
npm ERR! -- The CXX compiler identification is GNU 13.2.0
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/gcc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/g++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
npm ERR! -- Checking for one of the modules 'libusb-1.0'
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! info TOOL Using Unix Makefiles generator.
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/root/node_modules/cp2102n',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Unix Makefiles',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=7.3.0',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/node_modules/cp2102n/build/Release',
npm ERR! info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
npm ERR! info RUN   '-DCMAKE_JS_INC=/root/node_modules/node-api-headers/include;/root/node_modules/node-addon-api',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=20.11.1',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_JS_LIB=',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-DBUILDING_NODE_EXTENSION'
npm ERR! info RUN ]
npm ERR! CMake Error at /nix/store/5ibhga0ync2yg1brk1hzlki71bq2dvb4-cmake-3.28.3/share/cmake-3.28/Modules/FindPkgConfig.cmake:906 (message):
npm ERR!   None of the required 'libusb-1.0' found
npm ERR! Call Stack (most recent call first):
npm ERR!   addon/libcp2102_usb/CMakeLists.txt:24 (pkg_search_module)
npm ERR! 
npm ERR! 
npm ERR! info REP Build has been failed, trying to do a full rebuild.
npm ERR! info CMD CLEAN
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '-E',
npm ERR! info RUN   'remove_directory',
npm ERR! info RUN   '/root/node_modules/cp2102n/build'
npm ERR! info RUN ]
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/root/node_modules/cp2102n',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Unix Makefiles',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=7.3.0',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/node_modules/cp2102n/build/Release',
npm ERR! info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
npm ERR! info RUN   '-DCMAKE_JS_INC=/root/node_modules/node-api-headers/include;/root/node_modules/node-addon-api',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=20.11.1',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_JS_LIB=',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-DBUILDING_NODE_EXTENSION'
npm ERR! info RUN ]
npm ERR! CMake Error at /nix/store/5ibhga0ync2yg1brk1hzlki71bq2dvb4-cmake-3.28.3/share/cmake-3.28/Modules/FindPkgConfig.cmake:906 (message):
npm ERR!   None of the required 'libusb-1.0' found
npm ERR! Call Stack (most recent call first):
npm ERR!   addon/libcp2102_usb/CMakeLists.txt:24 (pkg_search_module)
npm ERR! 
npm ERR! 
npm ERR! ERR! OMG Process terminated: 1

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-19T23_55_10_395Z-debug-0.log

[nix-shell:~]# 
xingrz commented 4 months ago

What's the OS you're using? I haven't seen nix-shell before.

Maybe you can try manually point PKG_CONFIG_PATH to the path where libusb-1.0.pc is actually located. You can use pkg-config to check if it finds the path to libusb properly.

$ PKG_CONFIG_PATH=/usr/local/opt/libusb/lib/pkgconfig pkg-config --libs libusb-1.0
-L/usr/local/Cellar/libusb/1.0.27/lib -lusb-1.0
adminy commented 4 months ago

okay, I did that,

18:44:52 ~/homebridge λ nix-shell --extra-experimental-features flakes -p libusb cmake
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

[nix-shell:~/homebridge]# export PKG_CONFIG_PATH=/nix/store/pn87mzcqsmmb50vffq21wnvqdj685hmk-libusb-1.0.27-dev/lib/pkgconfig

[nix-shell:~/homebridge]# npm install --save cp2102nnpm ERR! code 1
npm ERR! path /root/homebridge/node_modules/cp2102n
npm ERR! command failed
npm ERR! command sh -c node scripts/check-prebuild.cjs || npm run build:addon
npm ERR! > cp2102n@0.3.0 build:addon
npm ERR! > cmake-js compile
npm ERR! 
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is GNU 13.2.0
npm ERR! -- The CXX compiler identification is GNU 13.2.0
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/gcc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/g++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
npm ERR! -- Checking for one of the modules 'libusb-1.0'
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is GNU 13.2.0
npm ERR! -- The CXX compiler identification is GNU 13.2.0
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/gcc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /nix/store/49nb1m1ysq0vx31qp94alpmi6ccsq9l3-gcc-wrapper-13.2.0/bin/g++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
npm ERR! -- Checking for one of the modules 'libusb-1.0'
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! info TOOL Using Unix Makefiles generator.
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/root/homebridge/node_modules/cp2102n',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Unix Makefiles',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=7.3.0',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/homebridge/node_modules/cp2102n/build/Release',
npm ERR! info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
npm ERR! info RUN   '-DCMAKE_JS_INC=/root/homebridge/node_modules/node-api-headers/include;/root/homebridge/node_modules/node-addon-api',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=20.11.1',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_JS_LIB=',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-DBUILDING_NODE_EXTENSION'
npm ERR! info RUN ]
npm ERR! CMake Error at /nix/store/5ibhga0ync2yg1brk1hzlki71bq2dvb4-cmake-3.28.3/share/cmake-3.28/Modules/FindPkgConfig.cmake:906 (message):
npm ERR!   None of the required 'libusb-1.0' found
npm ERR! Call Stack (most recent call first):
npm ERR!   addon/libcp2102_usb/CMakeLists.txt:24 (pkg_search_module)
npm ERR! 
npm ERR! 
npm ERR! info REP Build has been failed, trying to do a full rebuild.
npm ERR! info CMD CLEAN
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '-E',
npm ERR! info RUN   'remove_directory',
npm ERR! info RUN   '/root/homebridge/node_modules/cp2102n/build'
npm ERR! info RUN ]
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/root/homebridge/node_modules/cp2102n',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Unix Makefiles',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=7.3.0',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/homebridge/node_modules/cp2102n/build/Release',
npm ERR! info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
npm ERR! info RUN   '-DCMAKE_JS_INC=/root/homebridge/node_modules/node-api-headers/include;/root/homebridge/node_modules/node-addon-api',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=20.11.1',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_JS_LIB=',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-DBUILDING_NODE_EXTENSION'
npm ERR! info RUN ]
npm ERR! CMake Error at /nix/store/5ibhga0ync2yg1brk1hzlki71bq2dvb4-cmake-3.28.3/share/cmake-3.28/Modules/FindPkgConfig.cmake:906 (message):
npm ERR!   None of the required 'libusb-1.0' found
npm ERR! Call Stack (most recent call first):
npm ERR!   addon/libcp2102_usb/CMakeLists.txt:24 (pkg_search_module)
npm ERR! 
npm ERR! 
npm ERR! ERR! OMG Process terminated: 1

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-20T18_45_06_935Z-debug-0.log

[nix-shell:~/homebridge]# ls $PKG_CONFIG_PATH 
libusb-1.0.pc
adminy commented 4 months ago

is there any other variables or paths that it assumes exist?

xingrz commented 4 months ago

What's the output of this command in your environment?

$ PKG_CONFIG_PATH=/usr/local/opt/libusb/lib/pkgconfig pkg-config --libs libusb-1.0