Android App Development include LDAP on MAC OS X
-
My error is:
:-1: error: error: cannot find -lldap
I think there is mistake in the .pro file:
The Filestructure is:
- *.pro - lib - compiled - OpenLDAP - lib - include - * - other files
in the lib directory are these files:
liblber-2-devel.so.0 libldap.la liblber-2-devel.so.0.0.0 libldap.so liblber.a libldap_r-2-devel.so.0 liblber.la libldap_r-2-devel.so.0.0.0 liblber.so libldap_r.a libldap-2-devel.so.0 libldap_r.la libldap-2-devel.so.0.0.0 libldap_r.so libldap.a
-
@mkmp29 said in Android App Development include LDAP on MAC OS X:
-L lib/compiled/OpenLDAP/lib -lldap
There should be no space between '-L' and your library search path.
-
@mkmp29 said in Android App Development include LDAP on MAC OS X:
INCLUDEPATH += lib/compiled/OpenLDAP/include
LIBS += -L lib/compiled/OpenLDAP/lib -lldap
ANDROID_EXTRA_LIBS += lib/compiled/OpenLDAP/lib/libldap.soDidn't work either. I just get the message for multiple lib function:
ldapAuth.o:ldapAuth.cpp:function LDAPAuth::~LDAPAuth(): error: undefined reference to 'ldap_unbind' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::~LDAPAuth(): error: undefined reference to 'ldap_unbind' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::checkStatus(QString const&, int): error: undefined reference to 'ldap_err2string' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::checkStatus(QString const&, int): error: undefined reference to 'ldap_err2string' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_initialize' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_initialize' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_set_option' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_set_option' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_start_tls_s' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_start_tls_s' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::init(): error: undefined reference to 'ldap_simple_bind_s' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_search_ext_s' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_first_entry' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_get_dn' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_first_attribute' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_get_values' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_next_attribute' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_memfree' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_next_entry' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_msgfree' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::search(QString const&): error: undefined reference to 'ldap_msgfree' ldapAuth.o:ldapAuth.cpp:function LDAPAuth::authentificate(QString const&, QString const&): error: undefined reference to 'ldap_simple_bind_s' collect2: error: ld returned 1 exit status
Looks like the library is compiled wrong ?
-
Hi,
Did you check the x86 vs x86_64 architecture for your library ?
-
No there's not.
The only alternative is to check whether your targets already have them available in their root filesystem and re-use them.
-
I can compile the application and push it to the virtual device. But i get the error:
W System.err: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "liblber-2-devel.so.0" not found
This file is contained in the lib folder of my cross compiled library. I read a little bit and tried to load the library during runtime with the QT Object: QLibrary and the function load. But it didnt work.
this is the part of my .pro file
ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap.so ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/liblber.so ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap_r.so #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/liblber-2-devel.so.0 #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/liblber-2-devel.so.0.0.0 #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap-2-devel.so.0 #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap-2-devel.so.0.0.0 #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap_r-2-devel.so.0 #ANDROID_EXTRA_LIBS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap_r-2-devel.so.0.0.0 LIBS += -L$$PWD/lib/compiled/openldap-i686-linux-android_16/lib/ -lldap INCLUDEPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include DEPENDPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include PRE_TARGETDEPS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap.a LIBS += -L$$PWD/lib/compiled/openldap-i686-linux-android_16/lib/ -llber INCLUDEPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include DEPENDPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include PRE_TARGETDEPS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/liblber.a LIBS += -L$$PWD/lib/compiled/openldap-i686-linux-android_16/lib/ -lldap_r INCLUDEPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include DEPENDPATH += $$PWD/lib/compiled/openldap-i686-linux-android_16/include PRE_TARGETDEPS += $$PWD/lib/compiled/openldap-i686-linux-android_16/lib/libldap_r.a
Library loading at the beginning of the main method.
QLibrary ldap("ldap"); QLibrary ldap_r("ldap_r"); QLibrary lber("lber"); if(!ldap.load() || !lber.load() || !ldap_r.load()){ qDebug() << "Failed loading library"; }
The libraries that are contained in the lib folder are listed above
-
IIRC, android doesn't support library versioning so ensure that you don't have a symbolic link copied to your package but a copy of the library.
-
@SGaist said in Android App Development include LDAP on MAC OS X:
IIRC, android doesn't support library versioning so ensure that you don't have a symbolic link copied to your package but a copy of the library.
I removed the links from the libraries, deleted the links and renamed the lib to its original name, but the error still appears...
-
Which one ? The missing symbol or the dlopen error ?
-
Why are you dlopening the library on Android rather than linking to it ?
-
@mkmp29 said in Android App Development include LDAP on MAC OS X:
this does the the library...
Can you rephrase that please ? I don't understand what it means at all.
-
@SGaist said in Android App Development include LDAP on MAC OS X:
@mkmp29 said in Android App Development include LDAP on MAC OS X:
this does the the library...
Can you rephrase that please ? I don't understand what it means at all.
If I get it right, he means that he links the LDAP library. That library, however, uses dlopen internally to access yet another library.
-
Then this stackoverflow thread might help.