This is a discussion on Binary portability within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> Hi everybody! I have two servers. On the development server I compiled hello world: ---------- $ uname -a HP-UX ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi everybody! I have two servers. On the development server I compiled hello world: ---------- $ uname -a HP-UX porsx008 B.11.11 U 9000/800 2647643434 unlimited-user license $ g++ hello.cpp -o hello $ hello Hello, world! $ chatr +s enable hello [...] $ hello Hello, world! $ odump -sllibloadlist hello Shared Library Load List for hello: Order Name 0 hello 1 ^ /usr/local/lib/libstdc++.sl 2 ^ ^ /usr/lib/libm.2 3 ^ ^ /usr/lib/libc.2 4 ^ ^ ^ /usr/lib/libdld.2 5 ^ /usr/lib/libm.2 6 ^ /usr/lib/libc.2 7 ^ ^ /usr/lib/libdld.2 ---------- .... then I transfer this binary to the production machine, along with the libraries it depends on: ---------- PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->uname -a HP-UX porsx013 B.11.11 U 9000/800 3010439678 unlimited-user license PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->export SHLIB_PATH=`pwd` PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->odump -sllibloadlist hello Shared Library Load List for hello: Order Name 0 hello 1 ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libstdc++.sl 2 ^ ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libm.2 3 ^ ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libc.2 4 ^ ^ ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libdld.2 5 ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libm.2 6 ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libc.2 7 ^ ^ /home/ebs_jm/utils/jmdm/effMerger/orig/libdld.2 PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->hello Memory fault(coredump) ---------- .... so it seems the same binary doesn't run on these two machines. Does anyone knows a way around this problem? Thanks in advance, André |
| |||
| hobbes_7_8@yahoo.com writes: > PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->hello > Memory fault(coredump) > ---------- > ... so it seems the same binary doesn't run on these two machines. Does > anyone knows a way around this problem? The binary may simply be buggy, or depend on *other* files which you didn't transfer. If however it's a simple "Hello, world!", then there must be a different reason. The other likely reason is that the 2 systems are at a different patchlevel of /lib/dld.sl ("what /lib/dld.sl" will tell you). If so, you are forcing a crash by "mixing and matching" dld.sl from one machine with libc.2 and libdld.2 from another. As a general rule, you should never copy *system* libraries between machines (copying "user" libraries and libstdc++ is fine). Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| Hi! All these experiments were made with gcc. But now I tried aCC instead and everything works fine, so it seems the binaries produced with this compiler are more portable that the ones produced with gcc. Regards, André Paul Pluzhnikov wrote: > hobbes_7_8@yahoo.com writes: > > > PROD - ebs_jm@porsx013 [/home/ebs_jm/utils/jmdm/effMerger/orig] ->hello > > Memory fault(coredump) > > ---------- > > ... so it seems the same binary doesn't run on these two machines. Does > > anyone knows a way around this problem? > > The binary may simply be buggy, or depend on *other* files which > you didn't transfer. If however it's a simple "Hello, world!", > then there must be a different reason. > > The other likely reason is that the 2 systems are at a different > patchlevel of /lib/dld.sl ("what /lib/dld.sl" will tell you). > > If so, you are forcing a crash by "mixing and matching" dld.sl from > one machine with libc.2 and libdld.2 from another. > > As a general rule, you should never copy *system* libraries between > machines (copying "user" libraries and libstdc++ is fine). > > Cheers, > -- > In order to understand recursion you must first understand recursion. > Remove /-nsp/ for email. |
| ||||
| hobbes_7_8@yahoo.com wrote: > All these experiments were made with gcc. But now I tried aCC > instead and everything works fine, so it seems the binaries produced > with this compiler are more portable that the ones produced with > gcc. You should compare the ldd output between the two binaries. I suspect that will help you find the delta and it will probably be in the gcc runtime environment. rick jones -- portable adj, code that compiles under more than one compiler these opinions are mine, all mine; HP might not want them anyway... feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH... |