简体   繁体   English

如何在同一台计算机上同时安装多个版本的 llvm libc++(ubuntu)?

[英]How can I install multiple versions of llvm libc++ on the same computer at the same time (ubuntu)?

I've tried the obvious:我已经尝试了明显的:

apt-get install -y clang++-7 libc++abi-7-dev libc++-7-dev
apt-get install -y clang++-8 libc++-8-dev libc++abi-8-dev
apt-get install -y clang++-9 libc++-9-dev libc++abi-9-dev
apt-get install -y clang++-10 libc++-10-dev libc++abi-10-dev

No problem with multiple versions of clang++.多个版本的clang++没问题。 But each version of libc++ appears to uninstall the previous.但是每个版本的 libc++ 似乎都卸载了以前的版本。

When I try:当我尝试:

apt-get install libc++abi-7-dev libc++-7-dev  libc++abi-8-dev libc++-8-dev libc++-9-dev libc++abi-9-dev libc++-10-dev libc++abi-10-dev

I get我明白了

The following packages have unmet dependencies:
 libc++-10-dev : Conflicts: libc++-x.y-dev
 libc++-7-dev : Depends: libc++1-7 (= 1:7.0.1-12) but it is not going to be installed
                Conflicts: libc++-x.y-dev
 libc++-8-dev : Depends: libc++1-8 (= 1:8.0.1-9) but it is not going to be installed
                Conflicts: libc++-x.y-dev
 libc++-9-dev : Depends: libc++1-9 (= 1:9.0.1-11ubuntu1) but it is not going to be installed
                Conflicts: libc++-x.y-dev
 libc++abi-10-dev : Conflicts: libc++abi-x.y-dev
 libc++abi-7-dev : Depends: libc++abi1-7 (= 1:7.0.1-12) but it is not going to be installed
                   Conflicts: libc++abi-x.y-dev
 libc++abi-8-dev : Depends: libc++abi1-8 (= 1:8.0.1-9) but it is not going to be installed
                   Conflicts: libc++abi-x.y-dev
 libc++abi-9-dev : Depends: libc++abi1-9 (= 1:9.0.1-11ubuntu1) but it is not going to be installed
                   Conflicts: libc++abi-x.y-dev
E: Unable to correct problems, you have held broken packages.

Now I'm trying this on ubuntu 20.04, but I've tried similar on past versions of Ubuntu, and run into basically the same problem.现在我在 ubuntu 20.04 上尝试这个,但我在 Ubuntu 的过去版本中尝试过类似的方法,并且遇到了基本相同的问题。

Using docker or a virtualmachine seems to be the only practical solution for this.使用 docker 或虚拟机似乎是唯一可行的解决方案。

You can create build images of different version using the ubuntu:20.04 base image.您可以使用 ubuntu:20.04 基础镜像创建不同版本的构建镜像。 To build image create different Dockefiles as要构建图像,请创建不同的 Dockefiles

Dockerfile.vX (Replace X with the different version numbers) Dockerfile.vX(将X替换为不同的版本号)

FROM ubuntu:20.04

RUN apt-get install -y clang++-X libc++abi-X-dev libc++-X-dev

CMD ['/bin/bash']

then build the image of the version X docker build -f Dockerfile.vX -t lewisP/lvvm:X.然后构建版本 X docker build -f Dockerfile.vX -t lewisP/lvvm:X.

and run it as containers docker run -it lewisP/lvvm:X并将其作为容器docker run -it lewisP/lvvm:X

Read up on volumes to mount your project files you want to work with the installed packages.阅读卷以挂载您想要使用已安装包的项目文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM