I've got fedora fc15 installed with python 2.7.1-7.fc15. It is built with ucs4 and I've got some packages here at work that are built with ucs2. I now cannot build other packages that use these ucs2 packages because my python is ucs4. And the problem is that as soon as I remove python, yum doesn't work and things get complicated. What is the best way to approach this problem, to get ucs2 python and all? Please note that I cannot influence the pre-built company binaries that are built with ucs2 to be built with ucs4.



I think you've got two basic choices:

  1. if you have access to the source or srpms, recompile your ucs2 packages for ucs4 python. This may not be practical if, for example, you need to communicate or share data with other machines expecting ucs2. a database for example. I mention this option mostly for completeness - from what you've said, it's not likely to be a viable option.

  2. compile and install a ucs2 version of python in /usr/local (preferably use GNU Stow to install it to get some of the benefits that a package would have given you).

    Set up the environment to point to the ucs2 python binaries and libraries - including LD_PRELOAD, PYTHONHOME, PYTHONPATH, etc. you probably want to write a script for this (source it, or put it in your shell's rc script - e.g. ~/.bashrc for bash - if you don't care about running non-ucs2 python at all) You will probably need to rebuild/reinstall any python libraries that care about unicode using your ucs2 python environment and install them under /usr/local.

    Finally, install your company's ucs2 packages under /usr/local. These may also need to be rebuilt to install under /usr/local.

Either way, you should reinstall the fedora python packages to un-break everything else in the system that expects python to be installed (including yum)

  • Thanks. Yes, solution 1 is not an option unfortunately. I've got a few questions tho. I installed ucs2 version to /usr/local and set PYTHONHOME to /usr/local/lib/python2.7... what should I put into LD_PRELOAD and PYTHONPATH? – Marin Oct 2 '12 at 11:18
  • LD_PRELOAD is for any C libs that the python executable in /usr/local might need (if any) - so it loads them instead of the system libs. PYTHONPATH should be OK to ignore. see the python man page for details, search for "ENVIRONMENT VARIABLES" near the end of the page. for details on LD_PRELOAD, see the man page for ld.so – cas Oct 2 '12 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.