LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   GCC vs LLVM (http://www.linuxquestions.org/questions/slackware-14/gcc-vs-llvm-931034/)

mlpa 02-24-2012 07:11 AM

GCC vs LLVM
 
I saw this news in Phoronix.

I have tried to understand which is better.
I have always used GCC, is there a significant reason to change?

bosth 02-24-2012 10:25 AM

Not a Slackware question. There are programming forums.

knudfl 02-24-2012 02:44 PM

http://llvm.org/

1) There's a llvm/clang Slackbuild ( Version 2.9 )
http://slackbuilds.org/result/?search=llvm&sv=13.37
LLVM 3.0 : http://llvm.org/releases/download.html#svn
Clang http://clang.llvm.org/

2) Gcc will compile "everything".
LLVM can compile some (the most?) applications / libraries.
Why not try out llvm / clang, to know ?
( export CC=clang CXX=clang++ && <other-command> ).

Alien Bob 02-24-2012 02:45 PM

This is not a programming question per sť.

You could also see it as a philosophical question - everybody grew up with GCC - what will a move to LLVM bring to Linux distributions? I have no doubt that Redhat considers a move away from GCC.

This is just one step in a trend to abandon the platform-agnostic tools of old and push Linux into a direction which will separate it from it's UNIX cousins. Some would call it "refreshment of Linux" but mainly this is a push to get the Linux desktop into a state where it will be commercially exploitable. The big distro vendors are not concerning themselves with compatibility issues - look at how we, Slackware, must struggle to keep our own distro sane.

Their ulterior motive is simply: to earn more money. And **** the hippies.

Eric

mlpa 02-24-2012 03:02 PM

Quote:

Originally Posted by bosth (Post 4611086)
Not a Slackware question. There are programming forums.

I am not trying to do a programming questions, or looking to change my compiler.

I am only trying to understand, from the point of view from Linux Distro Maintainers is there any major step in using LLVM?
Based on Phonorix Apple use it and Fedora is considering.

After so many time with GCC, and from several post that I read, many program use specific GCC Macros and options, what is the force to change?
And as a Linux user, is this change for the better or worse?

mlpa 02-24-2012 03:04 PM

Quote:

Originally Posted by knudfl (Post 4611253)
http://llvm.org/

1) There's a llvm/clang Slackbuild ( Version 2.9 )
http://slackbuilds.org/result/?search=llvm&sv=13.37
LLVM 3.0 : http://llvm.org/releases/download.html#svn
Clang http://clang.llvm.org/

2) Gcc will compile "everything".
LLVM can compile some (the most?) applications / libraries.
Why not try out llvm / clang, to know ?
( export CC=clang CXX=clang++ && <other-command> ).

Thanks for the info.
Maybe if i have time I can write a simple code in C and compile with GCC and CLANG and see the differences.
Namely compilation time, execution time and try different optimizations :D

a4z 02-25-2012 04:16 AM

that llvm hypes currently several comanies have several motivations to use it as 'their' compiler is on thing

the advantage of llvm/clang is its modular design, so it can be interfaced and used for example to create static code analysis tools, what becomes more and more important

and competition is good, even for gcc

beside that, it is great to use more than one compiler, especially in so exiting times where the new c++11 stuff comes into the compilers
for C++ this is a big win, compaired to the situation of the last years


for me it is realy exiting to see how various tools and compilers work with each other and how they continue brining new features, and I currently use gcc/clang++ and msvc10 to compile my code.

also, there is no real a vs b situation for me , cause my code has to work with all 3 compilers, or 2 for the linux only parts

fgcl2k 02-27-2012 02:27 AM

Quote:

Originally Posted by Alien Bob (Post 4611254)
This is just one step in a trend to abandon the platform-agnostic tools of old and push Linux into a direction which will separate it from it's UNIX cousins.

Why do you think that the move to LLVM is a step to separate Linux from its UNIX cousins? The BSDs, for example, are already contemplating to replace gcc, although for licence reasons.
Quote:

Originally Posted by Alien Bob (Post 4611254)
Some would call it "refreshment of Linux" but mainly this is a push to get the Linux desktop into a state where it will be commercially exploitable. The big distro vendors are not concerning themselves with compatibility issues - look at how we, Slackware, must struggle to keep our own distro sane.

I completely agree with your analysis about the direction that Linux development is taking.

the3dfxdude 02-29-2012 11:09 AM

Some people may not know this, but gcc has been replaced before. At least by a fork of itself.

http://en.wikipedia.org/wiki/GNU_Com...tion#EGCS_fork

Maybe this is not as drastic as moving to a new compiler code base, but this could shed light why LLVM is getting new attention. Many times, forks or replacements are written, not so much for technical reasons, but control of the code base. (Don't get me wrong, the project leads may make technical decisions different than their competing project, to "improve" things)

So EGCS is an example of developers not happy of the management of GCC, going out on their own, and eventually being the leader. This led back to remerging the code bases under the new leadership (or at least being called the defacto GCC). So GCC is one big happy family again right?

LLVM could prove to be successful that it becomes a standard, but I will wait and see. I do have it installed for my Mesa driver.

Not every competing faction succeeds. Take again Red Hat and GCC, which produced the ill-fated GCC 2.96 (an unofficial fork of GCC 2.95). Unfortunately it was popular among some commercial vendors using Red Hat, and I've finally just got off a vendor produced program myself which required those C++ libs by just finally rewriting a new program for my company in the last 6 months.

Martinus2u 02-29-2012 12:23 PM

Quote:

Originally Posted by Alien Bob (Post 4611254)
You could also see it as a philosophical question - everybody grew up with GCC - what will a move to LLVM bring to Linux distributions?

I grew up with Pure C (formerly Turbo C) on m68k hardware which compiled 20 times faster than GCC and produced similarly well optimised code (since then optimisation has improved no doubt). I believe the speed difference between CLANG and GCC is similar. That alone makes it worth it.

Alien Bob 02-29-2012 12:26 PM

Martinus2u ... you also wrote software on Atari? How funny, I did this too.
I must have my Pure C floppies still, somewhere, but I only run Atari emulators these days, having done away with the 1040ST and the TT long ago.

Eric

Martinus2u 02-29-2012 02:34 PM

Quote:

Originally Posted by Alien Bob (Post 4615252)
Martinus2u ... you also wrote software on Atari? How funny, I did this too.
I must have my Pure C floppies still, somewhere, but I only run Atari emulators these days, having done away with the 1040ST and the TT long ago.

Eric

hehe, yes, i wrote mostly small utilities, that sometimes got me a few bucks from computer magazines. :) I had one of the first mega ST with a whooping 4 MB. Later I upgraded to 68020 and 68030 cpus which means I had to go heavily into hardware design. :D I also contributed to linux 68k. There is still one occurrence of my old e-mail adress left in the vanilla kernel to this day. :D

but all that is history now. I sometimes play with vice, the c 64 emulator. :D

mlpa 03-06-2012 08:26 AM

As it seems Debian are also thinking in trying out LLVM compiler, here.

haziz 03-18-2012 03:34 PM

LLVM/Clang: It's Great for Students!
 
I don't know how it would fit for distribution maintainers; it is attractive to companies trying to make money since it's "BSD" stye license (U. of Chicago license I think) is probably easier to use for financial gain than the GPL though many companies have proved you could profit with GPLed software. Probably why Apple is pushing it in favor of GCC.

I am a student currently studying C and Unix systems programming and I must say that for me Clang has been a godsend and that is mainly because it's warning and error messages are infinitely easier to understand than those of GCC. It also will usually accurately highlight and literally "point to" your errors. I just find it much more user friendly. I am using it from the CLI in a GNU/linux box, so this is not due to a particular implementation in an IDE.

ReaperX7 03-20-2012 12:05 AM

The only thing I've ever used LLVM for was to compile Mesa to support 3D acceleration for various video cards using Gallium3D.

It's just another compiler for another purpose. GCC is and will always be the defacto open source compiler not just for Linux but for many open source projects.


All times are GMT -5. The time now is 09:18 AM.