After building on Fedora machines and copied to Debian, it failing with :
'Floating point exception'.
The same `program` being build on Debian, and being copied to Fedora machines
is working fine on all of them.
I'm wondering what is causing that, and what kind of flags may be added in order to achive binary compartibility - build on Fedora and run executables on any other Linux distributions.
please help me to find a solution to this as soon as possible..
Yeh, the only thing guaranteed to be the same across linux distros is the kernel. The dynamic runtime libs that you don't usually see are the likely cause of your problem, with the different systems maybe having different versions. I've never tried statically linking them so I'm not sure how it would be done, maybe a linker switch. It may be the STL libs but the behaviour of these is quite tightly specified so it's less likely.
Run ldd against the executable on the Fedora box to see which libraries it is built against and then check for those libraries on the Debian box.
It's worth noting that Debian is notoriously slow for bringing out 'latest' releases, preferring to ensure stability. Whereas Fedora is a virtual test bed for the up to the minute latest Red Hat stuff. You may have better luck running on Ubuntu rather than Debian.
i have tried static linking but that will increase the size of the program too much....... i think i can solve it by loading Dynamically linked shared object libraries (.so) ( including .so files which must be wanted by my program will be created inside my folder )
>> Dynamically loaded and linked during execution using the dynamic linking loader system functions.
but do you know any g++ linker options(flags) so that my executable program during loading loads the .so files from my folder ,not from the default system library location "/usr/lib".....
so if u know the g++ flag for that please tell me....
When you run any program, the program looks for the dynaic library files it needs using the $LD_LIBRARY_PATH environment variable. Add the path to you libraries to this. The -L compile option has no effect when running the executable.
Multiple versions of shared object libraries are often available on *nix systems; the ones listed with the plain-vanilla name are just hardlinks to the latest version (typically). You can query, load and use older versions though.
That's fine. You shouldn't be having any problems with dlls you create yourself. If you take a moment to look through that link I gave you you will find how to have your program search for library files however you want.