compile source or use binaries? what are the advantages?

Discussion in 'Mac Apps and Mac App Store' started by cb911, Apr 16, 2004.

  1. cb911 macrumors 601


    Mar 12, 2002
    BrisVegas, Australia
    well i just came accross Jahshaka, an Open Source video, sound editing, effects, compositing do-it-all app.

    well they're got the source available, as well as binaries. i've found myself in this situation a few times, wondering whether to use the source or binaries.

    so what's the advantage of using the source and compiling? when i compile it on my PB, will it be optimized for the G4? or do i have to specify the necessary flags for it to be optimized?:confused:

    well if someone could explain when the proper time to compile the source or use the binary instead, that'd be great.
  2. Krizoitz macrumors 65816


    Apr 26, 2003
    Tokyo, Japan
    Unless you plan on doing any changing of the code yourself I'd just stick with the precompiled binaries. It'll save you time. Compiling takes awhile, especially for an app that big.
  3. cb911 thread starter macrumors 601


    Mar 12, 2002
    BrisVegas, Australia
    so you'd only really want the code if you're going to change it?

    what about compiling with optimizations? are there any ways to futher optimize the code for use with a G4, or Alti-Vec for example?
  4. Nermal Moderator


    Staff Member

    Dec 7, 2002
    New Zealand
    Considering that a few months ago you sent me a PM asking how to use Terminal, I think you should avoid trying to compile source :eek:

    Sorry for any embarrassment ;)
  5. cb911 thread starter macrumors 601


    Mar 12, 2002
    BrisVegas, Australia
    well... there's no better way to learn.

    a few months ago i'd never touched any OS other than Windows and OS X. now i've got Gentoo working on my PB. :)

    so what are the advantages of compiling the code? are there any optimizations that can be had? or isnt' there any other reason in providing the code other than allowing people to change it? if someone can just explain that to me, then i'll be able to decide if i want to learn how to do. :)

    and also, the all come with readme's and the install file, so it shouldnt' be that hard. :D

    also, jumping in the deep end is the best way (for me at least) to learn something like this.

    oh, don't worry about the embarassment. considering we're both practically in Oz. well, almost...
  6. bhertz macrumors member

    Jan 29, 2004
    Columbus, Ohio
    Im not an expert in this area but...

    If they offer a OS X binary then they compiled it using a OS X compiler. You could compile but the odds are the developer would know more about compiling and they would have already tried to optimize the app for you. What I would do since you have already shown interest is just try both- its alway the best way to learn.

    let us know what you find out :)
  7. Rincewind42 macrumors 6502a


    Mar 3, 2003
    Orlando, FL
    If they provide a Mac binary, then my first instinct would be to just use it. But if you want to try to compile it yourself, then there are many stages to doing this.

    You can simply take the source as is and compile it. Usually source distributions come with a build script that will do all the work and configuration depending on what machine you have (generally in very vague terms). If you want, you can go into the script and alter the commands they give the compiler, which may produce a better binary for your system.

    Next step is that you can actually consider editing the code to see if there are any optimizations you can make. This can take a LOOOONG time, as you really shouldn't be modifying the code unless you actually understand how it works. And getting that understanding can be quick or it can be slow, depending both on the original author(s) and on your own uptake with programming.

    After you've decided that you want to modify the source, the next step is actually adding new functionality. This is arguably the most complicated steps because it means that you have to figure out how your new functionality fits in their application. This stage often also involves optimizations (like adding Altivec or using a system provided framework like Accelerate) that change the flow of the program on a possibly dramatic level. You can get a lot of win here, but you not only have to understand where things go in the program, but how things work and what assumptions the authors made. This can be the most challenging way to modify a program which you didn't write.

    I don't want to discourage you, but if you haven't done at least a semi-serious project, then doing anything beyond changing some settings in the build script can be an arduous process where you end up trying to make your changes work more often than you actually use your program, and it is very easy to get discouraged.
  8. Westside guy macrumors 603

    Westside guy

    Oct 15, 2003
    The soggy side of the Pacific NW
    I doubt there's much benefit under OS X since it's homogeneous from box to box. If you're running Linux (you mentioned Gentoo), then a lot of times compiling from source is the only way to get an app working on your system. Each distro tends to handle libraries somewhat differently; uses a slightly different organization for stuff in /etc; and so on - so you can't count on a given binary working for YOUR system unless the binary is specifically listed as being for your particular distribution and version.

    I ended up compiling a lot of apps (or, to be accurate, rebuilding rpms from source) for my Fedora neé Red Hat box, since some libraries would change from version to version. If you could only find a RH8 rpm package it wouldn't necessarilly work on RH9 or Fedora.
  9. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    What no one has yet mentioned is that the source code may have various dependencies on other pieces of software or libraries that you may not have. These would have to be found, download, installed to get a compile to work properly.

    Plus you aren't going to really "learn" anything by simply compiling software, other than how to type a few commands that execute a custom-tailored makefile. After that the process is largely automatic (provided you have all the required software).

    Most compiling consists of typing:



    make install

    And that is about it. It's only when you run into problems do you get into the nitty-gritty of dependencies and headers and libraries and such. Running configure programs generate the makefiles that are tailored to your particular OS versions and sometimes hardware.

    I get the impression that you believe compiling yourself will somehow boost performance, again unless you know all of the details about using gcc and editing the makefile you are not going to increase performance 30% versus a pre-made binary (unless whomever made the binary had no clue how make Mac software or used an old version of OS X to build the binary).

    If you want to learn, install X11 software and download sources to some smaller software for X11 and try building them and running them. Starting with a massive project won't help as much as frustrate.
  10. cb911 thread starter macrumors 601


    Mar 12, 2002
    BrisVegas, Australia
    well thanks for the info everyone.

    the most i was thinking of doing was customizing the makefile, but i guess i'll just use the binary.

    actually, i might try both, i'll get the binary and then i might get the source and have a look at the makefile as well.

    i will also have a look at some smaller software for X11, well whenever i get the time that is. :rolleyes:

    the worst part is that you've got to keep using your newly learnt skill or you lose them, which is the biggeset problem for me.

Share This Page