DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   how to create a Linux distro independent code (http://www.daniweb.com/forums/thread124503.html)

varsha0702 May 16th, 2008 3:01 am
how to create a Linux distro independent code
 
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...

jbennet May 16th, 2008 3:57 am
Re: how to create a Linux distro independent code
 
it should work on all distros. Most likely due to bad programming.

varsha0702 May 16th, 2008 4:33 am
Re: how to create a Linux distro independent code
 
Quote:

Originally Posted by jbennet (Post 608059)
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.

John A May 16th, 2008 7:58 pm
Re: how to create a Linux distro independent code
 
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.

varsha0702 May 19th, 2008 6:10 am
Re: how to create a Linux distro independent code
 
Quote:

Originally Posted by John A (Post 608571)
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++.

John A May 19th, 2008 4:13 pm
Re: how to create a Linux distro independent code
 
Moved.

tesuji May 19th, 2008 4:46 pm
Re: how to create a Linux distro independent code
 
so why not telling us how to get that example code from INTEL side?

vijayan121 May 19th, 2008 9:19 pm
Re: how to create a Linux distro independent code
 
> 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


All times are GMT -4. The time now is 12:07 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC