Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > Your Distro > Debian Linux Help > can u help me: binary incompatibility between different Linux distributions...

Forgot Password?
 Debian Linux Help   Discussions related to Debian GNU/Linux.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 08-28-2008   #1 (permalink)
Just Joined!
 
Join Date: Aug 2008
Posts: 8
Exclamation 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....................................
ancest is offline  



Reply With Quote
Old 08-28-2008   #2 (permalink)
Linux Enthusiast
 
Join Date: Mar 2008
Posts: 703
What's the situation like if you compile without debug symbols?

Also, give the version numbers of Debian and Fedora you use.
GNU-Fan is online now   Reply With Quote
Old 08-28-2008   #3 (permalink)
Linux Guru
 
coopstah13's Avatar
 
Join Date: Nov 2007
Location: NH, USA
Posts: 2,118
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
coopstah13 is online now   Reply With Quote
Old 08-31-2008   #4 (permalink)
Just 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?????
ancest is offline   Reply With Quote
Old 08-31-2008   #5 (permalink)
Just 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???????
ancest is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 05:30 PM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1