简体   繁体   中英

Installing ruby-ldap gem on windows (using ruby 2.1.6)

I have trouble installing ruby-ldap gem on windows (I have ruby 2.1.6 and have configured devkit to compile extensions) . I get the following error when I tried gem install it throws the following error

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

I tried installing as Administrator I tried adding wldap32.lib file in my win folder

Here is the full log to this issue Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing ruby-ldap: ERROR: Failed to build gem native extension.

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

Windows isn't officially supported with that gem, from the README

PORTS

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

Also, there is https://github.com/bearded/ruby-ldap/wiki/How-to-compile-ruby-ldap-on-Windows however I don't see that as working with the latest version, and here are some things that would need to be changed in order to support it.

  1. it uses lib , devkit uses link , so it would have to be changed to link /lib in extconf.rb, which is what is giving you the permission denied error.
  2. there is the loading time.h issue so each include for time.h would have to be changed to something like
#if HAVE_SYS_TIME_H && !defined(_WIN32)
#include 
#endif
  1. in extconf.rb should be something like have_header("sys/time.h") unless win32
  2. and last but not least conn.c:183: undefined reference to ldap_initialize' most likely because something isn't installed, I'm thinking ldap.h` (read ldap binary)

So, sorry but I think this is a no go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM