【问题标题】:Installing ruby-ldap gem on windows (using ruby 2.1.6)在 Windows 上安装 ruby​​-ldap gem(使用 ruby​​ 2.1.6)
【发布时间】:2015-06-21 18:35:26
【问题描述】:

我在 Windows 上安装 ruby​​-ldap gem 时遇到问题(我有 ruby​​ 2.1.6 并且配置了 devkit 来编译扩展)。当我尝试 gem install 时出现以下错误,它会引发以下错误

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

我尝试以管理员身份安装 我尝试在我的 win 文件夹中添加 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

【问题讨论】:

    标签: ruby windows ldap


    【解决方案1】:

    该 gem 并未正式支持 Windows,来自自述文件

    PORTS
    
      * FreeBSD ("Akinori -Aki- MUSHA" <knu@idaemons.org>)
      * Debian (Akira Yamada <akira@ruby-lang.org>)
    -------------------------------------------------------------------------------
    

    此外,还有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) #包括 #万一
    1. 在 extconf.rb 中应该类似于 have_header("sys/time.h") unless win32
    2. 最后但同样重要的是conn.c:183: undefined reference toldap_initialize'most likely because something isn't installed, I'm thinkingldap.h`(读取 ldap 二进制文件)

    所以,很抱歉,但我认为这是不行的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-01
      • 2016-06-10
      • 2021-11-13
      • 2010-12-29
      • 2015-08-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多