User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,933 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,446 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 701 | Replies: 7
Reply
Join Date: Nov 2007
Posts: 18
Reputation: varsha0702 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
varsha0702 varsha0702 is offline Offline
Newbie Poster

how to create a Linux distro independent code

  #1  
May 16th, 2008
Hi..
I have created a shared object by developing and compiling it on RHEL 5.
Than I tried to use same shared object on RHEL 4 and SuSe 10.0.But it didn t work.Error message shown was " Floating point exception". Machine architecture was same for all the three distos.
So I want to know is it possible to compile a code in such a way that if it is compiled on RHEL 5 machine, same compiled code should work on any other Linux distros? If yes than how?

Thanx in Advance...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: how to create a Linux distro independent code

  #2  
May 16th, 2008
it should work on all distros. Most likely due to bad programming.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Nov 2007
Posts: 18
Reputation: varsha0702 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
varsha0702 varsha0702 is offline Offline
Newbie Poster

Re: how to create a Linux distro independent code

  #3  
May 16th, 2008
Originally Posted by jbennet View Post
it should work on all distros. Most likely due to bad programming.


Its a sample code downloaded from Intel site. Which I have compiled to shared object.
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,504
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 275
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: how to create a Linux distro independent code

  #4  
May 16th, 2008
Tell me which language the code is written in, and I'll move it to the appropriate forum. Lounges aren't meant for support questions, and you'll receive better help if it's in the Software Development forums.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Nov 2007
Posts: 18
Reputation: varsha0702 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
varsha0702 varsha0702 is offline Offline
Newbie Poster

Re: how to create a Linux distro independent code

  #5  
May 19th, 2008
Originally Posted by John A View Post
Tell me which language the code is written in, and I'll move it to the appropriate forum. Lounges aren't meant for support questions, and you'll receive better help if it's in the Software Development forums.


Its written in C++.
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,504
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 275
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: how to create a Linux distro independent code

  #6  
May 19th, 2008
Moved.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Apr 2008
Posts: 295
Reputation: tesuji is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 41
tesuji tesuji is offline Offline
Posting Whiz in Training

Re: how to create a Linux distro independent code

  #7  
May 19th, 2008
so why not telling us how to get that example code from INTEL side?
Reply With Quote  
Join Date: Dec 2006
Location: india
Posts: 1,074
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Rep Power: 9
Solved Threads: 161
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: how to create a Linux distro independent code

  #8  
May 19th, 2008
> So I want to know is it possible to compile a code in such a way that if it is compiled
> on RHEL 5 machine, same compiled code should work on any other Linux distros?
the problem is caused by changes in the ELF binary format between RHEL4/FC5 and RHEL5/FC6 or later. (the hash section and the hash format for symbol resolution has changed).
while RHEL5/FC6 and newer can handle both types of hash format, only the classical 'sysv' format is supported by older versions.
to make elf binaries which are backward compatible, use the linker switch --hash-style=sysv
for example while compiling with g++, use -Wl,--hash-style=sysv
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the C++ Forum

All times are GMT -4. The time now is 12:08 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC