# Compile Error: ldap.c:424: error: â€˜LDAP\_OP T\_X\_TLS\_PROTOCOLâ€™ undeclared (first use in this fun

**URL:** <https://www.ruby-forum.com/t/compile-error-ldap-c-error-a-ldap-op-t-x-tls-protocola-undeclared-first-use-in-this-fun/169381>\
**Category:** Ruby\
**Created:** [June 3, 2009, 3:54am UTC](https://www.ruby-forum.com/t/compile-error-ldap-c-error-a-ldap-op-t-x-tls-protocola-undeclared-first-use-in-this-fun/169381 "2009-06-03T03:54:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 3, 2009, 3:54am UTC](https://www.ruby-forum.com/t/compile-error-ldap-c-error-a-ldap-op-t-x-tls-protocola-undeclared-first-use-in-this-fun/169381/1 "2009-06-03T03:54:23Z")

</div>

root@leopard:~/libldap-ruby-0.9.7# make  
gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-linux -I. -DUSE\_OPENLDAP2  
-DUSE\_OPENLDAP -DLDAP\_DEPRECATED -D\_REENTRANT -DHAVE\_LDAP\_H  
-DHAVE\_LBER\_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\_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 -D\_FILE\_OFFSET\_BITS=64 -fPIC -g  
-O2 -c  
ldap.c  
ldap.c: In function ‘Init\_ldap’:  
ldap.c:424: error: ‘LDAP\_OPT\_X\_TLS\_PROTOCOL’ undeclared (first use in  
this function)  
ldap.c:424: error: (Each undeclared identifier is reported only once  
ldap.c:424: error: for each function it appears in.)  
make: \*\*\* [ldap.o] Error 1  
root@leopard:~/libldap-ruby-0.9.7#  
----snip----  
I followed the directions in the README under ‘BUILDING’. I was able to  
get the  
extconf.rb to run after doing apt-get install libldap2-dev. I had  
already  
successfully built and installed ruby and openssl from source on this  
Ubuntu  
Server: root@leopard:~# uname -a  
Linux leopard 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC  
2009 i686  
GNU/Linux  
openssl appears to be working, and is installed in the appropriate spot.  
This  
is probably just an omission I am not guessing. Can someone see  
something  
obvious? If not I’ll file a bug tomorrow.

Perhaps this is not a roadblock, but it appears to be a real bug if it  
cannot  
compile. I see not reference to the symbol LOAD\_OPT\_X\_TLS\_PROTOCOL in  
the  
directory tree.

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 3, 2009, 4:03am UTC](https://www.ruby-forum.com/t/compile-error-ldap-c-error-a-ldap-op-t-x-tls-protocola-undeclared-first-use-in-this-fun/169381/2 "2009-06-03T04:03:44Z")

</div>

Xeno C. wrote:

> -O2 -c ldap.c  
> had already successfully built and installed ruby and openssl from  
> source on this Ubuntu Server: root@leopard:~# uname -a  
> Linux leopard 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC  
> 2009 i686 GNU/Linux  
> openssl appears to be working, and is installed in the appropriate  
> spot. This is probably just an omission I am not guessing. Can someone  
> see something obvious? If not I’ll file a bug tomorrow.
> 
> Perhaps this is not a roadblock, but it appears to be a real bug if it  
> cannot compile. I see not reference to the symbol  
> Sorry. I should have said LDAP\_OPT\_X\_TLS\_PROTOCOL does not exist in the  
> tree  
> except in conn.c and ldap.c.

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 3, 2009, 11:02am UTC](https://www.ruby-forum.com/t/compile-error-ldap-c-error-a-ldap-op-t-x-tls-protocola-undeclared-first-use-in-this-fun/169381/3 "2009-06-03T11:02:31Z")

</div>

This is standard C debugging, so I don’t think it really belongs on a  
Ruby list any more.

$ find /usr/include -type f | xargs grep LDAP\_OPT\_X\_TLS\_PROTOCOL  
/usr/include/ldap.h:/\* #define LDAP\_OPT\_X\_TLS\_PROTOCOL 0x6007 \*/

So the constant exists in the openldap headers, but is commented out for  
some reason. A note earlier in the file says this is an openldap private  
option.

As to why ruby-ldap uses this option, but openldap doesn’t provide it:  
well, that’s something to do with the ruby-ldap library. If you look at  
the patches which the Ubuntu package applies to make it build, you’ll  
probably find what they do to fix it.
