개발여행

Solana)spl-token-cli 설치 도중 오류: failed to run custom build command for `hidapi v1.2.6` 본문

BlockChain

Solana)spl-token-cli 설치 도중 오류: failed to run custom build command for `hidapi v1.2.6`

Titan. 2021. 9. 2. 14:51

최근 솔라나로 토큰 발행을 하기 위해 공부하고 있다.

그런데 공식문서를 따라 패키지를 설치하던 중에 오류가 발생해 도중에 멈춰버리게 됐다.

 

https://spl.solana.com/token

 

Token Program | Solana Program Library Docs

A Token program on the Solana blockchain.

spl.solana.com

 

위 공식 문서 설명을 따라 cargo install spl-token-cli 명령어 실행 후 필요한 패키들이 설치되다가 다음과 같은 오류가 발생했다.

 

error: failed to run custom build command for `hidapi v1.2.6`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installS4MlZq/release/build/hidapi-80acac78f3bc998f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBUDEV_STATIC
  cargo:rerun-if-env-changed=LIBUDEV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'Unable to find libudev: Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"libudev\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package libudev was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libudev.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'libudev' found\n" } }', /home/titan/.cargo/registry/src/github.com-1ecc6299db9ec823/hidapi-1.2.6/build.rs:53:54
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `spl-token-cli v2.0.14`, intermediate artifacts can be found at `/tmp/cargo-installS4MlZq`

Caused by:
  build failed

 

spl-token-cli에 필요한 모듈들이 자동으로 설치가 되는데, 필수 모듈이 리스트에 있지 않아 도중에 에러가 발생하는 것이다.

 

다음처럼 필요한 모듈들을 설치해 주면 해결된다.

 

$ sudo apt install libudev-dev
$ cargo install solana-foundation-delegation-program-cli

 

ubuntu 20.04 버전을 사용중인 경우 한가지 패키지를 더 설치해주어야 한다.

 

apt install build-essential libudev-dev pkg-config libssl-dev -y