레이블이 cargo인 게시물을 표시합니다. 모든 게시물 표시
레이블이 cargo인 게시물을 표시합니다. 모든 게시물 표시

rust incompatible architecture error

# 맥 m1 에서 cargo 로 coreaudio-sys 를 사용하는 패키지들을 설치시 컴파일에서 다음과 아키텍쳐 에러가 발생했다.
cargo install scope-tui termusic termusic-server
... 생략 ...
error: failed to run custom build command for `coreaudio-sys v0.2.17`
... 생략 ...
 '/opt/homebrew/Cellar/llvm/20.1.7/lib/libclang.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')

# brew 설치한 rustc 외 cargo bin에 rustc 가 있고 이걸 우선 사용하게 되어 있었고
which -a rustc
/Users/ysoftman/.cargo/bin/rustc
/opt/homebrew/bin/rustc

# 다음과 같이 확인해 보니 rustc 가 x86_64 기준으로 설치되어 있었다.
~/.cargo/bin/rustc -vV
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-apple-darwin
release: 1.88.0
LLVM version: 20.1.5

# ~/.cargo 의 rust 를 삭제하자.(~/.cargo 를 모두 삭제하게 된다.)
rustup self uninstall

# rust 를 새로 설치하자.(~/.cargo 등의 경로가 생성된다.)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# 이제 다시 확인해보면 aarch64(arm64) 로 보이고 문제가 됐던 툴도 제대로 컴파일/설치 된다.
~/.cargo/bin/rustc -vV
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: aarch64-apple-darwin
release: 1.88.0
LLVM version: 20.1.5

rust unstable library error

# wsl 환경에서 cargo 로 bat 설치(빌드)시 
cargo install bat

# 다음과 같은 에러가 발생한다.
error[E0658]: use of unstable library feature 'is_terminal'
/home/ysoftman/.cargo/registry/src/github.com-1ecc6299db9ec823/grep-cli-0.1.8/src/lib.rs:238:23
std::io::stderr().is_terminal()

# rust 버전은 다음과 같다.
rustc --version
rustc 1.66.1 (90743e729 2023-01-10) (built from a source tarball)

# 메시지의 링크를 보면 이슈가 있다.

# unstable 상태가 에러가 아니라면 계속 진행하는 옵션을 줘도 실패한다.
cargo install -Z unstable-option --keep-going bat

# mac 에선 cargo 로 bat 설치시 똑같은 grep-cli v0.1.8 버전을 사용해 빌드하는데 잘된다.
# mac 에 설치된 grep-cli library 버전
cargo search grep-cli
grep-cli = "0.1.8"    # Utilities for search oriented command line applications.

# rustup 을 설치해서 rustc/cargo 버전을 올려보자.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# cargo 가 제대로 동작하지 않는다면 다음과 같이 삭제 후 재설치한다.
rustup uninstall stable && rustup install stable

# 최신 버전 확인
cargo --version
cargo 1.71.0 (cfd3bbd8f 2023-06-08)

# 이제 빌드 에러 없이 설치된다.
cargo install bat

vscode rust language server 문제

# vscode 에서 RLS(rust language server) 플러그인을 사용한다.
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust

# 그런데 상태 바에 RLS starting 계속 진행중이되면서
# formatting, completion 등이 동작하지 않는다.
# 원인은 cargo 로 생성한 여러 프로젝트들을 하나의 vsocde 에서 열게 되서 발생한것이다.
# 현재는 RLS 가 동작하려면 vscode 의 최상위(root)위치에 cargo.toml 이 있어야 한다.
# 해당 이슈는 현재 수정 중으로 좀더 있으면 개선 될것 같다.
https://github.com/rust-lang/rls-vscode/pull/601

# 참고로 단순히 하나의 프로젝트만 vscode 로 열면 잘 동작한다.
# 그리고 이때 RLS 설치가 되면 다시 멀티 프로젝트를 열었을때
# 빌드 등은 안되지만 formatting, completion 등은 작동한다.

Prev