如何在ubuntu上安装rfuse?

时间:2014-08-17 23:56:43

标签: ruby fuse

已解决 - 见下文。

我正在尝试在ubuntu 12.04 vagrant图像上安装rfuse gem。在它的extconf中,它会检查保险丝并失败。

我已安装apt-get fusefuse-utils/lib/libfuse.so.2已存在。我尝试了下面的会议,其中:

  1. 复制失败
  2. 使用nm验证库中是否存在主函数(我不知道这是否有效。)
  3. 尝试确保使用LD_LIBRARY_PATH找到库(不确定这是否有效)
  4. 我现在被困住,因为我不确定这是怎么失败的。是不是找到了图书馆?如果是,是否找不到合适的功能?它在哪里寻找图书馆?我还有哪些其他技术可以调试它?

    vagrant@n1:~$ ruby2.1 -rmkmf -e 'have_library("fuse")'
    checking for main() in -lfuse... no
    vagrant@n1:~$ nm -D -C -g /lib/libfuse.so.2 | grep main
    0000000000016080 T cuse_lowlevel_main
    0000000000016570 T fuse_main
    0000000000016840 T fuse_main
    0000000000016860 T fuse_main_compat1
    0000000000016840 T fuse_main_compat2
    0000000000016880 T fuse_main_real
    0000000000016890 T fuse_main_real
    0000000000016830 T fuse_main_real
    0000000000016880 T fuse_main_real_compat22
    0000000000016830 T fuse_main_real_compat25
    vagrant@n1:~$ env LD_LIBRARY_PATH=/lib ruby2.1 -rmkmf -e 'have_library("fuse")'
    checking for main() in -lfuse... no
    
    vagrant@n1:~$ uname -a
    Linux n1 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    vagrant@n1:~$ file /lib/libfuse.so.2.8.6
    /lib/libfuse.so.2.8.6: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xdb7e3872302adb18b73703be89224938e5575441, stripped
    vagrant@n1:~$ file $(which ruby2.1)
    /usr/bin/ruby2.1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x9a5173cfb87a0bdb27026d7913fcff5729652848, stripped
    

    这是一个Vagrantfile,用于设置我正在测试的机器:

    $script = <<SCRIPT
    
    sudo apt-get update
    sudo apt-get install python-software-properties -y
    sudo apt-add-repository ppa:brightbox/ruby-ng -y
    sudo apt-get update
    sudo apt-get install ruby2.1 ruby2.1-dev fuse fuse-utils -y
    
    SCRIPT
    
    # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    VAGRANTFILE_API_VERSION = "2"
    
    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
      config.vm.box = "hashicorp/precise64"
    
      config.vm.provision "shell", inline: $script
    
      config.vm.define "n1" do |n1|
          n1.vm.hostname = "n1"
          n1.vm.network "private_network", ip: "172.20.20.10"
      end
    end
    

    调用have_library(或任何mkmf代码)会在工作目录中留下mkmf.log。看着那个,我看到了以下失败:

    "gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.1.0 -I/usr/include/ruby-2.1.0/ruby/backward -I/usr/include/ruby-2.1.0 -I. -D_FORTIFY_SOURCE=2   -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC conftest.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby2.1-2.1.2/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby-2.1 -lfuse  -lpthread -lrt -lgmp -ldl -lcrypt -lm   -lc"
    /usr/bin/ld: cannot find -lfuse
    collect2: ld returned 1 exit status
    checked program was:
    /* begin */
     1: #include "ruby.h"
     2:
     3: /*top*/
     4: extern int t(void);
     5: int main(int argc, char **argv)
     6: {
     7:   if (argc > 1000000) {
     8:     printf("%p", &t);
     9:   }
    10:
    11:   return 0;
    12: }
    13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
    /* end */
    

    我尝试ld -lfuse --verbose并且能够获得有关失败的更多详细信息,包括它在寻找库的位置:

    attempt to open /lib/libfuse.so failed
    attempt to open /lib/libfuse.a failed
    

    这些都不存在!我不知道为什么不这样做,但我尝试将其sudo ln -s /lib/libfuse.so.2 /lib/libfuse.sold进行符号链接。

    继续安装gem,我也错过了两个库:sudo apt-get install -y libfuse-dev make。通过这些添加,我可以安装和使用gem。

1 个答案:

答案 0 :(得分:2)

您的mkmf调用应在当前目录中生成mkmf.log。在它应该是它如何调用gcc的细节,以及究竟什么不起作用。您可以提取这些命令并继续向下钻取。