wlh320 / rime-ls

A language server for Rime input method engine 通过 LSP 代码补全使用 Rime 输入法
BSD 3-Clause "New" or "Revised" License
208 stars 13 forks source link

MacOS 的编译和运行遇到缺少库时的解决方案 #24

Closed evpeople closed 6 months ago

evpeople commented 6 months ago

将下载好的librime放到相应位置后

export LIBRIME_LIB_DIR= /usr/local/lib
export LIBRIME_INCLUDE_DIR= /usr/local/include
cargo build --release

之后运行会遇到

dyld[46557]: Library not loaded: @rpath/librime.1.dylib
  Referenced from: <1378A569-3C10-3E64-9374-B718D98D94AB> /Users/evpeople/code/rust/rime-ls/target/release/rime_ls
  Reason: no LC_RPATH's found

此时要做的是

export DYLD_LIBRARY_PATH=/usr/local/lib  # 最好放在.zshrc中

此时可以运行了,但是会因权限报错,这时就是去系统设置解决权限问题了

rainzm commented 6 months ago

install_name_tool -add_rpath /path/to/lib MyExecutable 为 rime 的可执行文件添加 lib 目录

evpeople commented 6 months ago

install_name_tool -add_rpath /path/to/lib MyExecutable 为 rime 的可执行文件添加 lib 目录

这个也能解决不能运行的问题