2011-06-29 29 views
-2

所以我从源代码中获得了最新的python-ldap。我也运行python 2.7.2的源代码编译版本,我在RHEL上运行它。所以当我尝试编译这个包时,我会看到如下所示的这个很长的错误信息。所以我安装了openldap-devel软件包,现在它是一个更小的错误。但还没有编译。Python-LDAP无法编译

extra_compile_args: -g 
extra_objects: 
include_dirs: /opt/openldap-RE24/include /usr/include/sasl 
library_dirs: /opt/openldap-RE24/lib 
libs: ldap_r lber sasl2 ssl crypto 
running install 
running bdist_egg 
running egg_info 
writing requirements to Lib/python_ldap.egg-info/requires.txt 
writing Lib/python_ldap.egg-info/PKG-INFO 
writing top-level names to Lib/python_ldap.egg-info/top_level.txt 
writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt 
file Lib/ldap.py (for module ldap) not found 
file Lib/ldap/controls.py (for module ldap.controls) not found 
file Lib/ldap/extop.py (for module ldap.extop) not found 
file Lib/ldap/schema.py (for module ldap.schema) not found 
reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
warning: no files found matching 'Makefile' 
warning: no files found matching 'Modules/LICENSE' 
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt' 
installing library code to build/bdist.linux-x86_64/egg 
running install_lib 
running build_py 
file Lib/ldap.py (for module ldap) not found 
file Lib/ldap/controls.py (for module ldap.controls) not found 
file Lib/ldap/extop.py (for module ldap.extop) not found 
file Lib/ldap/schema.py (for module ldap.schema) not found 
file Lib/ldap.py (for module ldap) not found 
file Lib/ldap/controls.py (for module ldap.controls) not found 
file Lib/ldap/extop.py (for module ldap.extop) not found 
file Lib/ldap/schema.py (for module ldap.schema) not found 
running build_ext 
building '_ldap' extension 
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.4.1 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/opt/home/mradmin/.local/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o -g 
In file included from Modules/LDAPObject.c:18: 
/usr/include/sasl/sasl.h:349: warning: function declaration isnât a prototype 
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.4.1 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/opt/home/mradmin/.local/include/python2.7 -c Modules/ldapcontrol.c -o build/temp.linux-x86_64-2.7/Modules/ldapcontrol.o -g 
Modules/ldapcontrol.c: In function âencode_assertion_controlâ: 
Modules/ldapcontrol.c:350: warning: implicit declaration of function âldap_create_assertion_control_valueâ 
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.4.1 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/opt/home/mradmin/.local/include/python2.7 -c Modules/common.c -o build/temp.linux-x86_64-2.7/Modules/common.o -g 
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.4.1 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/opt/home/mradmin/.local/include/python2.7 -c Modules/constants.c -o build/temp.linux-x86_64-2.7/Modules/constants.o -g 
Modules/constants.c: In function âLDAPinit_constantsâ: 
Modules/constants.c:153: error: âLDAP_OPT_DIAGNOSTIC_MESSAGEâ undeclared (first use in this function) 
Modules/constants.c:153: error: (Each undeclared identifier is reported only once 
Modules/constants.c:153: error: for each function it appears in.) 
Modules/constants.c:363: error: âLDAP_CONTROL_RELAXâ undeclared (first use in this function) 
error: command 'gcc' failed with exit status 1 

由于这是封闭的,因为这个问题,没有ocmpile请帮我出来不是一个问题。我想到了。我不得不手动编译最新的ldap,berkleydb,然后使用它进行构建安装。然后它建立好了

+2

这是很多文字。那里有什么问题吗? –

+0

@George Cummins是的,如何在Python上编译LDAP。 – phihag

+1

@Nerdtastic对于代码和代码输出,您应该使用代码格式(Ctrl + K),而不是引号。引用插入并破坏行结束。此外,您可以在第一个错误后剪切所有内容。 – phihag

回答

2

第一个和第二个错误消息指出你缺少lber.hldap.h。这是指向丢失或无效的openldap-devel软件包的强有力指针。你有没有安装该软件包(或类似的软件包)(*ldap-dev*)?

+0

是的,我现在安装了ldap-devel软件包,它发生了一个小得多的错误。我将用新代码更新主代码 –

0

可能是OpenLDAP和python-ldap版本不匹配。尝试针对体面版本的OpenSSL编译最新的python-ldap版本。例如。 Debian系统已经臭名昭着旧版本的OpenLDAP安装...

+0

您是否有推荐的版本?安装的是2.3.43-12.el5_6.7 –