compiling a static lxml with Python3 on x86_64 linux

Hello, I'm in a bit of a peculiar situation. I'm attempting to compile lxml with Python3 using statically-linked libraries on x86_64 linux (SLES 10, to be exact). I also do not have root access to the machine in question, so I must compile all the dependencies from source and install them to a location within my home directory. I've tried to use the staticlxml recipe ( http://pypi.python.org/pypi/z3c.recipe.staticlxml), but it appears to not work with buildout 2.0.0a1/Python3. Using "python3 setup.py build --static-deps" fails because when the dependencies are built, it does not automatically include "-fPIC" in the CFLAGS, as is apparently required on x86_64 linux platforms. I believe I have successfully compiled all of the dependencies manually (with -fPIC) and installed them to a location in my home directory. If I re-execute the "build --static-deps" command, the script will attempt to re-download the source executables for the dependencies, which wipes out my "-fPIC" change. How do I use the "setup.py" script to statically link against the libraries in my home directory? Thanks, Greg

Greg Fischer, 26.04.2012 00:00:
I'm in a bit of a peculiar situation.
Not at all.
I'm attempting to compile lxml with Python3 using statically-linked libraries on x86_64 linux (SLES 10, to be exact). I also do not have root access to the machine in question, so I must compile all the dependencies from source and install them to a location within my home directory.
I've tried to use the staticlxml recipe ( http://pypi.python.org/pypi/z3c.recipe.staticlxml), but it appears to not work with buildout 2.0.0a1/Python3. Using "python3 setup.py build --static-deps" fails because when the dependencies are built, it does not automatically include "-fPIC" in the CFLAGS, as is apparently required on x86_64 linux platforms.
I believe I have successfully compiled all of the dependencies manually (with -fPIC) and installed them to a location in my home directory. If I re-execute the "build --static-deps" command, the script will attempt to re-download the source executables for the dependencies, which wipes out my "-fPIC" change. How do I use the "setup.py" script to statically link against the libraries in my home directory?
Does it not work for you to export the CFLAGS env variable with an appropriate value before starting the build? All parts of the static build should properly pick it up. Stefan

Thanks. Setting CFLAGS="-g -O2 -fPIC" and then doing "python3.2 setup.py build --static-deps" (mostly) fixed it. I then had to manually enter the lxml link commands and include "-liconv", as libiconv_open was coming back as an unresolved symbol. When I set LDFLAGS="-liconv", the dependencies fail to compile. Is it possible to add "-liconv" to the link command in setup.py *only* for lxml? Thanks for all your help! Greg On Thu, Apr 26, 2012 at 1:21 AM, Stefan Behnel <stefan_ml@behnel.de> wrote:
Greg Fischer, 26.04.2012 00:00:
I'm in a bit of a peculiar situation.
Not at all.
I'm attempting to compile lxml with Python3 using statically-linked libraries on x86_64 linux (SLES 10, to be exact). I also do not have root access to the machine in question, so I must compile all the dependencies from source and install them to a location within my home directory.
I've tried to use the staticlxml recipe ( http://pypi.python.org/pypi/z3c.recipe.staticlxml), but it appears to not work with buildout 2.0.0a1/Python3. Using "python3 setup.py build --static-deps" fails because when the dependencies are built, it does not automatically include "-fPIC" in the CFLAGS, as is apparently required on x86_64 linux platforms.
I believe I have successfully compiled all of the dependencies manually (with -fPIC) and installed them to a location in my home directory. If I re-execute the "build --static-deps" command, the script will attempt to re-download the source executables for the dependencies, which wipes out my "-fPIC" change. How do I use the "setup.py" script to statically link against the libraries in my home directory?
Does it not work for you to export the CFLAGS env variable with an appropriate value before starting the build? All parts of the static build should properly pick it up.
Stefan _________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml
participants (2)
-
Greg Fischer
-
Stefan Behnel