2015-06-21 56 views
1

我在windows上安裝ruby-ldap gem時遇到問題(我有ruby 2.1.6並且配置了devkit來編譯擴展)。我收到以下錯誤,當我試圖寶石安裝它引發以下錯誤在windows上安裝ruby-ldap gem(使用ruby 2.1.6)

extconf.rb:197:in ``': Permission denied - lib /def:./win/wldap32.def /out:./win/wldap32.lib (Errno: 
:EACCES) 

我嘗試安裝作爲管理員 我嘗試添加wldap32.lib文件中我贏文件夾

以下是完整日誌本問題 暫時增強PATH以包含DevKit ... 構建原生擴展。這可能需要一段時間... 錯誤:安裝ruby-ldap錯誤: 錯誤:無法構建gem本機擴展。沒有正式與寶石支持

C:/Ruby21/bin/ruby.exe extconf.rb 
*** 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=C:/Ruby21/bin/ruby 
     --with-netscape 
     --without-netscape 
     --without-netscape 
     --with-mozilla 
     --without-mozilla 
     --without-mozilla 
     --with-openldap1 
     --without-openldap1 
     --without-openldap1 
     --with-openldap2 
     --without-openldap2 
     --without-openldap2 
     --with-wldap32 
     --without-wldap32 
     --without-wldap32 
     --with-ldap-dir 
     --without-ldap-dir 
     --with-ldap-include 
     --without-ldap-include=${ldap-dir}/include 
     --with-ldap-lib 
     --without-ldap-lib=${ldap-dir}/lib 
     --with-ldap-dir 
     --without-ldap-dir 
     --without-ldap-dir 
     --with-ldap 
     --without-ldap 
     --without-ldap 
extconf.rb:197:in ``': Permission denied - lib /def:./win/wldap32.def /out:./win/wldap32.lib (Errno: 
:EACCES) 
     from extconf.rb:197:in `<main>' 
--with-wldap32 

extconf failed, exit code 1 

回答

1

Windows中,從README

PORTS 

    * FreeBSD ("Akinori -Aki- MUSHA" <[email protected]>) 
    * Debian (Akira Yamada <[email protected]>) 
------------------------------------------------------------------------------- 

此外,還有https://github.com/bearded/ruby-ldap/wiki/How-to-compile-ruby-ldap-on-Windows但我不認爲這是與最新版本的工作,這裏有一些爲了支持它而需要改變的東西。

  1. 它使用lib,使用的devkit link,所以它會在extconf.rb,這是什麼給你的權限被拒絕錯誤改爲link /lib
  2. 有裝載time.h問題,所以每個包括用於time.h中必須被改變爲類似
 
#if HAVE_SYS_TIME_H && !defined(_WIN32) 
#include 
#endif 
  • 在extconf.rb應該是這樣的have_header("sys/time.h") unless win32
  • 和最後但並非最不重要conn.c:183: undefined reference to ldap_initialize」 most likely because something isn't installed, I'm thinking ldap.h`(讀LDAP二進制)
  • 所以,對不起,但我認爲這是不行的。