Re: seg fault (core dump on AIX 4.3.3 )

On Wed, 11 Jul 2001 21:57:08 MDT, bowman <bowman montana com>  said:
> From: "Ashutosh Singh" <ashutoshvsingh hotmail com>
> > I built gtk version 1.2.8 and 1.2.9 and 1.2.10 and they are all
> > giving core dump, when you try to run the test files on AIX 4.3.3
> I'm running on AIX4.3, but the machine is at work, and I can't recall the
> setup? I am thinking I had to go with static libraries. Also, what

You can get shared libraries to work, with a little aggravation.  This
is what I ended up doing:

1) Hack up 'libtool' to not pass the '-berok' flag when building a shared
library.  This will cause errors when linking, so you have to:

2) Fix each tool to pass the added -lFoo flags needed to get rid of the
errors.  A lot of programs that use libtool to build are very lazy about
passing all the needed '-lXm -lXt -lX11 -lm' flags.

Technically speaking, you *can* get it to work just by doing (2) for
each program - but doing (1) enforces it as you don't get a clean build
till you get it right.

For the technically minded, here's the explanation of the problem:

The way the AIX linker is implemented, it only records the -lFoo flags
actually passed when a shared lib is created.  So let's say you create
a shared libfoo.a that calls something in libbar.a.  There's 2 possibilities:

1) You link with '-lbar'.  Libfoo.a then gets created with a reference to
libbar.a (use 'dump -H libfoo.a' to check).  At runtime, your program's
references to libbar.a get resolved, and all is fine.

2) You link with '-berok' and *dont* pass -lbar (which is what libtool does
by default - it likes to skip all the -lXt -lX11 -lm stuff).  Since you didn't
pass -lbar, no reference to libbar.a gets recorded in libfoo.a.  And since
you specified -berok, it gets flagged as an OK library.  At runtime, your
program's references to libfoo.a get resolved - but any libfoo.a references
to libbar.a are *not* resolved even if some other module/library DOES
reference libbar.a - the runtime binder says "no reference in libfoo.a, no
need to fixup".  Your program then crashes when it branches through an
unresolved function pointer thinking it's heading to libbar.a.

Attachment: pgpUEN4BiZQU4.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]