gem install jekyll 遇到 ffi.h 错误, 求 解决方法。。。 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
feather12315
V2EX    Ruby

gem install jekyll 遇到 ffi.h 错误, 求 解决方法。。。

  •  1
     
  •   feather12315 2015-11-11 16:57:23 +08:00 5562 次点击
    这是一个创建于 3687 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用了 Docker 环境, Dockerfile 大意是这 :


    FROM ruby:slim
    RUN gem install jekyll
    ...

    错误提示是这样的:

    root@64f3ff50c38:/# gem install jekyll Fetching: liquid-3.0.6.gem (100%) Successfully installed liquid-3.0.6 Fetching: kramdown-1.9.0.gem (100%) Successfully installed kramdown-1.9.0 Fetching: mercenary-0.3.5.gem (100%) Successfully installed mercenary-0.3.5 Fetching: safe_yaml-1.0.4.gem (100%) Successfully installed safe_yaml-1.0.4 Fetching: colorator-0.1.gem (100%) Successfully installed colorator-0.1 Fetching: rouge-1.10.1.gem (100%) Successfully installed rouge-1.10.1 Fetching: sass-3.4.19.gem (100%) Successfully installed sass-3.4.19 Fetching: jekyll-sass-converter-1.3.0.gem (100%) Successfully installed jekyll-sass-converter-1.3.0 Fetching: rb-fsevent-0.9.6.gem (100%) Successfully installed rb-fsevent-0.9.6 Fetching: ffi-1.9.10.gem (100%) Building native extensions. This could take a while... ERROR: Error installing jekyll: ERROR: Failed to build gem native extension. current directory: /usr/local/bundle/gems/ffi-1.9.10/ext/ffi_c /usr/local/bin/ruby -r ./siteconf20151111-5-1ydpmrp.rb extconf.rb checking for ffi.h... *** 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 --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /usr/local/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp' from /usr/local/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header' from /usr/local/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for' from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:in `open' from /usr/local/lib/ruby/2.2.0/mkmf.rb:347:in `postpone' from /usr/local/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for' from /usr/local/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header' from extconf.rb:16:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /usr/local/bundle/extensions/x86_64-linux/2.2.0-static/ffi-1.9.10/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /usr/local/bundle/gems/ffi-1.9.10 for inspection. Results logged to /usr/local/bundle/extensions/x86_64-linux/2.2.0-static/ffi-1.9.10/gem_make.out 
    root@64f63ff50c38:/# apt-get install libffi-dev Reading package lists... Done Building dependency tree Reading state information... Done libffi-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. 

    求帮助。。。

    2 条回复    2016-02-29 21:17:05 +08:00
    feather12315
        1
    feather12315  
    OP
       2015-11-11 23:10:33 +08:00 via Android
    好吧,我自己填坑。。
    用 ruby:latest 安装 jekyll 成功,分析了下 ruby:slim 与 ruby:latest 的 dockerfile 配置,发现是少了 build-essential ,安装上再 gem install jekyll 就可以了
    pynix
        2
    pynix  
       2016-02-29 21:17:05 +08:00
    我觉得错误信息里面已经很明显能看出问题了。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3143 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 11:29 PVG 19:29 LAX 03:29 JFK 06:29
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86