NixOS Ruby 开发 - 安装所有需要的 devkit 库和标头以构建本机扩展

NixOS Ruby 开发 - 安装所有需要的 devkit 库和标头以构建本机扩展

我是一名 Ruby 开发人员,非常喜欢 NixOS。我只需要知道如何设置依赖关系来构建对 FFI 和 Nokogiri 等 gem 的本机依赖关系。

目前我收到此错误: The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.

更多信息

$ cat /home/my_user/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.23/mkmf.log
"pkg-config --exists libffi"
package configuration for libffi is not found
"gcc -o conftest -I/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/include/ruby-2.3.0/x86_64-linux -I/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/include/ruby-2.3.0/ruby/backward -I/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/include/ruby-2.3.0 -I.     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wno-maybe-uninitialized  -fPIC conftest.c  -L. -L/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/lib -Wl,-rpath,/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/lib -L/nix/store/7qn1bgkxn615pqcxi8da72x379ywcf71-ruby-2.3.5/lib -lruby  -lpthread -ldl -lcrypt -lm   -lc"
/nix/store/3iggy4d1wdwivs4kx9ic90npiwxvnrr8-binutils-2.27/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/3iggy4d1wdwivs4kx9ic90npiwxvnrr8-binutils-2.27/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

我得到这个错误之后$ nix-env -i libffi

答案1

我这样做了并且成功了

$ nix-env -e gcc && nix-env -i clang

相关内容