在linux中uuid4r gem安装出错

问题描述 投票:0回答:3

我收到了这个错误

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-opt-include=/usr/local/opt/ossp-uuid/include --with-opt-lib=/home/kiwitech/Documents/ossp-uuid
checking for uuid_export() in -luuid... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include=${opt-dir}/include
    --with-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
    --with-uuidlib
    --without-uuidlib
OSSP uuid library 'uuid' required -- not found.

extconf failed, exit code 1

Gem files will remain installed in /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/gems/uuid4r-0.2.0 for inspection.
Results logged to /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/uuid4r-0.2.0/gem_make.out

请有人帮助我

ruby rubygems
3个回答
1
投票

您需要安装libossp-uuid并且它是dev头文件。

可能是这样的:

sudo apt-get install libossp-uuid-dev

然后gem安装。

你确定你还需要使用那颗宝石吗?在ruby 1.9+中,标准库中已有模块SecureRandom,它提供了UUID以及许多纯粹的红宝石宝石,如uuidtoolsuuid。如果你需要解析UUID,那就是ruby-uuid


0
投票

如果您正在运行OS X Yosemite,请执行以下操作:

宝石安装uuid

brew安装ossp-uuid

(你需要安装brew。如果你没有,你可以从这里得到它:http://brew.sh


0
投票

如果您使用的是rvm,请检查您的会话状态是否正确。如果您经常使用cdreset您的终端,或者您的环境变量被破坏,您最终可能会尝试使用系统Ruby。重置与rvm相关的东西的一种快速方法就是在项目目录中执行cd .

$ cd .
$ gem install uuid
© www.soinside.com 2019 - 2024. All rights reserved.