Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-12-2012, 12:05 PM
|
#1
|
|
Member
Registered: Oct 2005
Posts: 465
Rep:
|
Build for multiple Linux distro
Hi, a while back I recall if I build a C++ project on Centos it won't run on SuSE. Is there a way to specify the build options when running "g++" such that the final executable will run on all flavors of Linux, or specific distro of Linux?
|
|
|
|
08-12-2012, 12:48 PM
|
#2
|
|
Senior Member
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,717
Rep: 
|
|
|
|
|
08-12-2012, 12:55 PM
|
#3
|
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,034
|
There is no binary compatibility between linuxes. That's why developers distribute source packages.
|
|
|
|
08-13-2012, 07:05 AM
|
#4
|
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,314
|
Quote:
Originally Posted by NevemTeve
There is no binary compatibility between linuxes. That's why developers distribute source packages.
|
I wouldn’t phrase it this way. In principle something compiled for Cent OS will also run on openSUSE – as long as it’s the same CPU type. We bought several applications as binaries only and they run without problems. Missing libraries (or a wrong version of it) is one issue seen often. But it can be solved.
With more subtleties between CPU types, it can be necessary to chose a common factor during compilation. E.g. SSE4 is different between AMD and Intel as far as I know. In this case telling the compiler to use only 64bit commands but no SSE4 at all can help.
Last edited by Reuti; 08-13-2012 at 10:31 AM.
|
|
|
|
08-13-2012, 07:11 AM
|
#5
|
|
Senior Member
Registered: Dec 2011
Location: UK
Distribution: Debian Sid + various in VMs.
Posts: 1,783
|
Mozilla seem to do OK packaging Firefox to run on different distros. Don't they do this by including the majority of the library files required in the package?
|
|
|
|
08-13-2012, 09:05 AM
|
#6
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
Quote:
Originally Posted by Reuti
I wouldn’t phrase it this way. In principle something compiled for Cent OS will also run on openSUSE - as long as it’s the same CPU type. We bought several applications as binaries only and they run without problems.
|
I would consider much more than just the CPU type in the matter of cross-architecture compatibility. There are all kinds of layers of software, as well (kernel + drivers, standard C library, threading models, userspace libraries, etc). It's true that binaries are often cross-platform compatible, but that isn't guaranteed. Someone mentioned that Mozilla distributes cross-platform binaries as an example of compatibility. I would also point out that Mozilla browsers are by far the least reliable software I use on Linux. I don't know if there is a connection or not.
--- rod.
|
|
|
|
08-13-2012, 09:35 AM
|
#7
|
|
Senior Member
Registered: Dec 2011
Location: UK
Distribution: Debian Sid + various in VMs.
Posts: 1,783
|
Quote:
Originally Posted by theNbomr
I would also point out that Mozilla browsers are by far the least reliable software I use on Linux. I don't know if there is a connection or not.
|
I think you're either unlucky or projecting some subconscious selection bias. That's not to say Mozilla products don't have problems, just that all software has problems and I've been using the Nightly build of Firefox on both 32 bit and 64 bit for a long while now with no reliability issues at all.
I think of it more that applications are written against a set of libraries and any distro with those libraries (and perhaps some going forward) can then run the application. Where the library is proprietary or a fixed version ought to be used it's bundled with the application.
There are far too many applications available which are not distro specific to go around saying things like:
Quote:
Originally Posted by NevemTeve
There is no binary compatibility between linuxes. That's why developers distribute source packages.
|
The above is demonstrably not true.
|
|
|
|
08-13-2012, 04:04 PM
|
#8
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
Quote:
Originally Posted by 273
applications are written against a set of libraries and any distro with those libraries (and perhaps some going forward) can then run the application.
|
But there are different versions/revisions of libraries, and by definition, those are not all the same. Yes, it mostly works, but there are no guarantees. I have seen occasions where it demonstrably does not work. It would be reasonable to imagine that there are even more cases where applications appear to work, but either subtly misbehave under certain conditions, or crash without evidence of the cause.
--- rod.
|
|
|
|
08-13-2012, 04:10 PM
|
#9
|
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,314
|
Quote:
Originally Posted by theNbomr
But there are different versions/revisions of libraries, and by definition, those are not all the same.
|
Therefore libraries have a major and minor revision number – or better: should have. This way you can have several versions installed, and the correct one is found by the compiled in soname to get the correct number of the major version used during compilation. Unfortunately are not all libraries following this scheme.
|
|
|
|
08-13-2012, 04:19 PM
|
#10
|
|
Senior Member
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 1,648
|
In general, compiling your application with static libraries and in 32 bit will let it run on the VAST majority of regular Linux distros on standard hardware (not ARM, etc). Dynamic libraries and 64/32 bit incompatibilities are often what get you into trouble when distributing a pre-compiled binary.
I have a code that I compile for distribution in 32 bit with static libs. I've run it on RHEL, Fedora, CentOS, OpenSUSE, Ubuntu, Mint, Debian, and probably one or two more that I'm forgetting. The only machine I've found to date that won't run it is an old Fedora 4 box, because, according to the error, the kernel is too old.
Last edited by suicidaleggroll; 08-13-2012 at 04:25 PM.
|
|
|
|
08-14-2012, 02:39 AM
|
#11
|
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,034
|
FYI: linux runs on dozens of different achitectures/processors, so binary compatibility is an illusion...
|
|
|
|
08-14-2012, 09:54 AM
|
#12
|
|
Senior Member
Registered: Dec 2011
Location: UK
Distribution: Debian Sid + various in VMs.
Posts: 1,783
|
Quote:
Originally Posted by NevemTeve
FYI: linux runs on dozens of different achitectures/processors, so binary compatibility is an illusion...
|
Your statement is a platitude.
Of course, without a virtual machine, a program written for one architecture will not work on a other. However, that does not mean that "binary compatibility is an illusion" it means that you compile for an architecture.
The original post may have been a little uspecific but your posts are meaningless and trite.
|
|
|
|
08-14-2012, 10:46 AM
|
#13
|
|
Senior Member
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 1,648
|
Quote:
Originally Posted by NevemTeve
There is no binary compatibility between linuxes. That's why developers distribute source packages.
|
Quote:
Originally Posted by NevemTeve
FYI: linux runs on dozens of different achitectures/processors, so binary compatibility is an illusion...
|
The OP didn't ask about compiling for different architectures, he specifically asked about compiling for different distributions. You're "answering" a question that was never asked.
|
|
|
|
08-14-2012, 11:14 AM
|
#14
|
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,314
|
I didn’t dare to mention it before, but if we are getting into it: I was thinking of mentioning Mac OS X inherited fat binaries from NeXTSTEP to include PowerPC and Intel code. Nowadays it’s used to have 32 and 64 binaries in one binary for the Intel architecture (selectable with “open in 32 bit mode” in the info window of a file, and some even show “open with Rosetta” in addition for the PowerPC code).
And it looks like discussions about fat binaries are going on for Linux too.
Maybe this could also be used to include binaries for different versions of the kernel for one and the same architecture or a binary for Intel/AMD64/SSE4 in different flavors.
|
|
|
|
08-14-2012, 11:47 AM
|
#15
|
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,034
|
Okay guys, you won, you certainly know better than me what 'all flavors on linux' in the original post means. EOF.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:22 PM.
|
|
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
|
|