LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Build one Linux binary for many i386 platforms? (https://www.linuxquestions.org/questions/programming-9/build-one-linux-binary-for-many-i386-platforms-435104/)

mattengland 04-14-2006 10:07 AM

Build one Linux binary for many i386 platforms?
 
I would like to build one Linux binary set--binary apps and any associated dynamic libraries--for many Linux i386-based platforms (at least RHEL 3.x/4.x, Fedora Core 2,3,4,5, Debian 3.1, but would like sever more). I may still make multiple *package* distributions (eg, .rpm, .deb etc), but I would like to have one build process provide the binary-file-set input to these packages.

How does one effectively do this?

I see application distributions like these doing this:

http://dev.mysql.com/downloads/mysql/5.0.html
http://www.cmake.org/files/v2.2/cmak...6-linux.tar.gz

(I recall there being many others, I just don't have references to them at the moment.)

How is this done? Is it a careful management of std-library/kernel-library dependence? I'm sure it is, but I'm not sure exactly how to go about controlling this. Is there a reference I can read somewhere? Is it mostly a matter of constructing the "least common denominator" build systems from which to link the "most ubiquitous" library set? Do I need to build the libstdc-2.x/libstdc++-* on a Linux machine and compile to that?

I'm looking for more info besides "just find the dependencies and statically link" or "find the lowest-common-demoniator libraries". The question: how do I determine these libraries (I doubt that an ldd on a couple systems is going to tell me everything) and which revs (eg, what rev of these libs are going to work for most/all of these systems)? I'm also of the impression that it's best not to statically link kernel/libstdc* lib objects.

(I have posted a similar question before-- http://www.linuxquestions.org/questi...d.php?t=362514 --but haven't found sufficient info yet, so am trying this new thread.)

I suspect this is a faq that's been answered somewhere; I have yet to find the answer.

My project is a C++-based one. Does this have a bearing on my library depedence? (eg, libstdc++...so?)

Thanks for any help,
-Matt

ta0kira 04-14-2006 11:23 AM

I generally just statically link, but that is for stand-alone binaries. If your packages come with their own shared libs, link everything to the .a versions of all standard libs they depend on, but dynamically link to the shared libs which you will distribute. You can't dynamically link something for distribution without building for every combination of dependency sonames out there.

Alternate choice; use a makefile.
ta0kira

paulsm4 04-14-2006 12:36 PM

Alternate choice: write the program in Java. Or Perl, Python, Ruby or some other interpreted language.


All times are GMT -5. The time now is 10:03 AM.