| | |
how to create a Linux distro independent code
![]() |
•
•
Join Date: Nov 2007
Posts: 18
Reputation:
Solved Threads: 0
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...
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...
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> 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
for example while compiling with g++, use
> 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 ![]() |
Other Threads in the C++ Forum
- Previous Thread: Knights Tour Problem
- Next Thread: combination of strings
| Thread Tools | Search this Thread |
api application array based binary bitmap c# c++ c/c++ char class classes code coding compile compression console conversion count cpm delete deploy deque desktop developer dialog directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer introductory java lib linkedlist linkednodes linker loop looping loops map math matrix memory multiple news node numbertoword output parameter pointer problem program programming project python random read recursion reference rpg security sorting string strings temperature template test text text-file tree url variable vector video whyisthiscodecausingsegmentationfault win32 windows winsock wordfrequency wxwidgets






