Results 1 to 5 of 5
i have some problem with my c program.
I build a really `short` application under Fedora
int main()
{
return 0;
}
On both above platforms, it is build with ...
- 08-28-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 8
can u help me: binary incompatibility between different Linux distributions...
i have some problem with my c program.
I build a really `short` application under Fedora
int main()
{
return 0;
}
On both above platforms, it is build with command:
g++ -g -O0 -m32 test.cpp,
where test2.cpp is a file with above mentioned code.
I move the binary output - a.out - to my Debian box.
Attempt to execute it is immediately failing with
`Floating point exception`.
Building above code on Debian and executing:
no problem - it is doing nothing, but not crashing...
moving the binary, build on Debian to Fedora
and running it - no problem, doing nothing, not crashing.
I would really appreciate any idea how to explain such behavior, and,
possibly, an advice what should be done in order to create binary compatible programs in C++ for any popular Linux distributions so that i don't have to compile it before running it in any new machine......
Can anyone help me please....................................
- 08-28-2008 #2
What's the situation like if you compile without debug symbols?
Also, give the version numbers of Debian and Fedora you use.
- 08-28-2008 #3
are the OS two different architecture? if fedora is 64 bit and debian is 32 bit it would explain your problem, since a binary compiled on a 32 bit system can run on a 64 bit, but a 64 bit compiled binary can't run on a 32 bit system
- 08-31-2008 #4Just Joined!
- Join Date
- Aug 2008
- Posts
- 8
Static linking can solve this issue......but....
i have tried static linking but that will increase the size of the program too much but the executable runs without any problem in any version of Linux.......
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 the specified folder ,not from the default system library location "/usr/lib".....
so if u know the g++ flag for that please tell me....
will gcc -L /home/mylib file.cpp -l(.so file name) helps?????
- 08-31-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 8
My intension is not to make it compatible with older versions....i want my program to use my shared object files without any problem.
currently.... my program during running searches Dynamically linked shared object libraries (.so) in /usr/lib only.....
i want my object code to search .so files in the location that i must prefer (in some folder like /home/mylib or in current directory).....
What must i do to make such object code????
is there any gcc linker options???????


Reply With Quote
