4

I installed Clang 3.6 following the instructions here (the latest version in Ubuntu repository is 3.5):

# to retrieve the archive signature
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -

# to install all packages
apt-get install clang-3.6 clang-3.6-doc libclang-common-3.6-dev libclang-3.6-dev libclang1-3.6 libclang1-3.6-dbg libllvm-3.6-ocaml-dev libllvm3.6 libllvm3.6-dbg lldb-3.6 llvm-3.6 llvm-3.6-dev llvm-3.6-doc llvm-3.6-examples llvm-3.6-runtime clang-modernize-3.6 clang-format-3.6 python-clang-3.6 lldb-3.6-dev

However, after the installation, man clang says

No manual entry for clang
See 'man 7 undocumented' for help when manual pages are not available.

but man clang-3.6 works. Also, neither man clang++ or man clang++-3.6 works. How do I make man clang and man clang++ work and open the man page as it is already in the system? I also want to use the commands clang and clang++ instead of clang-3.6 and clang++-3.6.

ajay
  • 505
  • 2
  • 5
  • 14

2 Answers2

5

Just create some symlinks:

sudo ln -s "$(command -v clang-3.6)" /usr/local/bin/clang
sudo ln -s "$(command -v clang++-3.6)" /usr/local/bin/clang++
sudo ln -s "$(man -w clang-3.6)" /usr/share/man/man1/clang.1.gz

The first two are for the clang and clang++ commands, and the third for the manpage. If the manpages for clang and clang++ are supposed to be the same, you can repeat it withclang++.1.gz instead of clang.1.gz.

And while you're at it, file a feature request with the package maintainers.

muru
  • 197,895
  • 55
  • 485
  • 740
  • what does the command command do? There's no man page for it. – ajay Jul 16 '15 at 08:28
  • 1
    @ajay it's a builtin, so check man bash. Also see http://unix.stackexchange.com/a/85250/70524. – muru Jul 16 '15 at 08:29
  • I checked in /usr/share/man/man1, there is no clang.1.gz file but there is clang-3.6.1.gz file. Shall I replace the clang.1.gz with clang-3.6.1.gz in your answer? – ajay Jul 16 '15 at 08:39
  • 1
    @ajay No. What would be the point of that? We are creating a clang.1.gz link because it doesn't exist it in the first place. If it already existed, you wouldn't have problems with man clang. – muru Jul 16 '15 at 08:44
  • I just realized that. Sorry for posting a stupid comment. Thanks for your help :) – ajay Jul 16 '15 at 08:45
3

In short answer

run the commands:

sudo ln -s `which clang-3.6` /usr/local/bin/clang
sudo ln -s `which clang++-3.6` /usr/local/bin/clang++

Details

You should use symlink for that.

which command

Will show the place of the binary then you can make the symlink. for example i'll make a symlink as example for command mkdir.

$ which mkdir
/bin/mkdir

Now i'm going to make symlink for command mkdir:

sudo ln -s /bin/mkdir /bin/makedir

then for now you can use makedir instead of mkdir.

Another approach

Maythux
  • 84,289