yufit_in_Japan
yufit_in_Japan

Reputation: 583

How to install clang-3.5 without removing gcc-4.8 on Ubuntu13.10

I want to install clang-3.5(latest version) on my desctop PC.(Ubuntu 13.10) I've tried installation setup based on this webpage,

The detailed steps are shown below.

  1. I created the text file in /etc/apt/sources.list.d/ and added the follwing lines.

    deb http://llvm.org/apt/saucy/ llvm-toolchain-saucy main deb-src http://llvm.org/apt/saucy/ llvm-toolchain-saucy main

  2. Then, I executed following command.

    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -

    sudo aptitude install clang-3.5 lldb-3.5

  3. I got follwing warning message. It seems to be removing gcc and clang(old version). But I don't want to remove gcc-4.8.

Is it possible to install clang-3.5 without removing gcc-4.8 on Ubuntu13.10?

Any help would be appreciated. Thanks in advance.

The following NEW packages will be installed: clang-3.5{b} libclang1-3.5{a} libobjc-4.8-dev{a} libobjc4{a} lldb-3.5{b} llvm-3.5{a} llvm-3.5-dev{a} The following packages will be upgraded: gcc-4.8-base libasan0 libatomic1 libclang-common-3.5-dev libgcc-4.8-dev libgcc1 libgomp1 libitm1 libllvm3.5 libquadmath0 llvm-3.5-runtime 11 packages upgraded, 7 newly installed, 0 to remove and 97 not upgraded. Need to get 55.1 MB/59.2 MB of archives. After unpacking 137 MB will be used. The following packages have unmet dependencies: lldb-3.5 : Breaks: lldb-3.2 but 1:3.2repack-7ubuntu1 is installed. libstdc++-4.8-dev : Depends: gcc-4.8-base (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. Depends: libgcc-4.8-dev (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. g++-4.8 : Depends: gcc-4.8-base (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. clang-3.5 : Breaks: clang-3.2 but 1:3.2repack-7ubuntu1 is installed. libstdc++6 : Depends: gcc-4.8-base (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. cpp-4.8 : Depends: gcc-4.8-base (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. gcc-4.8 : Depends: gcc-4.8-base (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. Depends: libgcc-4.8-dev (= 4.8.1-10ubuntu9) but 4.8.2-1ubuntu1 is to be installed. open: 66; closed: 203; defer: 25; conflict: 34
.The following actions will resolve these dependencies:

Remove the following packages:
1) clang
2) clang-3.2
3) g++
4) g++-4.8
5) gcc
6) gcc-4.8
7) lldb-3.2

Upgrade the following packages:
8) cpp-4.8 [4.8.1-10ubuntu9 (now, saucy-updates) -> 4.8.2-1ubuntu1 (saucy)] 9) libstdc++-4.8-dev [4.8.1-10ubuntu9 (now, saucy-updates) -> 4.8.2-1ubuntu1 (saucy)] 10)
libstdc++6 [4.8.1-10ubuntu9 (now, saucy-updates) -> 4.8.2-1ubuntu1 (saucy)] Leave the following dependencies unresolved:
11) cmake recommends gcc
12) ubuntu-desktop recommends gcc
Accept this solution? [Y/n/q/?]

Upvotes: 1

Views: 2628

Answers (2)

A. K.
A. K.

Reputation: 38136

You can install clang from source (http://clang.llvm.org/get_started.html) anywhere in your disk without affecting other versions of clang that are installed.

Then append the PATH variable in the ~/.bashrc:

export PATH=/path/to/install/clang/bin:$PATH

or, you can use the clang using the full-path like this:

/path/to/install/clang/bin/clang -c test.cpp

Upvotes: 0

old_timer
old_timer

Reputation: 71526

change the 34 to 35 and may have to add a sudo or two in there.

export JN
#export JN='-j 8'

svn co http://llvm.org/svn/llvm-project/llvm/branches/release_34/ llvm34
cd llvm34
cd tools
svn co http://llvm.org/svn/llvm-project/cfe/branches/release_34/ clang
cd ..
./configure --enable-optimized --disable-doxygen --prefix=/opt/llvm34
make $JN
make install

then add /opt/llvm3x/bin to your path if you want to use it, otherwise dont add the path.

What clang/llvm has to do with gcc I have no idea they are two completely separate things just like having vi and emacs installed at the same time.

Upvotes: 3

Related Questions