bearded / ruby-ldap

Ruby/LDAP is an extension library for Ruby. It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape SDK and Active Directory). The common API for application development is described in RFC1823 and is supported by Ruby/LDAP.
http://rubyforge.org/projects/ruby-ldap/
Other
66 stars 35 forks source link

Build fails when using rvm in mixed mode with user gemsets. #27

Open john-halderman opened 10 years ago

john-halderman commented 10 years ago

When I try to install the ruby-ldap gem into a user gemset using rvm (mixed mode) I get the following build error. I am on Ubuntu 12.10, rvm 1.24.7, ruby 1.8.7-p370, ruby gems 1.8.2. It is worth noting that installing to the system gemset works.

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-ldap:
        ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.8.7-p370/bin/ruby extconf.rb
--with-openldap2
checking for ldap.h... yes
checking for lber.h... yes
checking for ldap_ssl.h... no
checking for openssl/ssl.h... yes
checking for openssl/crypto.h... yes
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for main() in -lnsl... yes
checking for main() in -lpthread... yes
checking for main() in -lresolv... yes
checking for main() in -llber... yes
checking for main() in -lldap_r... yes
checking for main() in -lldap... yes
checking for ldap_init() in ldap.h... yes
checking for ldap_set_option()... yes
checking for ldap_get_option()... yes
checking for ldap_start_tls_s()... yes
checking for ldap_memfree()... yes
checking for ldap_perror()... yes
checking for ldap_sort_entries()... yes
checking for ldapssl_init()... no
checking for ldap_sslinit()... no
checking for ldap_sasl_bind_s()... yes
checking for ldap_rename_s()... yes
checking for ldap_compare_s()... yes
checking for ldap_add_ext_s()... yes
checking for ldap_compare_ext_s()... yes
checking for ldap_delete_ext_s()... yes
checking for ldap_modify_ext_s()... yes
checking for ldap_search_ext_s()... yes
checking for ldap_unbind_ext_s()... yes
checking for ldap_sasl_interactive_bind_s()... yes
creating Makefile

make
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c saslconn.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c entry.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c clientauth.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c ldap.c
In file included from ldap.c:7:0:
ldap.c: In function ‘Init_ldap’:
ldap.c:391:73: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define rb_ldap_define_opt(code) rb_define_const(rb_mLDAP,#code,INT2NUM((int)code))
                                                                         ^
/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux/ruby.h:147:32: note: in definition of macro ‘INT2NUM’
 #define INT2NUM(v) rb_int2inum(v)
                                ^
ldap.c:393:3: note: in expansion of macro ‘rb_ldap_define_opt’
   rb_ldap_define_opt (LDAP_OPT_ON);
   ^
ldap.c:391:73: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define rb_ldap_define_opt(code) rb_define_const(rb_mLDAP,#code,INT2NUM((int)code))
                                                                         ^
/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux/ruby.h:147:32: note: in definition of macro ‘INT2NUM’
 #define INT2NUM(v) rb_int2inum(v)
                                ^
ldap.c:396:3: note: in expansion of macro ‘rb_ldap_define_opt’
   rb_ldap_define_opt (LDAP_OPT_OFF);
   ^
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c sslconn.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c conn.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c mod.c
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/x86_64-linux -I. -DUSE_OPENLDAP2 -DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT -DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S -DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES -DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_RENAME_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S -DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S -DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S -DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187    -fPIC -O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c misc.c
gcc -shared -o ldap.so saslconn.o entry.o clientauth.o ldap.o sslconn.o conn.o mod.o misc.o -L. -L/usr/local/rvm/rubies/ruby-1.8.7-p370/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.8.7-p370/lib -L.  -rdynamic -Wl,-export-dynamic    -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.8.7-p370/lib -L/usr/local/rvm/rubies/ruby-1.8.7-p370/lib -lruby -lldap -lldap_r -llber -lresolv -lpthread -lnsl -lssl -lcrypto  -lrt -ldl -lcrypt -lm   -lc -pthread

make install
/usr/bin/install -c -m 0755 ldap.so /home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16/lib
/usr/bin/install -c -m 644 ./lib/ldap/schema.rb /home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16/lib/ldap
/usr/bin/install: ‘./lib/ldap/schema.rb’ and ‘/home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16/lib/ldap/schema.rb’ are the same file
make: *** [/home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16/lib/ldap/schema.rb] Error 1

Gem files will remain installed in /home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16 for inspection.
Results logged to /home/museum/museum+jhalderm/.rvm/gems/ruby-1.8.7-p370/gems/ruby-ldap-0.9.16/./gem_make.out

Any help is greatly appreciated.

Thanks, John

bearded commented 10 years ago

I cannot reproduce this problem.

Could you please give more info about user and rvm configuration?

Here is a list of commands, which I executed to try reproduce your problem:

# Installed Ubuntu 12.10 x64
#
# - executed as root:
apt-get update && apt-get dist-upgrade
apt-get install slapd libldap2-dev libsasl2-dev
groupadd test1
useradd -m -s /bin/bash --home /home/test1 -g test1 test1
echo '%test1 ALL=(ALL) NOPASSWD: ALL' >> '/etc/sudoers'
su - test1

# - executed as user:
\curl -sSL https://get.rvm.io | sudo bash -s stable
sudo usermod -a -G rvm test1
logout

# - executed as root:
su - test1

# - executed as user:
rvm install 1.8.7-p370 # FYI: p374 is latest
gem install ruby-ldap

# result:
Fetching: ruby-ldap-0.9.16.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ruby-ldap-0.9.16
Installing ri documentation for ruby-ldap-0.9.16
/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/usr/local/rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block
Done installing documentation for ruby-ldap after 0 seconds
1 gem installed