Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×

Should You Pre-Compile Binaries or Roll Your Own? 301

Jane Walker writes "The completion of pre-compiled packages and maximizing machine performance are two powerful incentives for Windows admins to use Linux and compile an OSS package." TechTarget has an article taking a look at some of the "why" behind rolling your own. What preferences have other Slashdot users developed, and why?
This discussion has been archived. No new comments can be posted.

Should You Pre-Compile Binaries or Roll Your Own?

Comments Filter:
  • Eh? (Score:5, Insightful)

    by kassemi ( 872456 ) on Tuesday March 14, 2006 @05:21PM (#14919200) Homepage

    Was I the only one who found that this article didn't really shed too much light on whether or not you should compile your software from source?

    By the way, I know the benefits of compiling from source, but how this made slashdot, I don't know.

  • Advantages to both (Score:5, Insightful)

    by EggyToast ( 858951 ) on Tuesday March 14, 2006 @05:21PM (#14919209) Homepage
    Sure, compiling your own sometimes results in a more efficient binary, but it's also a great way to make sure you have all the dependencies for whatever you're installing.

    Conversely, if programmers sufficiently document their binaries, that's not as much of a problem. URLs for other binaries, or instructions for checking/compiling dependencies, can speed up that process.

    Of course, binaries are a huge advantage to non-experts and beginners, who just want a program to be there. They don't care about maximizing efficiency, they care about getting their work/fun done.

    So really, it entirely depends on the application. For programs that are typically for the hardcore programmer/user crowd, source-only makes sense -- those people who use the program are going to know how to compile and check everything already. But for programs like, say, a CD burning program? I definitely think both should be provided, and installation for both should be well documented. Given how easy it is to provide a binary, even if it's "fat," there's no reason why a more popular program can't provide both versions.

  • by Sensible Clod ( 771142 ) on Tuesday March 14, 2006 @05:22PM (#14919215) Homepage
    it depends.

    If the time required to compile (plus trouble) is less than the time/trouble saved through performance gains (assuming you actually compile it correctly to get said gains), then compile. Else download and install.

    But then again, if you just have a lot of time on your hands, it doesn't really matter what you do.

  • TEN PERCENT! (Score:5, Insightful)

    by LeonGeeste ( 917243 ) on Tuesday March 14, 2006 @05:25PM (#14919238) Journal
    In my field, ten percent is everything. If I could increase performance by ten percent, I'd get a 100% bonus for the year. My servers need to handle so much data and are always backlogged (and adding more on is exensive!) Don't trivialize ten percent.
  • by vlad_petric ( 94134 ) on Tuesday March 14, 2006 @05:27PM (#14919261) Homepage
    It's true that gcc can generate P4-specific code, for instance, but in most cases and with generic compilation flags this will barely make a difference. I am personally not aware of a single mainstream linux app that does 5% better when optimized for P4 as opposed to generic 386 (I'm not including here apps that have hand-crafted assembly for a couple of instruction-set architectures, like, say, mplayer). I guess things might change slightly with gcc 4.* which has automatic vectorization, but in my experience automatically-vectorizable C code is very rare, unless written specifically that way.
  • by eno2001 ( 527078 ) on Tuesday March 14, 2006 @05:32PM (#14919302) Homepage Journal
    Up until this past year I've been a big fan of using a very stripped down Redhat (then later Fedora) distro and doing my own custom compilations of things like OpenSSL, Apache, OpenSSH, DHCPD, BIND, Courier, MySQL, PHP, XFree86 and X.org, and of course the Kernel itself. The main reason? It "just works". When I originally started using Linux and used RPMs I was very annoyed with them. I think RPM sucks. I also think BSD ports suck too. I don't like using stuff on my machine that I didn't massage first. That's just the way I am.

    A co-worker introduced me to Gentoo late last year and I have to say I am very impressed. It's much faster than the optimizations I was using. Of course I didn't compile everything in RedHat or Fedora by hand. That's why Gentoo really rocks. You CAN hand compile everything from the ground up! I also used to use Linux From Scratch. And YES, I do use this stuff on production machines. You just can't get any better performance or security by doing it all yourself. The only reason to use package managers is if you are new to Linux or just don't want to learn much. But if you don't dig in, then you're at risk of thinking that something in your installation is broken, when it's not. I've seen many people throw up their hands saying, "I have to re-install my Linux box dammit!" when all they really needed to do was fix a symlink, edit a config file or downgrade something for compatibility reasons.

    For example, on a laptop at home I decided I wanted to use the Xdmx server from X.org, so I hand compiled X.org. After that, I kept having this problem where the acpid (tracks the laptop's battery life among other things) daemon wasn't starting and would produce an error message whenever I logged into Gnome. I dug around on the net for quite a while and finally found out that the version of X.org (a devel version, not a stable version) grabs ACPI if you are using the RedHat graphical boot screen. The fix? Stop the RHGB from running by removing the RHGB kernel option. I think a lot of people would have assumed they hosed their installation and reinstalled if that problem really bothered them. It's not hard to find solutions to most problems in Linux no matter how obscure. That's why only knowing how to use pre-compiled binaries is a detriment if you're serious about using Linux.
  • deployment? (Score:5, Insightful)

    by TheCarp ( 96830 ) * <sjc@NospAM.carpanet.net> on Tuesday March 14, 2006 @05:39PM (#14919359) Homepage
    Do these guys even know what deplpoyment means?

    They are not only wrong in their conclusion, but the article barely scratches the surface of the question.

    Put simply, compiling software on your own is fine for a one off, or your desktop, or your hobby machine.ou.. or if you either a) need the latest wizbang features (and maybe can put up with the latest gobang bugs) or b) need really specific version control or c) can't find a precompiled package with the right ompile time options set.

    Other than that, you should pretty much always use pre-built.

    Sure, you can build your entire system from scratch if you like, libc on up. Why? The performance increase will be so minor that you will have to run benchmarks if you even want to be able to tell there was a change. You will then have to recompile everything you ever decide to update.

    This strategy is a nightmare as the systems get more diverse and complex.

    it also has nothing to do with deployment. Deployment is what you do after you have decided what you want and made it work once. Deployment is when you go and put it on some number of machines to do real work.

    I would love to see them talk more about the differences in deployment. With precompiled packages from the os vendor, ala debian or redhat, its easy. You use apt-get or rpm and off you go. Maybe you even have a redhat network satalite or a local apt repository to give yourself more control. Then you can easily inject local packages or control the stream (no, sorry, I am NOT ready to upgrade to the new release)

    but should you compile "most of the time"? hell no!

    It is, in fact, the vast minority of software where you really need the latest features and or special compile options. Its the vast minority of the time where the performance increase will even be perceptable.

    Why waste the time and cpu cycles? Takes over a day to get a full gentoo desktop going, and for what? I can have ubuntu installed and ready to go with a full desktop in maybe 2 hours.

    Lets take the common scenario.... new openssl remote root exploit comes out. The email you read just basically said, in no uncertain terms, that half your network is now just waiting to be rooted by the next script kiddie who notices. Thats lets say... 50 machines.

    Now your job is to deploy a new openssl to all these machines.

    You could notice that the vulnerability came out in such a time frame that they allowed the OS vendors like debian to release fixes (often happens, if not they are usually out within a very reasonable time frame)... so you hit apt-get update && apt-get upgrade

    or maybe you just promote the packgae into your repository, and let the automated updates deploy it for you. You go home, have a coffee, and be ready to log in remotly if anything goes tits up.

    Now if you are hand compiling what do you do? Compile, test. And then um.... ahh... scp the dir to 49 machines and ssh in and do a make install on each?

    How is this better than using a package manager again? Now you ahve dirs sitting around, you have to hope that your compile box is sufficiently similar to the other boxes that you didn't just add a library requirement (say because configure found that yoru dev box has libfuckmyshit.so installed and this neat new bits of openssl can make use of it)

    How about when a box crashes and burns and you now need to take your lovingly handcrafted box, and rebuild it, and put all that lovingly compiles software back on it.

    Fuck all that... give me a good binary distro any day of the week. I will hand compile when I HAVE to... and not before.

    -Steve
  • by Todd Knarr ( 15451 ) on Tuesday March 14, 2006 @05:43PM (#14919399) Homepage

    If you're compiling your own for performance reasons, don't bother. There's a few packages that can benefit from being compiled for specific hardware, the kernel and libc, for example, and things like math libraries that can use special instructions when compiled for specific hardware. For the most part, though, your apps aren't going to be limited by the instruction set, they'll be limited by things like graphics and disk I/O performance and available memory. IMHO if you're trying to squeeze the last 1% of performance out of a system, you probably should look at whether you need to just throw more hardware horsepower at the problem.

    The big benefits and drawbacks of custom-compiled vs. pre-built packages is in the dependencies. Pre-built packages don't require you to install development packages, compilers and all the cruft that goes along with a development environment. You can slap those packages in and go with a lot less installation, and you can be sure they're built with a reasonable selection of features. On the other hand, those pre-built packages come with dependencies. When you install a pre-built package you pretty much have to have the versions of all the libraries and other software it depends on. By contrast, when you compile your own packages they'll build against the versions of other software you already have, using all the same compiler options, and they'll probably auto-configure to not use stuff you don't have installed. This leads to a more consistent set of binaries, fewer situations where you need multiple versions of other packages installed (eg. having to install Python 2.3 for package X alongside Python 2.4 for package Y) and overall a cleaner package tree.

    Where the cut-off is depends on your situation. If there's only a few instances of dependency cruft, it may not be an issue. If you have a lot of dueling dependencies, it may be worth while to recompile to reduce the number of different versions of stuff you need. If you've got externally-dictated constraints (eg. only one version of OpenSSL is approved for your systems and everything must use it or not use SSL at all) then you may have no choice but to compile your own if you can't find a pre-built package that was built against the appropriate versions of libraries.

  • The article missed an aspect of the hardware issue. Got the part about rolling your own to optimize for your dual core Pentium 4 rather than using a binary compiled for a 486, but not the part about getting it work on totally different hardware, such as an Alpha or PowerPC.

    Another missed point is it's usually easier for the developers and hardware vendors. Easier to distribute source code than maintain dozens of binaries. Just another advantage of open source. Many projects have a few binaries for the most popular platforms, and source code for those who want to use something less common.

    Latest version and leading edge. I've been trying Gentoo. In most cases the extra performance isn't much, and isn't worth the hassle. And Gentoo defeats one of the attractions of roll your own: the leading edge. There is always a lag between when a project releases a new version, and a distributor can get around to turning the new version into a new package. Article didn't mention that aspect either. If your distro is slow, you can bypass them and go straight to the source, or, if available, the source's binaries. Ubuntu Linux 5.10, for instance, is still stuck on Firefox 1.0.7. I'm not talking about checking out the very latest CVS source tree, just the latest release.

  • by TheCarp ( 96830 ) * <sjc@NospAM.carpanet.net> on Tuesday March 14, 2006 @05:57PM (#14919560) Homepage
    Don't apologize, you hit the nail on the head.

    You learn not to.

    Yes, there are times when a source based distro is good. There are times when you NEED the level of control that it gives you.

    Most jobs, in most environments don't. In fact, most sysadmins that I have seen just don't have the resources to exert that much control, or put that much love and care into every system.... nor should they.

    I have said before, in specific cases (research computing clusters where you essentially have 3 machines, one of which is copied n times as "nodes" that can be reimaged from a new image pretty much at will - is the one case where I have really seen it used to good effect) source based distros are great. Of for your hobby machine, or you r laptop.

    As soon as you start talking less about "running linux" and more about "deploying services", the focus shifts. Source based distros are a management nightmare in any manner of large or hetrogeneous environment.

    Frankly, the majority of systems that I have had responsibility for havn't even had a compiler on them, never mind a full blown development environment, usually not even library headers.

    Why? Because we don't want admins compiling code on just any box and tossing it in place. So, why make it easy for them to do so? Nothing should EVER EVER EVER be compiled on the production mail server, or the web server.... it should be compiled on the compiler machine, the dev box.

    When you start making distinctions between the roles of boxes like that, as you should do in any larger environment, then you start to see the benefits of a source based distro melt away, and the real power of package management come into full effect.

    Most linux users, the home user, will never see this. I know I didn't understand it until I had been doing it for a living for a few years.

    -Steve
  • by Raphael ( 18701 ) on Tuesday March 14, 2006 @06:13PM (#14919689) Homepage Journal
    You just can't get any better performance or security by doing it all yourself.

    The performance can be debated, but you have got the security argument backwards. If you use pre-packaged binaries, you can get security updates quickly and automatically because any responsible Linux distributor will provide updated packages in a timely manner. This is especially useful if you maintain a large number of machines and want to make sure that the latest security patches are quickly applied to all of them.

    On the other hand, compiling your own software requires you to pay attention to all security announcements and apply the security patches yourself. It may be possible to automate that to some extent (e.g., Gentoo provides some help for security patches), but not as easily as with the pre-packaged binaries.

    From a security point of view, I am glad that some others are doing most of the work for me. The issue of performance can be debated because there are many pros and cons, but security is usually better for the pre-packaged binaries. Note that I am talking about security from the point of view of applying the latest security patches and staying ahead of the script kiddies, not in terms of initial configuration of the system. And by the way, I am not against compiling software on my own because I compile several packages from sources (directly from cvs or svn, especially for the stuff that I contribute to). But then I am aware that the security may actually be weaker for those packages than for the ones that I can update automatically.

  • by jimicus ( 737525 ) on Tuesday March 14, 2006 @06:19PM (#14919736)
    I use Gentoo - and I even use it on production servers.

    However, I don't consider performance to be a particularly big benefit. Once you've got gcc doing it's basic -O3 or whatever, anything else is marginal at best.

    There are, however, two things I get out of it which are useful to me. These should not be ignored:

    • Choose compilation options. Most packages have a number of options available at compile time. Generally with pre-compiled packages, you either get every single option compiled in OR you get "whatever options ${VENDOR} thinks are most appropriate". Gentoo provides flags as an intrinsic part of portage which allow you to specify which options are compiled in.
    • A vast number of regularly updated packages. Put simply, I can emerge almost anything, whereas every other distribution I've used, sooner or later I come across a package I need which doesn't have an RPM or what have you, and I have to build my own complete with the dependency hell that can entail.


    Of course, there are drawbacks:

    • Many commercial non-F/OSS packages aren't available as ebuilds and their installers get confused with Gentoo's creative filesystem layout, which is not entirely LSB-compliant in places (particularly /etc/rcX.d).
    • Gentoo packages are declared "stable" more-or-less by fiat rather than by extensive regression testing, and it's not unknown for an upgrade to completely break things without having the good grace to announce it first. This isn't necessarily a problem if you test everything before you go live and you have contingencies in place - which you should be doing anyway. But it can be annoying.


    I guess it's just a case of "know the tool you're using".
  • by Anonymous Coward on Tuesday March 14, 2006 @06:28PM (#14919834)
    I tried it. A fully-compiled-from-scratch gentoo box (oh jesus what a goddamn pain in the ass that was) gave me about 2-4% faster performance on a large build (lots of sh + javac). Whoopee. Totally not even close to being worth the DAYS it took me to set up. Maybe it's worth it to some people, but chances are that if your software running 3% faster is worth days of your time, you've already optimized it out the wazoo.

    And it's been posted before, but http://funroll-loops.org./ [funroll-loops.org.]

    ps: you can make Debian do the same thing, you just don't have the USE flags.
  • by ThinkFr33ly ( 902481 ) on Tuesday March 14, 2006 @06:33PM (#14919873)
    ...is that you get the benefit of the optimization that can only occur when compiling for a specific machine without actually needing to do the work yourself.

    In platforms like .NET and Java the IL/byte code is JIT'ed before execution and can have these machine-specific optimizations inserted.

    No need to break out gcc or try and resolve dependencies. Ahh... I loved the managed world. :)
  • Comment removed (Score:5, Insightful)

    by account_deleted ( 4530225 ) on Tuesday March 14, 2006 @06:47PM (#14919981)
    Comment removed based on user account deletion
  • Re:Gentoo? (Score:1, Insightful)

    by Anonymous Coward on Tuesday March 14, 2006 @07:01PM (#14920102)
    Disclaimer: I'm a very happy Gentoo user.

    Well, you have some very strong points against Gentoo. Also, you're right on all accounts. But there are some remarks here.

    First of all, it's not that big of a speedup, quite honestly, I use Gentoo because I just really like the way it works. I get more done with less. It's not the build-from-source part that I like, it's just the entire system as a whole, I love using it.

    Second of all, those USE flags, they need some upstream support to build in or strip out features. Fortunately, there are a bunch of packages that support this. Some USE flags for example do some work in Apache to enable or disable features, that does help. Same thing goes for PHP.

    The etc-update feature of Gentoo does help a lot. It allows for upgrading to packages to keep up with new features. For example, Shorewall recently got upgraded in Portage. This changed a bunch of the config files. I suppose Debian has some post install script in place to fix that. Though I tend to not look at an update all the time. This way, I get the updated configs later.

    I suppose a postinstall script works fine with a binary package, short install time. But the etc-update works better for Gentoo, longer install time.

    The definite speed advantages of Gentoo are arguable, but that's not always the reason for the switch.

    On a different note. I'm glad to say that my parents are happy Ubuntu users.

    A Linux distro should fit your personal needs. I like Gentoo as my parents are just content with Ubuntu. But that's what FOSS is about, having a choice.
  • Re:Gentoo? (Score:2, Insightful)

    by TheRealMindChild ( 743925 ) on Tuesday March 14, 2006 @07:13PM (#14920208) Homepage Journal
    Obviously, not everyone [gentoo.org] agrees with you...
  • by kahunak ( 40974 ) on Tuesday March 14, 2006 @07:28PM (#14920331)
    When I started using Linux I started with an old Slackware, some time later I started to compile everything myself and test different gcc options, and even patched some programs to use a devfs only system. About two years ago I decided that I have nor the time neither the will to keep doing it, I switched to debian unstable, as I was used to be always on the edge. Now I run debian stable in every machine, the server, the desktop and the notebook. I have compiled, adjusting by hand every option, some packages like wine and mencoder, but just because I use both to heavy filter and encode The Simpsons from DVB-T everyday and it take about 10 hours to complete the job, so every little percent is important. Everything else doesn't need such hard tuning.

    Just compile speed-critical programs yourself and get everything else from a stable distribution.
  • Look, when I download a piece of software, I want to click "install", and start using it.
    Why bother with the former? You want to click "install," and not just skip to the "using" part?
  • Re:Gentoo? (Score:2, Insightful)

    by dickko ( 610386 ) on Tuesday March 14, 2006 @08:31PM (#14920757)
    Well, since you compile the compiler as well as everything else.
    It does accumulate...


    Does a custom-compiled compiler create different binaries to a pre-packaged compiler? I was under the impression that it might compile the application faster, but the resulting linked-up, ready-to-run binary is no different. So "it does accumulate" doesn't add up to me...

    Just nit-picking, sorry...
  • by martinde ( 137088 ) on Tuesday March 14, 2006 @08:59PM (#14920922) Homepage
    (Full disclosure, I've been using Debian since 1996. I'm backporting packages to stable as I write this, so I'm definitely not coming from a "one size fits all" perspective.)

    If there is one thing that appeals to me about Gentoo (as I understand it), it's the concept of meta-configuration at build time. Unfortunately, lots of options in packages get configured at BUILD TIME, so either the binary packages have those options on, or they don't. When this is the case, if the distro doesn't provide multiple binary packages with all of the useful configurations, then you end up having to build from source. (IMO, building from source means compiling from source packages whenever possible.)

    So I like the concept of saying in one place, "build for KDE", "build with ssl support", "build with ldap support", etc. Maybe someday everything will be runtime configurable, but until that day, I'll be wishing for that meta-level of configuration...

    Having said all of that, check out apt-source, apt-build, and their ilk if you're interested in "Debian from source". Debian binary packages solve about 97% of my problems so I'm not usually looking for "make world" kind of functionality.

    Enough rambling for now.
  • by Anonymous Coward on Wednesday March 15, 2006 @12:00AM (#14921723)
    The way DFSG guidelines have effected package repositories has notably been unfortunate

    Unfortunate for people who don't care about freedom -- but if that's the case, why aren't you using Red Hat or SUSE?
  • by Anonymous Coward on Wednesday March 15, 2006 @12:32AM (#14921888)
    What distro ships OpenSSL with no optimizations period? Bogus argument++
  • Re:Gentoo? (Score:2, Insightful)

    by littlem ( 807099 ) on Wednesday March 15, 2006 @07:44AM (#14923025)
    Well, since you compile the compiler as well as everything else. It does accumulate...
    That's hilarious - because you've compiled gcc with "optimized" use flags or whatever, thus making gcc 0.0001% faster, that means you can save literally microseconds every day of your Gentoo life, as gcc is constantly running, compiling all the other stuff that would run 0.0001% faster if the CPU wasn't constantly spending all its cycles running gcc... madness.

Solutions are obvious if one only has the optical power to observe them over the horizon. -- K.A. Arsdall

Working...