Static-deps fails in the presence of Ubuntu "libgcrypt11-dev"

Bug #928467 reported by Brandon Rhodes on 2012-02-07
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

If my 11.10 Ubuntu machine has the "libgcrypt11-dev" package installed, then a STATIC_DEPS=true install of lxml 2.3.3 off of PyPI builds a library that dies on "import lxml.etree" with the error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /home/brandon/newfs/buildout-myplants/local/lib/python2.7/site-packages/lxml/ undefined symbol: gcry_check_version

The article "Compiling lxml/libxml2/libxslt for a virtualenv" at suggests using these environmental variables:

CFLAGS='-lgcrypt -fPIC' STATIC_DEPS=true ...

With these options, it is another symbol that Python complains about upon import:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /home/brandon/newfs/buildout-myplants/local/lib/python2.7/site-packages/lxml/ undefined symbol: gcry_cipher_close

Removing "libgcrypt11-dev" solves the problem, but unfortunately the package is a dependency of "libgdal1" which we need for some geospatial logic inside of our application.

Here is the version info that I can get:

Python : sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)

Brandon Rhodes (brandon-rhodes) wrote :

And, for what it's worth, getting past the problem described above leads to another failure-upon-import:

Traceback (most recent call last):
  File "", line 2, in <module>
    from lxml import etree
ImportError: /home/brandon/newfs/buildout-myplants/local/lib/python2.7/site-packages/lxml/ undefined symbol: libiconv

But I will probably wait to file a separate bug report on it until you can look into the above problem and see what is going on. Thanks!

Brandon Rhodes (brandon-rhodes) wrote :

Oh, wow — 2.2.8 with STATIC_DEPS installs great! I will just downgrade to that version semi-permanently so that I can move forward with this project — but I will keep track of this bug in case more recent lxml's start working with STATIC_DEPS as well.

Brandon Rhodes (brandon-rhodes) wrote :

I was wrong! My tests had not correctly tried every combination of factors. Moving to version 2.2.8 fixes the "libiconv" problem but NOT the "gcry_check_version" problem.

scoder (scoder) wrote :

libxslt builds against libgcrypt optionally when available. There are two ways to fix this: pass the --without-crypto option to its configure script, or check if libgcrypt-config can be found and run and add its output to the build libs. I think I prefer the latter. It's always good to support the features that are available on a given system.

Care to provide a patch for You can fork the project on github for that.

As a side-note, I find it interesting that some people prefer writing blog posts about ugly work-arounds for weird problems over actually telling the developers about it. So, thanks for filing this ticket.

Changed in lxml:
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers