I got some errors when linking open_ldap libraries:
I enter this:
gcc -W -Wall -O2 -c LDAP-Prova.c
gcc -W -Wall -O2 -lldap -llber -o ldapsearch-sync LDAP-Prova.o
LDAP-Prova.c:(.text.startup+0x679): undefined reference to "ldap_next_attribute"
LDAP-Prova.c:(.text.startup+0x685): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x6c2): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x6f2): undefined reference to "ldap_unbind_ext_s"
LDAP-Prova.c:(.text.startup+0x6fe): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x716): undefined reference to "ber_free"
LDAP-Prova.c:(.text.startup+0x72d): undefined reference to "ldap_next_entry"
LDAP-Prova.c:(.text.startup+0x73b): undefined reference to "ldap_memfree"
LDAP-Prova.c:(.text.startup+0x747): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x775): undefined reference to "ldap_start_tls_s"
LDAP-Prova.c:(.text.startup+0x78d): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x7a3): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x7b9): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x7cf): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x800): undefined reference to "ldap_get_option"
LDAP-Prova.c:(.text.startup+0x829): undefined reference to "ldap_memfree"
LDAP-Prova.c:(.text.startup+0x84f): undefined reference to "ldap_unbind_ext_s"
LDAP-Prova.c:(.text.startup+0x86d): undefined reference to "ldap_free_urldesc"
LDAP-Prova.c:(.text.startup+0x888): undefined reference to "ldap_msgfree"
LDAP-Prova.c:(.text.startup+0x896): undefined reference to "ldap_unbind_ext_s"
LDAP-Prova.c:(.text.startup+0x8dc): undefined reference to "ldap_sasl_bind_s"
LDAP-Prova.c:(.text.startup+0x8fd): undefined reference to "ldap_err2string"
LDAP-Prova.c:(.text.startup+0x920): undefined reference to "ldap_get_option"
LDAP-Prova.c:(.text.startup+0x938): undefined reference to "ldap_err2string"
collect2: error: ld returned 1 exit status
The .so is found because this gives the same issue
gcc -W -Wall -O2 -L/usr/local/lib/ -l:libldap.so -llber -o ldapsearch-sync LDAP-Prova.o
Also the libldap.so
file was made by manually compiling and installing openldap by:
$ ./configure --with-cyrus-sasl --with-tls
$ make depend
$ make
# make install
This is the code I'm trying to compile (only modified parameter is file name, due to ^C^V from the browser)
EDIT 10-4-2019 I don't think the suggested link is an answer, neither the question is the same as mine: I asked why some symbols weren't found, not why 'swapping' libs orders does work, simply because it was tryed and it didn't fixed the issue; also I didn't even told that was 'out of order' library call is about.