Reputation: 1317
I find myself in the unfortunate position of supporting an old application that needs python 2.7. I pulled down the latest 2.7 release (wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
) and installed it, but now I'm getting the dreaded "undefined symbol: PyUnicodeUCS2_AsUTF8String" error from one of the packages in the app.
OK, so back out and run:
./configure --enable-shared --enable-unicode=ucs2
make install
python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
but I still get ucs4
for an answer. Looking at the Makefile the config arguments were passed through:
# configure script arguments
CONFIG_ARGS= '--enable-shared' '--enable-unicode=ucs2'
What am I missing? How do I get UCS-2 supported in my python build? Running this in an amazonlinux:2018.03 docker container, I don't see any other python installs on it.
Upvotes: 1
Views: 859
Reputation: 1317
OK, not positive what python is doing with linked libraries, but after fidgeting with this for quite a few hours, it appears that setting the LD_LIBRARY_PATH will get me what I want. I.e.:
> ./configure --enable-shared --enable-unicode=ucs2 --prefix=/fubar/python
...
> make install
...
> export PATH=/fubar/python/bin:$PATH
> python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
ucs4
> export LD_LIBRARY_PATH=/fubar/python/lib:$LD_LIBRARY_PATH
> python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
ucs2
There's probably something obvious in the way all this works, but I haven't had to worry about setting LD_LIBRARY_PATH in a very long time...
Upvotes: 1