Natty has introduced a new feature called multiarch. Some shared libraries are installed in architecture specific directories, e.g. /usr/lib/x86_64-linux-gnu/libz.so instead of /usr/lib/libz.so. The dynamic linker ld.so has been modified to look for libraries in the new locations. If you wonder how, /etc/ld.so.conf.d/x86_64-linux-gnu.conf does the trick. However Python's setup.py uses hard coded paths and doesn't know about the new feature. Barry's posting [1] has some insight information.
The problem has been dealt with for Python 2.7, 3.1, 3.2 and newer versions, but 2.6 and earlier won't see any fixes. Current Python releases (2.7.1, 3.2.0) suffer from the issue, too. Don't be battle-weary! The solution to the issue is rather simple.
$ make distclean
$ export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
$ ./configure
$ make
$ make install
$ unset LDFLAGS
This adds an additional library search path (-L/usr/lib/x86_64-linux-gnu on my box). Now setup.py knows about the multiarch lib directory and builds zlib and all the other missing modules just fine.
Actually my build system a bit more paranoid. It also adds /lib/x86_64-linux-gnu as library search path and /usr/include/x86_64-linux-gnu as header include path for C and C++.
$ export arch=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
$ export LDFLAGS="-L/usr/lib/$arch -L/lib/$arch"
$ export CFLAGS="-I/usr/include/$arch"
$ export CPPFLAGS="-I/usr/include/$arch"
$ ./configure
$ make
$ make install
$ unset arch LDFLAGS CFLAGS CPPFLAGS
[1] https://lists.ubuntu.com/archives/ubuntu-devel/2011-April/033049.html
Hmm, that may also be why my dev builds broke after the upgrade.
AntwortenLöschenIndeed, that was the problem - thanks for the tip!
AntwortenLöschenYou're welcome!
AntwortenLöschenYep, thanks for the blog posting. I was actually surprised about the change too, and have had some discussions both private and public about the way multiarch was rolled out. I don't disagree with the need for the feature, which had actually been planned for several cycles, but it was difficult for the multiarch advocates to know everything that would be affected by it. Sadly, 2.6 was already in security-fix only mode by then so the change couldn't be backported.
AntwortenLöschenThanks for the blog post...just spent half the day trying to figure out why it wasn't grabbing the zlib, and the frustrated search of "why is it so hard to compile python on linux today" returned your blog post lol
AntwortenLöschenGreat tip, thanks.
AntwortenLöschenAlso, some more details regarding _ssl: http://askubuntu.com/questions/21547/what-are-the-packages-libraries-i-should-install-before-compiling-python-from-so
Thank you - solved my problem today!
AntwortenLöschenThank you a lot! That problem has spoiled a half of my day. But you've saved a second one!
AntwortenLöschenThanks!
AntwortenLöschensala de datos
Thank you very much for this amazing article.visit websites.This blog very informative for me.
AntwortenLöschen