Howto set newer LLVM version as default compiler on FreeBSD10.4?

nfuhs

New Member


Messages: 6

How can I force FreeBSD 10.4 to use a newer LLVM version like 4.0 to compile cc libs?

I installed LLVM4.0 via ports
and I change my /etc/make.conf :

CC=clang40
CXX=clang++40
CPP=clang-cpp40

If if run clang --version it shows 3.4 the default one is used...

How can I setup my LLVM version probably at FreeBSD 10.4?
 

ShelLuser

Son of Beastie

Reaction score: 1,669
Messages: 3,512

Re-read what you just shared... You told the system that in order to use cc it should use the clang40 executable. However, these are make settings (it's all in the name really: make.conf) so obviously they will not affect your OS itself but only sessions which utilize make.

If you want to use Clang 4.0 then use that executable. Don't start cc but clang40 instead.

Still, if you want to overrule things so that cc starts clang40 then the your best option is to create a symlink called cc in ~/bin. Point it to clang40. Then change your login profile, the search path in specific, and make sure that ~/bin comes before /usr/bin. That will solve your problem.
 
OP
OP
N

nfuhs

New Member


Messages: 6

Thanks for your answer!

Sorry for my stupid questions on this but I'm just new to FreeBSD and compiling cc with clang..

I just read this forum post and thought its a solution to my problem:

LLVM Upgrade - The FreeBSD forums

So if I understand you right I can point directly to my ports installed LLVM version at
/usr/local/llvm40/bin/ ?

If I want to set the PATH to the via ports installed LLVM I do this by updating my /etc/csh.cshrc ?

Like:
export PATH=$PATH:/usr/local/llvm40/bin
 

ShelLuser

Son of Beastie

Reaction score: 1,669
Messages: 3,512

Sorry for my stupid questions on this but I'm just new to FreeBSD and compiling cc with clang..
No worries, there is no such thing as a stupid question and it's only natural that some things can confuse you when you're not fully familiar with them.

So if I understand you right I can point directly to my ports installed LLVM version at
/usr/local/llvm40/bin/ ?
Yah, in the way shown above. Whatever you do, do not mess around with the executables in the /usr/bin directory because that will most certainly result in bigger problems.

If I want to set the PATH to the via ports installed LLVM I do this by updating my /etc/csh.cshrc ?

Like:
export PATH=$PATH:/usr/local/llvm40/bin
It depends on the shell you're using, but sure. For root that would be ~/.cshrc, for accounts which use the default /bin/sh this will probably be ~/.profile.
 
OP
OP
N

nfuhs

New Member


Messages: 6

I marked this thread as solved as I showed me to setup LLVM on FreeBSD.. still much to learn about FreeBSD but eager to learn and I figured out my problem doesn't seem to be FreeBSD but makefile related.. :rolleyes:
 
Top