Ruby 执行gem时。。。[“extconf.rb”,…]不是文件
我正试图围绕C扩展构建一个RubyGem。C扩展使用Ruby 执行gem时。。。[“extconf.rb”,…]不是文件,ruby,rubygems,rake,Ruby,Rubygems,Rake,我正试图围绕C扩展构建一个RubyGem。C扩展使用rubyextconf.rb进行良好编译;制作sudomakeinstall例程,但当我尝试使用rake构建gem时,进程终止,并在跟踪的底部出现错误 我正在使用具有相同目录结构的post来创建gem 我的配置有什么问题?我的gempec和Rakefile位于跟踪下方(gem称为netconf) //痕迹 ** Execute copy:netconf:i686-linux:1.9.2 install -c tmp/i686-linux/net
rubyextconf.rb进行良好编译;制作sudomakeinstall
例程,但当我尝试使用rake构建gem时,进程终止,并在跟踪的底部出现错误
我正在使用具有相同目录结构的post来创建gem
我的配置有什么问题?我的gempec和Rakefile位于跟踪下方(gem称为netconf)
//痕迹
** Execute copy:netconf:i686-linux:1.9.2
install -c tmp/i686-linux/netconf/1.9.2/netconf.so lib/netconf/netconf.so
** Execute compile:netconf:i686-linux
** Execute compile:i686-linux
** Execute compile
** Invoke chmod (first_time)
** Execute chmod
** Execute build
rake aborted!
ERROR: While executing gem ... (Gem::InvalidSpecificationException)
["extconf.rb", "netconf.o", "netconf.so"] are not files
//netconf.gempec
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "netconf/version"
Gem::Specification.new do |s|
s.name = "netconf"
s.version = Netconf::VERSION
s.authors = ["..."]
s.email = ["..."]
s.homepage = "..."
s.summary = %q{A tool to access and write Ubuntu network configuration}
s.description = %q{Uses ifconfig and other C system calls to access network configurations on a Ubuntu install.}
s.rubyforge_project = "netconf"
s.files = `git ls-files`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.extensions = ["ext/netconf/extconf.rb"]
end
//耙子
require 'rake'
require 'rake/extensiontask'
require 'bundler'
Rake::ExtensionTask.new("netconf") do |extension|
extension.lib_dir = "lib/netconf"
end
task :chmod do
File.chmod(0775, 'lib/netconf/netconf.so')
end
task :build => [:clean, :compile, :chmod]
Bundler::GemHelper.install_tasks
我犯了这个错误,因为我还没有用git提交我的更新
s.files = `git ls-files`.split("\n")
该行直接使用git,可能导致此错误。照办
git add .
git commit -a -m "init"
FWIW,我有一个类似的问题
s.files = `git ls-files`.split("\n")
是
,其中单引号阻止文件列表正确拆分。改为双引号为我解决了这个问题 可能是相关的我看到了那个问题;不过谢谢你的提醒。我正在使用rake编译器,但是我还没有找到关于这个特定错误的任何信息(而且我非常确定我需要/想要一个本机C扩展,因为我的目标是一个嵌入式平台)。谢谢你分享这个,你帮我省了很多麻烦。将文件暂存(不一定提交是我所需要的全部^ u^)
s.files = `git ls-files`.split('\n')