rvm安装ruby 2.6.4失败,出现makefile错误:函数“ffi_prep_closure”的隐式声明在c99中无效

lvjbypge  于 2021-09-29  发布在  Java
关注(0)|答案(1)|浏览(457)

rvm rvm 1.29.12-next
m1芯片上的mac os big sur rvm install 2.6.4 在以下情况下失败:

Error running '__rvm_make -j8',
please read /Users/jason/.rvm/log/1626110300_ruby-2.6.4/make.log

There has been an error while running make. Halting the installation.

生成文件错误为:

error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);
xoshrz7s

xoshrz7s1#

这是由于外壳中未设置rvm的环境标志造成的。 brew info libffi 将告诉您所需的变量:
要让编译器查找libffi,您可能需要设置:export-ldflags=“-l/opt/homebrew/opt/libffi/lib”export-cppflags=“-i/opt/homebrew/opt/libffi/include”
要让pkg config找到libffi,您可能需要设置:export pkg_config_path=“/opt/homebrew/opt/libffi/lib/pkgconfig”
对于zsh,编辑 ~/.zshenv 并加上:

export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

关闭并重新打开终端窗口或 source ~/.zshrc 加载您的更改
检查你的工作

% echo $LDFLAGS
-L/opt/homebrew/opt/libffi/lib
% echo $CPPFLAGS
-I/opt/homebrew/opt/libffi/include
% echo $PKG_CONFIG_PATH
/opt/homebrew/opt/libffi/lib/pkgconfig

(确认环境变量正确无误)
重新尝试安装要安装的rvm版本。

相关问题