Ryan Gordon Wants To Bring Universal Binaries To Linux
wisesifu writes "One of the interesting features of Mac OS X is its 'universal binaries' feature that allows a single binary file to run natively on both PowerPC and Intel x86 platforms. While this comes at a cost of a larger binary file, it's convenient on the end-user and on software vendors for distributing their applications. While Linux has lacked such support for fat binaries, Ryan Gordon has decided this should be changed."
after the diminse of NeXTStep!
(c)Innovation!!(tm)(R)
Could this technology also help binaries to link against multiple versions of standard libraries (glibc, libstdc++)?
If you have access to the source, you can always compile a version for your platform. The 'fat binary' principle is only useful for non-free applications, where the end-user can't compile the application himself and has to use the binary provided by the vendor.
Since most apps for Linux are free and the source is available, this feature isn't as useful as it is on the Mac. Not that it shouldn't be created, but it makes sense to me why it took a while before someone started developing this for Linux.
Pretty good is actually pretty bad.
Some people may claim that Linux may have some shortcomings but certainly the way that distributions handle support for multiple platforms and also the availability of binaries targeted at a certain platform surely isn't one of them. Linux already runs on a long list of platforms and software distributions already handle themselves quite nicely by building platform-specific packages, which also include all sorts of platform-specific binaries the applications will ever need. So, besides the empty "but Apple has them" rational, exactly what drives the need for universal binaries on linux?
Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
We don't need the universal binary, so much as we need the "1-file install" idea that MacOS has. This would greatly simplify installing a standalone application.
For those of you who don't know, if you download an app for MacOSX (say, Firefox) you are presented with one icon to drag into your "Applications" folder. This is really a payload, a "Firefox.app" directory that contains the program and its [static?] libraries. But to the user, you have dragged a single "file" or "app" into your "Applications" folder - thus, installing it.
It's dead simple. We need something like this in Linux.
Sofwtare vendors? This only makes life easier for _closed source_ software makers. For everyone else this is a solution looking for a problem as package management and repositories don't really have a problem with different arches and versions.
I'm not saying this is useless (people do want to run closed source software), but the kernel, glibc and other patches better be good and non-invasive if this guy wants them to land...
Most package manager can automatically create a binary package out of a source package. In many cases this resolves even problems with otherwise incompatible libraries. So for whom is such a fat binary advantageous? I'd assume mostly for closed source vendors. I have nothing against closed source in general, but if I pay for a software I expect at least a minimum of support. Such a fat binary does not look too userfriendly for me. Even if I can strip it down to my architecture. I suppose it does not solve the problems of incompatible libraries. I will follow the responses to this article, maybe I overlook someting and I will be convinced otherwise, but at the moment I would say: Superfluous.
Apple is still using it for x86/x86_64 fat binaries in Snow Leopard.
Read the fine website:
No, Apple didn't drop support for Universal Binaries. Most apps available for Mac today are universal binaries and work on PPC or Intel macs, and in some cases support PPC 32, PPC 64, Intel 32 and Intel 64. Just because a new OS doesn't support an older CPU architecture doesn't mean the functionality for Universal or "Fat" binaries is not supported.
What is...?
you know, just trick the good ol' .DEB package format to include several archs, then let to dpkg decide wich binaries to extract.
is not that in linux the binaries are one big blob with binaries, libs, images, videos, heplfiles, etc. all ditributed in as a single "file" which is actualy a directory with metadata that the finder hides as being a "program file".
being able to copy a binary ELF from one box to another doesn't guarantee it'll work, specially if it's GUI apps that may require other support files, so fat binaries in linux would be simply a useless gimmick. either distribute fat .DEBs, or just do the Right Thing(tm): distribute the source.
What ? Me, worry ?
To a first approximation, the size of the binary will increase in proportion to the number of architectures supported.
This is something you might decide to ignore if you are only supporting two architectures. Debian Lenny supports twelve architectures, and I've lost count of how many the Linux kernel itself has been ported to. I really don't think this idea makes sense.
(Besides, what's wrong with simply shipping two or more binaries in the same package or tarball?)
You are confusing NeXT and Apple's approaches, I think. Apple puts both all of the different architectures in the same file. Your code is compiled twice, but it's only linked once. The PowerPC {32,64} and x86 {32,64} code all goes in different segments in the binary, but data is shared between all of them, so it takes less space than having 2-4 independent binary files. To support this on Linux would not require any changes to the kernel, only to the loader (which is a GNU project, and not actually part of Linux).
I am TheRaven on Soylent News
OS X' universal applications are ONE SINGLE application, but the executable file itself inside the app - and there is only ONE executable, not two or more - contains code for all architectures. Let me repeat: ONE executable file with all architectures, not several executables. So you're wrong. It's a quite smart solution.
That said, OS X' universal files are pretty much on their way out, as Snow Leopard (10.6) doesn't play ball with PPC. As time goes on and people realize that x86 is a dead horse running, we might however see universal executables again, but then as ARM and x86.
It's also theoretically possible to include ARM support too, to make a binary that would also run on an iphone...
http://spamdecoy.net - free throwaway anonymous email - avoid spam!
This isn't a particularly bad idea and community-driven distros (or maybe the community of community-driven distros) like Ubuntu would probably benefit from it quite significantly. You can even strip unnecessary binary portions out of most programs (at least with the mach-o binary format), although it would really only effect disk usage. With the disk capacities today, it's really negligible disk-usage savings anyway.
In terms of the Linux kernel, this would mean a major overhaul for a large portion of the kernel and I can't see it being adopted very widely outside of the Desktop market.
That said, OS X' universal files are pretty much on their way out, as Snow Leopard (10.6) doesn't play ball with PPC. As time goes on and people realize that x86 is a dead horse running, we might however see universal executables again, but then as ARM and x86.
on mac it seems x86 is already a dead horse, snow leopard still uses universal binaries, they contain 32 and 64 bit code, rather than x86 and powerpc code that leopard had. some apps now contain up to 4 versions of the code, x86, x86_64, powerpc-32, powerpc-64
I'm already amazed we have a universal x86 binary. With the architectural differences between an Atom and a Core7 or 9... I dare not think of all the inefficiencies this creates.
Wouldn't it be better to shoot for a Universal Source, with the install step integrating a compile+link step ? I know Gentoo does this, but Gentoo is marginal within the marginality that is Linux, on the desktop.
I'm amazed you can do real-time x86 emulation on non-x86 CPUs, but still can"t have a Universal Source.
The Cloud - because you don't care if your apps and data are up in the air.
Hmmm, yet another unnecessary, incompatible, redundant archive format requiring yet more tools and libraries to deal with.
What's wrong with putting whatever flavor of binary you want in a tar.gz archive, zip archive or folder and have the system smart enough to pick the right one (using the existing, standard file id's and tools) when you execute the archive or folder? Yes, I realize the system needs to map pages while executing but for archives that is trivially dealt with by extracting before executing.
The amount of fuzzy, shallow, magical thinking that happens with software is just amazing. Please, if you insist on recreating the wheel at least have the good sense to think about what you are doing and stop assuming that giving something a new name necessitates creating an entire new software infrastructure that will unnecessarily create complexity and problems for large numbers of people.
---
For the copyright bargain to be valid all DRM'ed works should lose copyright.
As somebody pointed out, this does not scale. In the end, if somebody is really wanting multiple systems, then they can simple create a dvd with multiple types on it. There is another solution though. Back in the late 80's/early 90's, the unix world was concerned about how a companies could create binaries for multiple systems. The best solution, though not implemented, was to compile to a universal binary, and then trans-compile this to a different arch. In light of all the work that has taken place on Java and now parrot, it may make far more sense to do that. With that approach, it would be possible to have various compilers go to a single arch, and then create a new back-end on compilers to take it to various archs.
I prefer the "u" in honour as it seems to be missing these days.
It never really flew.
If someone wants to do this then something like Java would be good enough for many types of software. There will always be some things for which a binary tied to the specific target is all that would work; I think that it would be better to adopt something that works for most software rather than trying to achieve 100%.
People have been asking for a universal binary or some sort of Universal Package Manager (UPM, that could work) for linux for ages. I think the main reason why there isn't one yet is the FLOSS nature of Linux. When the source code is open, there is no need for one single binary, it's up to the distro (or user) to make it into an fitting binary package. For that reason I think it wont change much if there was one single Binary. Also I've always thought that more applications should just use .bin files, compatible for all.
Princess Leia: The more you tighten your grip, Tarkin, the more star systems will slip through your fingers
My initial thought was that this was insane -- Linux software should only be distributed as source and compiled on the target. Then I actually read the material and realized we were talking about distribution binary Linux installers. Since those pretty much have to be compiled before loading on the target, a multi-platform binary seems to make perfect sense in this context.
However, I noticed that Snow Leopard doesn't install Rosetta by default. At least this was so when I updated my work Macbook last week.
Seems a bit silly, since the installer claimed Rosetta took up only about 1.5MB of disk space.
Hail Eris, full of mischief...
E pluribus sanguinem
Not to mention the greater ease for potential malware to work. Right now Linux is an extremely unfriendly and hostile environment for such malware. Why do we need to change that?
-- This
Wouldn't surprise me if this is to encourage users to demand a native x86 version of software - once every significant application exists as x86 binaries, Apple can drop support for Rosetta altogether and that's another developer or two freed up to work on furthering their products rather than backward compatibility.
There may be more which should be included...
So... x86-64, x86, PowerPC, SPARC, MIPS, ARM, z10, m88k
How big are *your* binaries?
Deleted
from what I gather he's not talking about system lib but application-specific trees. So for the majority of us using 64bit systems in a mixed world, only from those developers who chose to use FatELF would we derive any benefit. Even then the vast majority of dependant libs would still be required. And the compat libs. Skype anyone?
Over time it might prove beneficial. But over time the status quo will become 64bit. To me its a wash. Especially since I've experienced some times, admittedly fairly rare in the major repositories, but nonetheless times when a misbehaving application is pulled or broken in x86_64 but not i386 and I've been able to temporarily run the 32bit version. Since FatELF would, apparently, take that power away from me and defer it to systems-magic, well, as the shark's say; "for that reason, I'm out".
This is cool and everything, but I'd rather Ryan spent the time on whatever it takes to get Linux Unreal 3 published.
Apple does that. when 10.3 came out apple stopped installing OS 9 classic by default as well. Support backwards compatibility for 2-3 generations and then phase it out. First phase is simply not installing it by default. Second phase is not to supply it. Snow leopard is the 3rd generation of OS after Rosetta came out. installed by default in tiger, and Leopard, they stopped installing it by default for 10.6.
personally I wish MSFT would do the same thing. I get really pissed when my "new application" requires the same installer that win95 had, and in order to run it I have to reboot into safe mode as my antivirus won't let it run. Seriously why does an Application built in 2009 still require the win16 subsystem to run? Why aren't the coders moveing onto new toolkits? Apple nudges and then pushes programers forward. MSFT let's them stay in the previous century and use bare metal knife switches to turn on the lights.
i thought once I was found, but it was only a dream.
they contain 32 and 64 bit code
that's x86_32 and x86_64, although 32 bit x86 is apparently also soon to be a dead horse on mac (only the rev A intel macs can't handle it - they're 4 years old, so by 10.8-10.9 they will probably be dropped from the main support list, too), what AC means is that Apple will probably go with ARM more and more once they have a chip that compares to the current intel offerings and do 64 bit - for now I kinda doubt it, but some people like to predict things, like an apple tablet since the newton died.
They already have, to a degree. In Snow Leopard, you have to choose to specifically install Rosetta. If you don't, you can't run PPC programs.
If you try, OS X will prompt you to install Rosetta (which it will do at the press of a button), but it's not there any more by default.
Comment forecast: Bits of genius surrounded by a sea of mediocrity.
Now why would I want to do anything that fucktarded, when I can just use the source?
And if I needed cross-platform that badly, I can always ship ONE java app with ONE instance of data.
The '90s called, they want their obsolete fat and universal binaries back.
What's the big benefit again? Instead of the package manager making the decision once at install time and all of the un-needed parts for platforms I'm not using stay on the install disk, now the decision is made each time I run the app and I get to clog my HD (or worse, my SSD) with all of them?
Now I can have the world's LARGEST hello world program with support for alpha, arm, avr32, blackfin, cris, frv, h8300, ia64, m32r, m68k, m68knommu, mips, parisc, powerpc, ppc, s390, sh, sh64, sparc, sparc64, um, v850, x86, and xtensa?
I'm guessing if this catches on, the most commonly used program will be 'diet' the program that slims down fat binaries by removing the architectures you will never encounter in a zillion years. (Just what are the odds that I will one day replace my workstation with an s390?)
If they want to do this, they should do it right and implement something like TIMI. Done well, it would mean that an app could run on a platform that didn't even exist when it was shipped (it worked for IBM).
Beyond the technical advantages of TIMI, it will provide us years of South Park references.
It must sound as snazzy as Gratis. I vote for La Résistance as it will transform the image of us freedom fighters into that of cunning sophisticated individuals. The word is probably closer to the ideology of many of it's supporters, too.
*Runs away*
Once you start despising the jerks, you become one.
We could do something like the old p-Code, where we compile to a virtual architecture, and then translate it to the machine during installation.
I assume you don't mean that p-Code itself was translated during installation (AFAIK it was translated on-the-fly during execution), just your modern equivalent.
I was sad to see we didn't have the compute power back then to make it fly. I bet we do now.
Possibly, but it would still likely give poorer performance. The benefits would have to outweigh that.
Also, in some respects, the x86 *is* a virtual machine that people are writing code for, albeit transparently for those who treat the CPU as a black box.
Reason being that all x86-compatible CPUs from the Pentium II/Pro onwards have been based around non-x86 cores (*). x86 code is translated on-the-fly by an outer layer before execution.
They probably had a good reason in that case. I assume that the x86 design- even by that stage- had acquired so much baggage that it was making it very difficult to proceed further with that architecture, and that even with the translation overheads, the non-x86 core made more sense in the long run.
In a perfect world, it would have been better still to be able to ditch x86 altogether, but for obvious reasons that wasn't going to happen here.
(*) I've heard them described as RISC-like, though someone else mentioned on Slashdot that in truth they weren't really *that* RISCy.
"Slashdot - News and Chat Sites Deviant". (Click "homepage" link above for details).
The binary is compiled twice. The way OS X packages its applications is the the Application that Icon that you click on isn't a File but a Folder with a predefined structure. So there there is a PPC and an intel port of the executable.
This is wrong. OS X has 1 binary file that contains both architectures in the App Bundle, not 2 executables :
./firefox-bin
./firefox-bin: Mach-O universal binary with 2 architectures
./firefox-bin (for architecture ppc): Mach-O executable ppc
./firefox-bin (for architecture i386): Mach-O executable i386
/Applications/Firefox.app/Contents/MacOS
$ ls -al firefox-bin
-rwxr-xr-x@ 1 user admin 42596 9 Sep 19:19 firefox-bin
$ file
$ pwd
"Not to mention all the idiots who use words like boxen."
Anonymous Coward on Monday August 04, @06:49PM
That said, OS X' universal files are pretty much on their way out, as Snow Leopard (10.6) doesn't play ball with PPC. As time goes on and people realize that x86 is a dead horse running, we might however see universal executables again, but then as ARM and x86.
This is wrong also. Snow Leopard still makes good use of Universal binaries even without PPC being there. They can ship 32 bit and 64 bit in the same binary (i386 and x86_64). Universal binaries aren't going away.
./iChat
./iChat: Mach-O universal binary with 2 architectures
./iChat (for architecture x86_64): Mach-O 64-bit executable x86_64
./iChat (for architecture i386): Mach-O executable i386
/Applications/iChat.app/Contents/MacOS
$ ls -al iChat
-rwxr-xr-x 1 root wheel 5844848 29 Jul 01:28 iChat
$ file
$ pwd
"Not to mention all the idiots who use words like boxen."
Anonymous Coward on Monday August 04, @06:49PM
Considering how few PPC apps in use now days, it seems logical.
I've only been a mac user for a few months, but I've never seen a PPC binary, with the exception of the one 'hello world' universal binary I made just to see what would happen.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
Why not write in Java or one of the Mono-supported languages and distribute something that will be dynamically compiled on the destination machine. It is fast, convenient and you don't have to have 10 OSs to target them....
m
How about we have a single chunk of data and executable code/libraries needed to run across any OS or any architecture? If you're going to call it universal you'd best damn-well make it universal! Take the idea of what OSX does for their apps and apply it to every OS possible? Even if the stuff has to be compressed to fit onto a single DVD you can have that decompress itself but still stay a single file (at least on the user end, the OS would still be able to read each file individually inside the archive.) For example, most games only need a different executable, the data (textures, maps, etc) stays the same.
You could even make it able to run on different distributions of the same kernel! No more stupid dependencies, no more RPM hell, and best of all there'd be no reason for it to just wipe out other installed software, such a beta versions of libraries and what not.
And then you could lock it down by making that file read-only. If there's an exploit, it won't destroy your software as it can't modify it, unless that exploit somehow allows write access.
Still waiting on Serviscope_minor to wake up to fucking reality and realize that Jessica Price isn't going to fuck him.
In OS X the Developer Tools that would be required are optional. (On Linux too, these days.)
Requiring apps to be built from source just wouldn't make sense for Apple's market.
you had me at #!
The underlying problem is that end users don't want to be bothered by having to know if they need the 64 bit version or the 32 bit version (or rarely some other platform).
We already have wildly successful packaging systems for linux that handle this class of problem rather well. So why not extend the packaging system to support multiple binaries in the same package? You'd certainly save on HD space. It also seems a bit cleaner.
AccountKiller
Linux doesn't need fat binaries because the package manager automatically installs the binaries that are appropriate for the machine.
OS X needs fat binaries because it doesn't have package management. I wish people would stop trying to bring OS X (mis)features over to Linux. If I wanted to use OS X, I'd already be using it.
It has been part of the Mac System since the Mac was released in 1984; the existence of a resource fork made this possible in "Classic" MacOS. (But I can't remember exactly how Lisa OS does it.)
you had me at #!
*sheesh* Just what we need. A way to distribute stale, broken, un-optimized binaries everywhere all at once.
Which OS does this happen on? Not Windows, Linux, OS X, *BSD ...
They ALL have DLL hell for closed source apps. If your solution is no closed source apps, then you live in a fantasy world.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
That would be nice, but then someone might decide not to buy a newer version of Windows because their critical app only works on something ancient like Win98.
Plenty of those anyway, especially in low-volume markets like scientific equipment.
Rejoice though; with 64-bit Windows becoming more popular, crap old 16-bit, non-LFN installers from the mid-'90s will finally be going away.
Also, Macs apparently aren't immune to installer stupidity: Microsoft Office 2008 is fully Universal Binary, except for its installer, which is still PPC-only.
Hail Eris, full of mischief...
E pluribus sanguinem
times when a misbehaving application is pulled or broken in x86_64 but not i386 and I've been able to temporarily run the 32bit version
And you can't build it from source because...?
And in fact, for large classes of interesting applications, installer and installed size is overwhelmingly data, not code. Games are going to be 95%+ data (check out how small the actual app is sometimes; often less than 1% the size of the data files). Microsoft Office has far, far more space allocated to fonts, clip art, all those multilingual spelling dictionaries, and templates than the actual *.exe files.
And even the self-contained .exe files in the above examples will also include a ton of bitmapped images for the GUI and such. Sure, command-line apps are going to have a lot more code, but even they will have the help text, tables, and other stuff that could be stored once in a platform-independent internal data structure.
Having behavior driven largely by data, not good is a good thing, of course. Data is a whole lot easier to debug than code, and bugs in data are generally much less catastrophic assuming the code itself does good validation.
My video compression blog
Compiling your own is always the best, especially when you get gcc etc. updates but here is the reality: Compiling some apps takes insane amount of time. Unless you really know what you are doing or your distro has support for special configurations, it has no advantage at all too. You just end up with the same binary.
I guess guy proposes it for "user level", general end user distros.
I don't understand why the OS would keep all those other files. The user's not very likely to take the hard drive out and stick it in a PowerPC box sometime in the future, so why not just delete all the files that aren't for your architecture?
In fact, why would you even download all those extra files in the first place? Wouldn't it be nice if you had some application that would selectively download just the files you need to install the software?
In fact, how is this at all better than the current package management solutions the various Linux distributions use?
Somebody didn't read the article...
Q: Do you have to read the entire FatELF file to load it?
A: Nope! Just a few bytes at the start, and then the specific ELF object we want is read directly. The other ELF objects in the file are ignored, so the disk bandwidth overhead is almost non-existent.
Q: So this...adds PowerPC support to my Intel box?
A: No. FatELF is not an emulator, it just glues ELF binaries together. If you have a FatELF binary with PowerPC and Intel records, then PowerPC and Intel boxes will pick the right one and do the right thing, and other platforms will refuse to load the binary, like they would anyway.
Q: Does this let me run 32-bit code on a 64-bit system or vice versa?
A: No. This doesn't let 32-bit and 64-bit code coexist, it just lets them both reside in the file so the platform can choose 32 or 64 bits as necessary.
Q: Do I need to have PowerPC (MIPS, ARM, whatever) support in my FatELF file?
A: No. Put whatever you want in there. The most popular scenario will probably be x86 plus x86_64, to aid in transition to 64-bit systems.
One use case I can see for fat packages or FatELF (either one works) would be if we also had a smart boot loader that could take a single-architecture binary and run it through QEMU in conjunction with FatELF libraries on the system. If my ARM netbook ran Fedora, example, and installed FatELF libraries supporting both ARM and x86 (supposing cheap SSDs!) then if I really needed Adobe Reader for some reason which is only on x86, then I could download and install their Fedora x86 RPM and run it seamlessly.
This could also be done with plain fat packages too. A fat gtk-libs package, for example could dump files native to your architecture in /usr/lib or /usr/lib64 or both, while putting other architecture libraries in the Qemu system directory for that architecture.
Note that Qemu already allows this without fat libraries. But wouldn't expect a average netbook user to know how to download the rpm or tarball, extract everything and stick it somewhere, then populate the Qemu system directory with Fedora x86 libraries. The benefit of FatELF or fat packages here would be that the RPM would just install because it could see that the requisite FatELF libraries where installed or that the architecture-specific libs were installed in the Qemu system. This is all provided that RPM or DEB or whatever either knows about FatELF or implements fat packages.
So I decided to have a look at my netbook -- an Acer Aspire One, running the Acer Linpus Linux system. It's the 512MB memory with 120GB disk model; not the SSD dress.
[user@ariel ~]$ find /usr /sbin /bin /lib -type f -print0 | xargs -0 file | grep ELF | sed -e "s/:.*$//" >list
[user@ariel ~]$ wc list
12318 12318 455036 list
[user@ariel ~]$ ls -l `cat list` | awk -F " *" "{ sum += \$5 }; END { print sum }"
2090169634
For the "non-unix" types, this means -- traverse four directories (/usr /sbin /bin /lib) that contain all the binaries (well, I did forget /boot, but that's not very important for this discussion). We extract those files that mention ELF in the file-type, count them, and then sum their sizes.
Note that there are ~12,000 objects that would be expanded, taking up around 2GB of space. Which means that adding an alternate "fat" binary would roughly double this to 4GB. In other words, not very good for an SSD dress, but reasonable for a hard disk dress (my total data usage is 30GB on this netbook, so we would add 10% to the utilization).
On the other hand, this is storage resource that would not ever be reclaimed. There are other ways to achieve this result. For example -- simply provide multiple ELF objects in an archive, including a "bintester". Iterate each folder in the archive, test-running the bintester. If the bintester succeeds, use that. If none succeed, fail if its "closed object/source", or attempt to download and build the source. An example of this type of function is the VMware driver loader.
Or, use a neutral distribution -- JAVA, or Squeak, or the Microsoft CLR.
All of these provide similar results, without the need to modify the object loader. Which is something that I would really frown about -- After all, the loader is a very heavily used, very security sensitive component.
As to "fatness"; it turns out not to be as big an issue as I had originally feared (I did the measurement on the "worst-case" system I use, and started with the mind-set that it would matter a whole lot more than it turned out... my preconception was wrong).
Your mileage may, of course, vary.
PS. For full disclosure, you may note that I excluded /opt -- I have 3.9G of stuff there: OpenOffice.org3, Intel C 11.0, Adobe Reader, Microsoft MSVC 7, and some smaller stuff (tcl/tk dev, hua wei 220 support, and a virtual tape library . Since this may or may not impact a "standard" distribution, I decided to not include it (and, MSVC 7 is COFF format, used under WINE anyway).
Just another "Cubible(sic) Joe" 2 17 3061
Really? If using Linux lead to an XML binary in my memory, I'd want it out of there ASAP. Perhaps you meant on your disk ;)
Kind of like Java then.
The way you should install non-free applications on Linux is to add the company's repository to your software sources. That way, you get automatic selection of the right binary and automatic updates. Some companies already support that.
Long term, I expect that SuSE, Ubuntu/Canonical, and RedHat will be offering app stores that make selling and buying commercial Linux apps as easy as iPhone apps.
Fat binaries are a throwback to the past; they aren't needed in the era of app stores and package management.
Isn't this kind of thing what VMs are for? The kernel could have a VM, and run all binary executables that are compiled for the VM inside the VM. That way you can get real compile-once-run-everywhere, and with no bloating of the size of executables. It should then also be possible to port the VM to other OSs.
Talking to a couple guys learning ELF and Linux' SO loader, I got the impression that ELF already supports these multiple code segments, and that adding in headers to denote the arch is really simple. I'll see if I can get more evidence for this.
~ C.
Or maybe it's proprietary. Some people are willing to compromise on freedom.
I would define my freedom as a user as the freedom to install any app under any license without someone looking over my shoulder.
OSX makes this easy. Windows makes this easy. Linux makes this hard.
While fat binaries are one approach to run applications which are binary-only on Linux, a much better way is to use binary translation. A fat-binary approach would require application vendors to qualify both versions, which means approximately twice the cost. Translators can be developed by 3rd parties. There are a lot of commercial-grade binary translators and binary optimizers that have shipped over the years. Tandem, Digital, Transmeta, Transitive, etc. The messy parts are getting the OS conversion semantics correct when the source and target OS's are not very similar. Instruction decode can be a bit tricky, but it is not the development bottleneck.
I've only been a mac user for a few months, but I've never seen a PPC binary, with the exception of the one 'hello world' universal binary I made just to see what would happen.
That's largely because XCode was producing universal binaries several months before Apple actually announced what a universal binary was or why a developer might wish to produce one.
About the only PPC thing I have is the software for my Epson scanner - they haven't produced a Universal driver nor are they likely to seeing as it was discontinued a few years ago. The day I move to a version of OS X without Rosetta support I either need to use something other than Epson's software or buy a new scanner.
The benefit would be that it would make data more transportable at first blush. The problem is clear enough : The whole process of installing an operating system and shipping data to it is a huge waste. Being able to take a drive and transplant it into a newer machine without having to re-install anything is an absolute time saver. I'm still loving Linux that it let me do that without too much fallout, but why couldn't I take a brick and put it on a faster processor, or a lower power processor, or in a friend's virtual machine, or anything... I don't need to be married to CPU architecture...
And that's really where it all falls apart, because you can't possibly ship a computer that has every CPU architecture in every binary.. But maybe you could have a bootstrapper / kernel that always gets all of the possible CPUs, just in case, for enough to be able to boot itself, mount its own file system and get to a network. Then, the operating system would replace the rest of the binaries with new versions, as part of your transplant process, and your computer would just work.
This is my sig.
Great... except having to compile an app to install it is a fucking waste of the user's time. And the performance gains from CPU specific compile flags are insignificant. Why is this a better idea than fat binaries again?
Are you a Gentoo user? I used to be a Gentoo user too. Then I actually became sane.
Fat binaries are awesome, they're what makes Mac OS X the mainstream operating system with the most painless 64-bit transition. Whereas Windows and Linux use messy hacks to allow 32-bit apps to live in a 64-bit environment, in OS X it "just works" because all libraries are multi-architecture in a completely transparent way thanks to fat binaries. It also made the transition from PPC to x86 relatively easy, too.
I feel sorry for people who believe Linux doesn't need fat binaries. They don't understand all the advantages this system brings (and not just to non-free software).
Linux needs to become more like Mac OSX than Windows.
What I would like to see in Linux in the near future:
Universal file format for X86, X64, and PowerPC executiables that replaces the ELF format (WIZARD format, ELF needs food badly!)
GNOME and KDE merged into one GUI that emulates both of them, GNIGHT or something.
Ability for Linux to use Windows based drivers when Linux based drivers do not exist, something better than that NDISwrapper but under a GPL license and built into Linux.
GNUStep being developed into something that resembles Aqua, Aero, and other GUIs and is backward compatible with the Mac OSX API calls to recompile OSX programs for Linux. Maybe even in the near future run OSX Universal binaries somewhat like WINE runs Windows programs.
Remember, Slashdot does not have a -1 disagree moderation, and no, troll, flamebait, and overrated are not substitutes.
Just because you can, doesn't mean you should.
I think for open software, that does not follow "traditional" models of software distribution, it's a pointless waste of resources.
Also, it won't affect me anyway, as I'm compiling everything from sources. (Gentoo)
Any sufficiently advanced intelligence is indistinguishable from stupidity.
Given enough disc space, there's no reason you couldn't have one DVD .iso
I don't want a DVD image, which would burn through the vast majority of a 5 GB/month transfer allowance. I want a CD image, which burns through one-seventh of that.
the otherwise unchanged hundreds of megabytes of data.
How is byte-swapped data "otherwise unchanged"?
One hard drive partition can be booted on different machines with different CPU architectures, for development and experimentation.
Different machines likely have different layouts for the master boot record.
And you can't build it from source because...?
The bug is in the source?
Yes, Sketsa is commercial, but the price is well worth the difference.
Not to people who live in a country with an undervalued currency. Look at the blue countries on this map: an hour of labor is worth fewer U.S. dollars than it would be in yellow or orange countries like USA, Canada, Japan, and most countries of western Europe.
Purchasing power parity, map at top of article
I meant exactly what I said. "Add/Remove Applications" is pretty usable UI that, as far as I can see, has none of the problems you refer to.
There are plenty of applications that I would want to use that aren't in Add/Remove. The examples that I've seen fall into three categories:
personally I wish MSFT would do the same thing.
They do. The difference is that a "generation" to Apple is on the order of 12-18 months, whereas to Microsoft it's more like 7-8 *years*.
MSFT let's them stay in the previous century and use bare metal knife switches to turn on the lights.
So do most enterprise-level vendors - but Apple is far more interested in forced upgrades and milking its customers.
The bug is in the source but not one of the only two binary packages (x86 and x86_64) you have?
Or you mean they've updated the x86_64 version to the newer source with the bug, but not the x86 version?
* You can't find an older version?
* You can't build from an older branch?
Or you mean they've got a 64-bit bug?
* You can't make a 32-bit build yourself?
This seems like a really obscure failure mode to me, and if this particular workaround was removed there are plenty of others available.
I do not propose anything. Why should I?
You propose no solution for distribution of non-free software. You propose no solution for funding development of free video game software. Therefore, you appear to propose the elimination of the video game industry. A lot of Slashdot users who like to play video games disagree with your proposal.
I don't think this is really relevant in an OSS-based platform. Most apps you get for Linux that aren't distributed through your package manager are in source, allowing you to run it through the compiler for whatever architecture you happen to be using, which makes having multi-architecture binaries a moot point. Which is not to say that multi-architecture support is a BAD thing, of course, just that putting it all in one binary is the wrong approach to take.
I don't know if the average repository stores packages in a particularly wide variety of architectures, but it seems logical to me that that's the place where you put in universal support if it isn't that way already.
If you aren't angry, you aren't paying attention.
I got the remedy for that
aptitude install gnome-theme-aqua; gnome-terminal
Then, in gnome-terminal
aptitude install [program...]
I don't understand why the OS would keep all those other files. The user's not very likely to take the hard drive out and stick it in a PowerPC box sometime in the future, so why not just delete all the files that aren't for your architecture?
Turn it around. Why delete them? Disk space is really cheap and is getting cheaper all the time.
In fact, why would you even download all those extra files in the first place? Wouldn't it be nice if you had some application that would selectively download just the files you need to install the software?
A few points. Firstly, bandwidth is really cheap. Secondly, the space consumed by the binaries is a small proportion of the whole for most third-party apps. Thirdly, selectively downloading bits and pieces is far more likely to go wrong in hard to debug ways than giving everyone the exact same package.
In fact, how is this at all better than the current package management solutions the various Linux distributions use?
You only ever want software provided by your distribution maker? How... short-sighted. It would be far better if there was a thriving third-party vendor market, producing (and probably selling) things like specialist applications and games, and for people in that sort of situation, having the distro makers as sole gateways is wholly unacceptable; never ever going to happen.
Enabling third-party apps is an important step for being more than just a niche OS. Simplifying the process of delivering those apps is an important part of that enablement. Fat binaries makes that delivery simpler. QED.
"Little does he know, but there is no 'I' in 'Idiot'!"
"You are confusing NeXT and Apple's approaches, I think. Apple puts both all of the different architectures in the same file. Your code is compiled twice, but it's only linked once. The PowerPC {32,64} and x86 {32,64} code all goes in different segments in the binary, but data is shared between all of them, so it takes less space than having 2-4 independent binary files." Actually, this isn't true. The code is compiled four times (for a 32/64 bit unibin), linked four times, and then all four executables are stitched together into one executable file. With regards to disk space, Apple thought ahead, and the format supports stripping out of versions of the binary you don't want to keep around. For example, some Intel owners run tools on their machines that strip out the PPC versions of binaries to preserve disk space. Some PowerPC owners strip out the Intel versions of the binaries, but then usually run into trouble when they try to migrate their disk to an Intel machine. :) Stripping out a version of the binary will even keep a signed binary valid.
FYI: Apple has a very similar sort of setup for language dependent resources.
that's not the issue. The whole point of FatELF is to deliver binaries. I may have missed it in his site project description and FAQ but I was left thinking that I'd not be able to similarly substitute 32bit app as I now do.
How many non technical people know the difference between 64 and 32-bit CPU's? Not a whole lot, if any. For those people, it's a bit daunting when their Linux friend/son/granddaughter/whatever tells them it'd be a great choice and the first thing they see is "Which download? 32 or 64?". Just put the .ISO with both 32-bit and 64-bit with a script that tests if the CPU is 64-bit capable at boot time. Or how about those people that don't know if their Mac has Intel or PPC chipset? Same thing, script at boot time to determine. If it's just two architectures the overhead could be well worth it.
"The best way to accelerate a Macintosh is at 9.8m/sec^2" -Marcus Dolengo
First off, I would like to point out that I don't support the idea of making binaries universal by packing them in the same .elf. Sure, it would be neat to have a DVD that can install to different architectures, it's currently not possible because the bootloader _has_ to be native. You'd probably end up with a bunch of boot floppies for a single installation media. In addition, is there any difference to having a package for each architecture on this DVD rather than universal packages? With separate packages the same amount of DVD space is consumed but far less is consumed on the target hard disk.
In addition, this isn't going to make companies support uncommon architectures any faster. Maintaining multiple packages is really easy, keeping the code working across different architectures is not so hard. I think it's mostly programmer laziness not bothering to compile other architecture packages - and there is no reason fatELF is going to decrease this laziness.
If you _really_ want architecture independence (which universal binaries don't really provide, they still only support architectures that the author had in mind), you'll need a recompiler of some sort. LLVM is designed to be suited to this task, so why not use it? Apple already does. Yes, I know it's a bit slower, but a small price to pay if you need your app to run on every system under the sun.
Of course, there is always the option of web apps...
file `which gcc` /usr/bin/gcc: Mach-O universal binary with 3 architectures /usr/bin/gcc (for architecture i386): Mach-O executable i386 /usr/bin/gcc (for architecture ppc7400): Mach-O executable ppc /usr/bin/gcc (for architecture x86_64): Mach-O 64-bit executable x86_64
And I wouldn't be shocked to see Apple package ARM Mach-Os into some files soon too, with this pseudo-netbook thing rumored.
http://lkml.org/lkml/2005/8/20/95
that's not the issue. The whole point of FatELF is to deliver binaries.
True. It's to deliver binaries. It's not to work around a bug in some specific build of a binary. That's what building from source is for. However.
I may have missed it in his site project description and FAQ but I was left thinking that I'd not be able to similarly substitute 32bit app as I now do.
You must have. Actually, there's two different ways of doing it:
fatelf-split my_fatelf_binary
and:
fatelf-extract my_elf_binary my_fatelf_binary x86_64
fair enough. technically possible.
A similar scenario is being able to select which I run, 32 or 64 bit. I did that for awhile with Firefox both to compare their general performance and to try things on one first as a kind of experimental environment. The reasons are really immaterial. I don't see a palatable way to do this with FatELF though. Another edge scenario, admittedly.
The vast majority of all desktop computers out there are x86. The vast majority of Linux desktops, ditto.
That said, currently we can't even easily produce binaries that run on multiple distributions for just the x86 .
Generally speaking, unlike Windows/OSX, you can not just get "the Linux Desktop Version" of a program. There is no Linux desktop. There is a plethora of them. For better or worse, the issues and complexity that arise from this plurality are due to the lack of central management and control.
I thought this was the whole point of Java. Why are we going back and trying to solve a problem that was solved FOURTEEN YEARS AGO
It's also theoretically possible to include ARM support too, to make a binary that would also run on an iphone...
...as long as you don't use such minor unimportant frameworks as AppKit (no AppKit on iPhone OS; it's UIKit instead). You could make a fat command-line binary, I guess....
Considering how few PPC apps in use now days, it seems logical.
I've only been a mac user for a few months, but I've never seen a PPC binary, with the exception of the one 'hello world' universal binary I made just to see what would happen.
Never run Quicken for Mac, I guess (except perhaps for a pre-release of Quicken Life for Mac^W^W^W^WQuicken 2010 for Mac):
Not only is it not fat, it's not even Mach-O....
You are confusing NeXT and Apple's approaches, I think.
You should think differently. NeXTStEP introduced a fat binary scheme to allow a single executable file to contain binaries for 68k NeXT boxes and x86 PC's running NeXTStEP. OS X picked up that scheme from NeXTStEP, so NeXT's and Apple's approaches are the same.
Your code is compiled twice, but it's only linked once.
No, it's compiled N times, and linked N times, once for each instruction set architecture.
The PowerPC {32,64} and x86 {32,64} code all goes in different segments in the binary, but data is shared between all of them, so it takes less space than having 2-4 independent binary files.
If by "data" you mean data in files under, say, Resources in the app bundle, yes, it can be shared. If by "data" you mean the data segments in the executable, no, it's not shared - a fat binary is just a bunch of Mach-O binaries with a special header wrapped around them, and each Mach-O binary has a full set of text/data/etc. segments.
To support this on Linux would not require any changes to the kernel, only to the loader (which is a GNU project, and not actually part of Linux).
If by "this" you mean something that looks like OS X fat binaries, you would have to change the kernel to understand fat binary files, running the appropriate executable within that file.
If you know what you're doing, you can actually extract the Mach-O binaries from the fat binary and distribute them separately (I've done it with a hex editor, but I'm sure there are plenty of other ways to do it).
Yes, if you know what you're doing, you know how to use the lipo command to do it. :-)
In most cases, with Linux, we've got source code.
So if we want to run programs on a new architecture, maybe we could *gasp* compile from source?
Ryan Gordon needs to mind his own business. Keep your binaries and shit in OS X, we have source code to compile from which means that we can run it on any platform without requiring larger binaries, thanks!
:(){
f by "data" you mean data in files under, say, Resources in the app bundle, yes, it can be shared. If by "data" you mean the data segments in the executable, no, it's not shared - a fat binary is just a bunch of Mach-O binaries with a special header wrapped around them, and each Mach-O binary has a full set of text/data/etc. segments.
That's how I used to think it worked too, but then I had to modify a universal binary by hand one day. Turns out that the compiler tools are smarter than that.
My recollection is that the layout is something like this (for a PPC32/x86 binary):
Both architectures get positive offsets to refer their data, so they work just fine. Sure the PowerPC Mach-O "file" has a bunch of useless crap in the middle of it, but the Mach-O loader doesn't notice since those byte ranges aren't mentioned in the PowerPC header. Pretty clever.
You can confirm this by running strings(1) on a Universal binary and seeing that there's only one copy of the string constants.
Binaries are only ever useful when compiled for the user's distro. Given that this usually happens at package level (at least for distros that even bother with package management), and that those packages are often platform-specific, I don't see what problem this would solve. Perhaps if there was a distro that was definitively "Linux" that had the userbase to support it. But then any candidate for such a role already has a package management system.
Do you see what I did there?
Okay, a bunch of you have responded with "Check out DEB and RPM". I already know about package management, thanks.
But if you look at an app package on MacOSX, you'll see it's presented as a single icon or "file" ... but use the command line, and you'll see it's just a directory. A directory with a special structure, so the system knows that it is really an application. Kind of cool. I think we need something like it on Linux, but I am not aware of such a thing. It would probably be some kind of virtual folder, implemented in GNOME or KDE. It's really just something like a tarball with a particular directory structure, maybe with a special extension, and GNOME/KDE knows it really should be presented to the user as a single object, using an icon located at a particular place within the tarball, with a special name.
Do I see it as the new way to release versions of Firefox, or GIMP? No. For that, use RPM or DEB for package management that's integrated with the rest of the operating system, tracking dependencies on shared libraries, etc.
However, I think this would be a great solution for third-party applications that aren't going to be part of a mainline distro - assume statically linked.
For example: commercial games. Download the latest version of "Sports Franchise 2009", put it in your "Games" directory or wherever you keep games, and just click it's icon in GNOME or KDE to launch it.
Uhm, doesn't mono already give Linux this? All they need to do is finish gcc's support for CLR binaries and the problem is solved. (CLR / mono can call into the underlying platform's C API.)
No, I will not work for your startup