Is CLANG to be so much recommended for FreeBSD ?


Aspiring Daemon

Thanks: 443
Messages: 779

GCC is of course a good quality compiler since it drives many systems. It is kinda producing bloat, ok, takes ages to compile,... and more more to say. It is ok but not perfect (like everything).

On the other hands, have you ever tried to compile CLANG for your system? Good luck really. It is really difficult to manage to compile it.

There is maybe an urgent need for a base C-compiler for *BSD operating systems (core/base system).
Oh Dear, are you a Linux troll?

Why not simply pkg install llvm60?

Or in case you are not faint-hearted, pkg install clang-devel, or even cd /usr/ports/devel/clang-devel; make install clean

If you really need to build and install Clang directly from the upstream sources, then of course it would be difficult, if you don't read the proper documentation, but only give indirect links to it for others reading it for you. Building and using Clang:

I read it long time ago, because I was in need to compile lldb(1) on my BeagleBone Black, since this didn't made it into the ports for ARM targets, here come my installation minutes:
# Installation of the build dependencies:
pkg install tmux
pkg install cmake
pkg install python
pkg install libxml2
pkg install swig30
pkg install ninja

mkdir -p ~/install; cd ~/install
svn co llvm
cd ~/install/llvm/tools
svn co clang
svn co lld
svn co lldb
cd ~/install/llvm/projects
svn co compiler-rt
svn co libunwind
svn co libcxx
svn co libcxxabi

# Preparing the build system:
cd ~/install/llvm
mkdir build; cd build

   # On a fast system with plenty of RAM, execute:
   cmake -G Ninja ..

   # ON a ARM machine with tiny resources in all respects, execute:

# Building -- using tmux, so we may disconnect during the long build
tmux new "ninja install"
<ctrl>-b d

# Check the progress
tmux a
<ctrl>-b d

# Some hours later
/usr/local/bin/clang --version


Aspiring Daemon

Thanks: 313
Messages: 915

The BSD license in itself makes it better. GNU licenses encourage recycling bloat (inefficiencies/ bugs), because no one wants to give up their contributions the competitor who owns the copyright for one piece of software, then not be able to keep the next improvement for themselves. It makes the solution, use a lot of software to get 1 needed piece of code, because allows someone to patch the problem, so they don't have to use their heavy time and resources to benefit the owner of the copyright, more than the open source community. Then, no one can make the next improvement, without giving up their rights to that. With a BSD or MIT license, someone can improve it, and it benefits everyone, then some GNU licenses can absorb that improvement too.

Clang may not work with everything yet, but its improvement curve is being much faster than GCC.

GCC is of course a good quality compiler since it drives many systems.
No, it's not, but there's quality code hidden in it.

If FreeBSD stuck with GCC, by its newer license we would be forced to use their bloat. By them moving up the license, FreeBSD, would either have to stick with the older GCC, which can only go so far, being forced to use that old license, or further be controlled by GCC, and not be able to have as many freedoms for software compiled on it. Any benefit put forward to GCC would be lost for them to own. That will slow down and harm the project, for FreeBSD users to do what they want, or use their hard work to improve the system, not lose that work, so they can't make the next benefit.

I don't even want to hear about GCC anymore. The topic of this thread is about GCC, not what else is there other than Clang (that's not GCC).