Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I work on two different projects that use the two different versions, and I'd like to switch at will between them.

When I try to install package 'libxerces-c-dev' it wants to uninstall 'libxerces-c2-dev'.

How would I set up the two side-by-side using update-alternatives?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This is what I did;

  • used synaptic to install xerces-2 packages
  • cd /usr/include
  • sudo cp -rp xercesc xercesc-28
  • used synaptic to install xerces-3 packages
  • cd /usr/include
  • sudo mv xercesc xercesc-31
  • sudo ln -s xercesc-31 xercesc

The above creates two key sym links; /usr/lib/libxerces-c.so, and /usr/include/xercesc. Now to configure update-alternatives to manage those two links for me;

sudo update-alternatives --install /usr/lib/libxerces-c.so libxerces /usr/lib/libxerces-c.so.28 1 --slave /usr/include/xercesc xerces-dev /usr/include/xercesc-28

sudo update-alternatives --install /usr/lib/libxerces-c.so libxerces /usr/lib/libxercesc-3.1.so 2 --slave /usr/include/xercesc xerces-dev /usr/include/xercesc-31

This allows me to select between the two libxerces alternatives, and slaves the xerces-dev selection to that choice, as well. So, now I can switch between the two using;

  • sudo update-alternatives --config libxerces

update-alternatives presents a text menu, which I don't really need because I know the option numbers from the '--install' commands. To quickly bypass that, I added these to my ~/.bashrc

  • alias x28='echo "1" | sudo update-alternatives --config libxerces > /dev/null'
  • alias x31='echo "2" | sudo update-alternatives --config libxerces > /dev/null'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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