Unix Technical Forum

Binary portability

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 ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 06:43 AM
hobbes_7_8@yahoo.com
 
Posts: n/a
Default Binary portability

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é

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 06:43 AM
Paul Pluzhnikov
 
Posts: n/a
Default Re: Binary portability

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 06:44 AM
hobbes_7_8@yahoo.com
 
Posts: n/a
Default Re: Binary portability

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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 06:44 AM
Rick Jones
 
Posts: n/a
Default Re: Binary portability

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...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com