Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-02-2013, 10:20 PM
|
#1
|
Member
Registered: Apr 2005
Location: switzerland
Distribution: slackware
Posts: 54
Rep:
|
Clang on Slackware, anyone?
I heard about Clang could replace GCC, I was thinking about installing it on my Slackware to have a try, but before, I would like to know if someone here already used it , if yes what are the ups and downs.
for those curious read here about it:
http://en.wikipedia.org/wiki/Clang
|
|
|
04-03-2013, 01:04 AM
|
#2
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Clang is part of a standard install of my 14.0 and -current system, it comes with the llvm package. So you can just try it.
|
|
2 members found this post helpful.
|
04-03-2013, 01:32 AM
|
#3
|
Slackware Maintainer
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,970
|
Pretty easy to give it a try. For most SlackBuilds that use a configure script, you can just add a couple lines to the start:
Code:
CC=clang \
CXX=clang++ \
CFLAGS="$SLKCFLAGS" \
./configure \
The majority of the things I've tried compile fine. I even added those CC and CXX definitions in the export statement at the end of KDE.options, and all but of few of the KDE packages compiled. Those that did, worked.
|
|
8 members found this post helpful.
|
04-03-2013, 04:09 AM
|
#4
|
Member
Registered: Apr 2005
Location: switzerland
Distribution: slackware
Posts: 54
Original Poster
Rep:
|
Quote:
Originally Posted by volkerdi
The majority of the things I've tried compile fine. I even added those CC and CXX definitions in the export statement at the end of KDE.options, and all but of few of the KDE packages compiled. Those that did, worked.
|
Many thanks. This will help me a lot, didn't know it was so simple. Will it replace GCC on Slackware too?
|
|
|
04-03-2013, 04:29 AM
|
#5
|
Slackware Maintainer
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,970
|
Quote:
Originally Posted by blackv1rus
Many thanks. This will help me a lot, didn't know it was so simple. Will it replace GCC on Slackware too?
|
Upstream packages are free to prefer whichever compiler they want. Right now llvm/clang and icu4c will prefer clang if it's available.
There's no plan to try to force it into place.
|
|
|
04-04-2013, 05:40 PM
|
#6
|
LQ Newbie
Registered: Aug 2012
Location: Germany
Distribution: Slackware64-current, Slackware64 14.0
Posts: 28
Rep: 
|
Clang will replace the GCC in FreeBSD in the future, but I never heard that it will replace the GCC in GNU/Linux or Slackware.
I think Clang is not able to build the Linux kernel right now, but it's able to build the FreeBSD kernel and most of the ports.
|
|
|
04-04-2013, 06:07 PM
|
#7
|
Slackware Maintainer
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,970
|
Quote:
Originally Posted by comfree
Clang will replace the GCC in FreeBSD in the future, but I never heard that it will replace the GCC in GNU/Linux or Slackware.
I think Clang is not able to build the Linux kernel right now, but it's able to build the FreeBSD kernel and most of the ports.
|
To build the Linux kernel, Clang needs a few patches. I hear these will be in the next release. Also, the kernel needs a few patches. Once a vanilla Clang is otherwise able to compile the kernel, I expect these changes will end up in the kernel sources. There's a lot of interest in making this possible... certainly it will be interesting to keep an eye on this.
|
|
|
04-04-2013, 06:24 PM
|
#8
|
LQ Newbie
Registered: Aug 2012
Location: Germany
Distribution: Slackware64-current, Slackware64 14.0
Posts: 28
Rep: 
|
Yes, it's really interesting and it's good to have an alternative. Isn't clang mainly developed by the BSD community? No offense here. 
I used it a couple times on FreeBSD 9.1 and I was really impressed how good it was already working. Is there any advantage over the GCC right now?
I red about some speed and size improvements on the compiled binaries and that clang should become the standart compiler in FreeBSD 10.0, but that was some time ago.
|
|
|
04-04-2013, 06:32 PM
|
#9
|
Slackware Maintainer
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,970
|
I haven't done any benchmarks with the compiled code. I did notice that llvm/clang compiled with clang was significantly smaller, but that most of the KDE packages grew in size. I've also been made aware that the clang compiler no longer works on the Pentium-III since it was recompiled with clang, and it looks to be an issue with the assembler. I need to set up an emulated Pentium-III environment to do some testing, but I believe recompiling with clang using the GNU assembler will fix the issue.
|
|
|
04-05-2013, 07:00 PM
|
#10
|
Member
Registered: Mar 2013
Location: Florida, USA
Distribution: Slackware, FreeBSD
Posts: 210
Rep:
|
The upside to using LLVM/Clang have to do with a) giving GCC some competition and b) giving different/better error reporting than GCC. Clang seems to be a nice C compiler that can compile a lot of open-source C programs. For now, the memory usage of Clang is not the miserable mess that gcc can be a times. LLVM/Clang is distributed under a BSD-style license, and that's part of the reason that FreeBSD uses it. Apple seems to like it because it can work on Objective-C without relying on GCC, but how that propagates to C/C++ is something I don't know.
The downside is in the programs that Clang can't compile, and that happens quite a bit on the C++ side. The results of doing, say, a Clang build of Xfce on top of a gcc-built GTK+ might not go very well. LLVM/Clang and GCC are simply targeting different parts of the C++ standards for improvement. Additionally, almost all of the open-source programs meant to be compiled on Linux were meant to be compiled using GCC. Whether such a program compiles using Clang depends on a) the upstream maintainer caring whether his/her program builds with Clang, b) that the program was written with portability in mind, and/or c) sheer luck that Clang chose to support the same quirks that GCC did.
LLVM/Clang is compelling on FreeBSD and can do a full `make world`, which would be the loose equivalent of taking the source code to the Slackware a, ap, d, and k disk sets, with parts of l and n thrown in there; then building all of it at once. I think that GCC is deprecated at this point for doing such a build. But keep in mind that the FreeBSD folks want to keep GPLv3 out of this world, and most of the GNU programs in the FreeBSD base are the last versions for which they were GPLv2 or lower. In particular, this means that GCC is 4.2.0 in FreeBSD, and that was a long time ago. They have plenty of incentive to make sure that Clang works on FreeBSD before GCC 4.2.0 becomes too obsolete to compile cutting-edge programs.
As for Linux in general, though, getting everything to work with Clang should be done on a case-by-case basis. Try it, though! For the C programs at least, a program should either build or not build. I haven't seen a case where a C program will build without errors under Clang and then do the wrong thing, but you still might watch for such cases.
|
|
4 members found this post helpful.
|
04-05-2013, 09:00 PM
|
#11
|
Member
Registered: Apr 2005
Location: switzerland
Distribution: slackware
Posts: 54
Original Poster
Rep:
|
Thanks for good info, I will start using Clang more to get knowledge of it.
|
|
|
12-25-2013, 12:38 AM
|
#12
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,352
|
I just set up a Slackware 14.1 VM with CC set to clang and CXX set to clang++. So far, I've rebuilt vim (for X and Ruby support) and Freetype (for subpixel and cleartype rendering), as well as installed Wine and some other programs from SlackBuilds.org. No probems so far.
Last edited by dugan; 12-25-2013 at 12:48 AM.
|
|
|
12-25-2013, 05:43 PM
|
#13
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,352
|
x264 from SBo didn't build with CLang. Building x264 with gcc and then building FFMPEG against it, with clang, didn't seem to be a problem.
Then I tried to build mpd against FFMPEG, with clang, and it failed. So I built it with gcc.
As most things build with clang and those that don't can be built with gcc on a case-by-case basis, I'm going to leave clang as my default compilers.
Last edited by dugan; 12-25-2013 at 06:00 PM.
|
|
|
12-26-2013, 04:01 AM
|
#14
|
LQ Guru
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,564
|
LLVM/Clang will probably end up replacing a majority of GCC's usage, but it won't replace it for everything outright. It still needs a deal of work, and GCC is still being developed as well, so realistically both will probably be in heavy and equal usage for a while to come.
|
|
|
All times are GMT -5. The time now is 12:45 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|