Building lxml with mac os x mountain lion fails.

Hello, I'm trying to build lxml on mac os x 10.8 and the build fails. I've also tried to change the compiler from gcc to clang, and it still fails. Output: http://paste.ubuntu.com/1172867/ (this is the output when CC=clang) any ideas? =/ ~mark

Mark Grandi, 29.08.2012 02:22:
http://comments.gmane.org/gmane.comp.python.lxml.devel/6515 Stefan

Stefan Behnel <stefan_ml <at> behnel.de> writes:
Doesn't work =/ I did export LIBXML2_VERSION=2.8.0, but since i'm on mountain lion, it seems that the script keeps trying to use the wrong sdk, its no longer /Developer/SDKs/MacOSX10.4u.sdk, but /Applications/Xcode.app/Contents/Developer. Also, i've read that xcode no longer supports building ppc binaries, and that was causing the entire build to fail with something like 'lipo: can't figure out the architecture type of: /var/ folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccZQsHOd.out error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1 ". See http:// stackoverflow.com/a/5806246/975046, the fix listed, having "ARCHFLAGS="-arch i386 -arch x86_64" before 'setup.py build --static-deps" seems to make it compile. The setup scripts should really be updated =/ However, this isn't solving my problem. I've gotten it to compile, but trying to import lxml.etree results in this: Corvidae:~ markgrandi$ python3 Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.
ImportError: dlopen(/Users/markgrandi/Library/Python/3.2/lib/python/site-packages/ lxml-2.3.5-py3.2-macosx-10.6-intel.egg/lxml/etree.so, 2): Symbol not found: _lzma_auto_decoder Referenced from: /Users/markgrandi/Library/Python/3.2/lib/python/ site-packages/lxml-2.3.5- py3.2-macosx-10.6-intel.egg/lxml/etree.so Expected in: flat namespace in /Users/markgrandi/Library/Python/3.2/lib/python/site-packages/ lxml-2.3.5-py3.2-macosx-10.6-intel.egg/lxml/etree.so no idea why =/

mark grandi <markgrandi <at> gmail.com> writes:
Well, I seem to of figured it out. It seems that libxml2 by default tries to include lzma, but since I recently installed the xz libraries, its probably having some conflict with the static vs not static version of liblzma, so i edited the buildlibxml.py script to pass in a '--without-lzma' option, and that worked. My entire compile process is listed below. The setup script REALLY needs to be updated to work with recent versions of mac os x..... Corvidae:lxml-2.3.5 markgrandi$ echo $CFLAGS -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX10.8.sdk/ Corvidae:lxml-2.3.5 markgrandi$ echo $LDFLAGS -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX10.8.sdk/usr/lib then edit buildlibxml.py, at around line 316, you see # build libxml2 libxml2_configure_cmd = configure_cmd + [ '--without-python', '--with-iconv=%s' % prefix] add '--without-lzma' to that list, so it becomes # build libxml2 libxml2_configure_cmd = configure_cmd + [ '--without-python', '--with-iconv=%s' % prefix, '--without-lzma'] then run: ARCHFLAGS="-arch i386 -arch x86_64" python3 setup.py --static-deps build then test:

Mark Grandi, 29.08.2012 02:22:
http://comments.gmane.org/gmane.comp.python.lxml.devel/6515 Stefan

Stefan Behnel <stefan_ml <at> behnel.de> writes:
Doesn't work =/ I did export LIBXML2_VERSION=2.8.0, but since i'm on mountain lion, it seems that the script keeps trying to use the wrong sdk, its no longer /Developer/SDKs/MacOSX10.4u.sdk, but /Applications/Xcode.app/Contents/Developer. Also, i've read that xcode no longer supports building ppc binaries, and that was causing the entire build to fail with something like 'lipo: can't figure out the architecture type of: /var/ folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccZQsHOd.out error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1 ". See http:// stackoverflow.com/a/5806246/975046, the fix listed, having "ARCHFLAGS="-arch i386 -arch x86_64" before 'setup.py build --static-deps" seems to make it compile. The setup scripts should really be updated =/ However, this isn't solving my problem. I've gotten it to compile, but trying to import lxml.etree results in this: Corvidae:~ markgrandi$ python3 Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.
ImportError: dlopen(/Users/markgrandi/Library/Python/3.2/lib/python/site-packages/ lxml-2.3.5-py3.2-macosx-10.6-intel.egg/lxml/etree.so, 2): Symbol not found: _lzma_auto_decoder Referenced from: /Users/markgrandi/Library/Python/3.2/lib/python/ site-packages/lxml-2.3.5- py3.2-macosx-10.6-intel.egg/lxml/etree.so Expected in: flat namespace in /Users/markgrandi/Library/Python/3.2/lib/python/site-packages/ lxml-2.3.5-py3.2-macosx-10.6-intel.egg/lxml/etree.so no idea why =/

mark grandi <markgrandi <at> gmail.com> writes:
Well, I seem to of figured it out. It seems that libxml2 by default tries to include lzma, but since I recently installed the xz libraries, its probably having some conflict with the static vs not static version of liblzma, so i edited the buildlibxml.py script to pass in a '--without-lzma' option, and that worked. My entire compile process is listed below. The setup script REALLY needs to be updated to work with recent versions of mac os x..... Corvidae:lxml-2.3.5 markgrandi$ echo $CFLAGS -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX10.8.sdk/ Corvidae:lxml-2.3.5 markgrandi$ echo $LDFLAGS -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX10.8.sdk/usr/lib then edit buildlibxml.py, at around line 316, you see # build libxml2 libxml2_configure_cmd = configure_cmd + [ '--without-python', '--with-iconv=%s' % prefix] add '--without-lzma' to that list, so it becomes # build libxml2 libxml2_configure_cmd = configure_cmd + [ '--without-python', '--with-iconv=%s' % prefix, '--without-lzma'] then run: ARCHFLAGS="-arch i386 -arch x86_64" python3 setup.py --static-deps build then test:
participants (4)
-
Brett
-
mark grandi
-
Mark Grandi
-
Stefan Behnel