Subject: Re: pkgsrc/AIX
To: <>
From: Michael <macallan18@earthlink.net>
List: tech-pkg
Date: 07/05/2004 19:16:38
Hello,

>> I'm fooling around with pkgsrc on AIX 4.3.2 for a while now and got
>> quite a lot of things to work ( usually with some hacking ) - is there
>> a mailing list specific to pkgsrc/AIX? On netbsd.org or pkgsrc.org I
>> couldn't find one.
>
> No - tech-pkg@NetBSD.org is fine!
> (pkgsrc.org is right now mostly an alias for NetBSD.org ...)

ok :)

The biggest problem on AIX is libtool ( in my opinion at least ) - to 
get things linked it usually just allows unresolved symbols which leads 
to segmentation faults because by default AIX doesn't do any real 
runtime linking - it only resolves symbols in the main binary and hopes 
that no lib has unresolved symbols. Enabling the runtime linker 
(-Wl,-brtl on all binaries and libs) doesn't solve all problems, 
sometimes it just doesn't find symbols defined in other libs, so we 
should better make sure that all libraries are always fully linked (or 
at least make the linker barf on unresolved symbols by setting 
-Wl,-bernotok, that's still better than random segfaults ) - that's 
nearly always possible, the only exceptions are modules that import 
symbols from the main binary. Since I'm absolutely no expert on libtool 
and friends I'm posting some thoughts here :)
In my opinion we should:
- never blindly set -Wl,-berok on any binary because that enables 
unresolved symbols which nearly always leads to segfaults (libtool does 
that...)
- always set -Wl,-brtl and/or -Wl,-brtllib to enable the runtime linker 
( only really needed for loadable modules but it doesn't hurt either )
- probably add -Wl,-bbigtoc to enable more than 16k symbols ( some libs 
need that )
- prevent stripping of certain binaries ( and add -Wl,-bexpall to 
export all symbols) that use modules which rely on symbols from the 
main binary, like xmms for instance.
With this and some hacking ( mainly adding -lthis -lthat and so on ) I 
was able to get gtk 1 and 2, xfce4, gaim and a bunch of other things to 
work ( gnome2 doesn't work yet - programs hang in libbonobo for some 
reason, right now I'm hacking mozilla. The official binaries need AIX 
4.3.3 and just segfault on my box )

To help resolving library dependencies ( libtool is no real help there 
) I wrote two small python scripts - one that reads the symbol tables 
of all libraries it encounters and feeds them into a database and 
another that queries the database for symbol names and tells you which 
lib(s) export matching symbols ( not perfect but still better than 
grepping libraries... )
and...
- pkgsrc should install install-sh on AIX too, AIX's install doesn't 
understand some command line options that other programs frequently use
- use gawk, gm4 and so on whenever possible, AIX's versions are either 
broken or too old
- avoid AIX's indent - it crashes if input gets too big
- maybe set MOTIFBASE=/usr/dt - can't think of any good reason to use 
lesstif or OpenMotif on AIX, IBM's motif seems to be pretty ok.

that's it for now

have fun
Michael