Subject: AIX 5.3 and ld
To: None <tech-pkg@netbsd.org>
From: Peter Schmiedeskamp <pschmied@yahoo.com>
List: tech-pkg
Date: 02/16/2005 06:36:47
Helllo, after a bit of a hiatus from pkgsrc/aix, I'm
back on the trail.

I successfully bootstrapped pkgsrc on a brand new
shiny installation of AIX 5.3.  Unfortunately, I
haven't had much luck building packages from pkgsrc. 
So far, I've been able to get the following to build:

digest-20021220     Message digest wrapper utility
patch-2.5.4nb2      Patch files using diff output
gzip-base-1.2.4b    Compress or expand files
gzip-info-1.2.4a    Info format documentation for the
GZIP utility
gzip-1.2.4b         The "meta-package" for the GZIP
compression utility
gtexinfo-4.7nb1     GNU info file manipulation
utilities

The next thing I try to build is zsh (the crusty old
version of ksh that IBM includes with AIX is nearly
unusable).  The zsh build fails, with the following:

gcc -Wl,-R/usr/pkg/lib/zsh -Wl,-R/usr/pkg/lib  -shared
-o parameter.so -Wl,-bI:../../Src/zsh.export
-Wl,-bE:parameter.export -emodentry parameter..o 
../../Src/modentry..o  -liconv -ldl -lcurses -ltermcap
-lm  -lc
ld: 0706-027 The -R /usr/pkg/lib/zsh flag is ignored.
ld: 0706-027 The -R /usr/pkg/lib flag is ignored.
gcc -c -I.  -DHAVE_CONFIG_H -DMODULE -O  -o socket..o
socket.c
In file included from socket.c:33:
/usr/include/sys/socket.h:336: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:340: error: parse error
before "msg_controllen"
/usr/include/sys/socket.h:342: error: parse error
before '}' token
/usr/include/sys/socket.h:366: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:370: error: parse error
before '}' token
/usr/include/sys/socket.h:437: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:438: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:439: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:440: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:446: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:447: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:448: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:452: error: parse error
before "socklen_t"
/usr/include/sys/socket.h:453: error: parse error
before "socklen_t"
socket.c: In function `bin_zsocket':
socket.c:64: error: `socklen_t' undeclared (first use
in this function)
socket.c:64: error: (Each undeclared identifier is
reported only once
socket.c:64: error: for each function it appears in.)
socket.c:64: error: parse error before "len"
socket.c:189: error: `len' undeclared (first use in
this function)
*** Error code 1

Stop.
bmake: stopped in
/usr/pkgsrc/shells/zsh/work/zsh-4.2.1/Src/Modules
*** Error code 1
1 error

bmake: stopped in
/usr/pkgsrc/shells/zsh/work/zsh-4.2.1/Src
*** Error code 2

Stop.
bmake: stopped in
/usr/pkgsrc/shells/zsh/work/zsh-4.2.1/Src
*** Error code 1
1 error

bmake: stopped in
/usr/pkgsrc/shells/zsh/work/zsh-4.2.1
*** Error code 2

Stop.
bmake: stopped in /usr/pkgsrc/shells/zsh
===> 
===> There was an error during the ``build'' phase.
===> Please investigate the following for more
information:
===>      * log of the build
===>      * /usr/pkgsrc/shells/zsh/work/.work.log
===> 
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/shells/zsh




I noticed another warning message earlier in the build
that warns:
ld: 0706-027 The -R /usr/pkg/lib/zsh flag is ignored.
ld: 0706-027 The -R /usr/pkg/lib flag is ignored.

This error message appears to be valid.  The AIX
linker does not support the -R flag*. *Actually, in
AIX 5.3 the linker has an "SVR4 affinity" flag
(-bsvr4) that, when set, allows the -R flag.

AIX has some *cough* unique views of shared libraries.
 There was just a DeveloperWorks article
(http://www-106.ibm.com/developerworks/eserver/articles/gnu.html)
that explains some of these issues.

So, I've got three questions:
1. What is the proper place to set the flags I want
passed to ld?
2. Do I have to set these same flags to be passed to
gcc?  How?
3. Does pkgsrc offer an alternative to using the "-R"
flag during linking? (This is important if pkgsrc is
to work properly on systems prior to 5.3)


#####
For a bit of background on what I did to get pkgsrc
bootstrapped on AIX 5.3, here's what I had to do:
1. Installed gmake, bash, gcc, and gzip from IBM AIX
Toolbox
(http://www-1.ibm.com/servers/aix/products/aixos/linux/download.html)

2. Because GCC from IBM toolbox is for AIX 5.2, I
built gcc 3.4.3 by hand and installed in /usr/gcc34/

3. Removed IBM's old gcc

4. Symlinked all libraries, binaries, includes, etc
from the /usr/gcc34 directory into their respective
folders (/usr/lib, /usr/bin/, /usr/includes, etc)

5. export CC=/usr/bin/gcc

6. Bootstrap pkgsrc

7. Symlink /opt/freeware/bin/zcat /usr/pkg/bin/zcat

8. Set a slew of options in mk.conf (some of these are
probably not correct or needed.  Can anybody help
here?): 
MACHINE_GNU_PLATFORM=powerpc-ibm-aix5.3.0.0
CC=/usr/bin/gcc
CHECK_SHLIBS=no
RENAME=
PKGMAKECONF=${MAKECONF}
PKGSRC_COMPILER=gcc
CONFIG_SHELL=/opt/freeware/bin/bash
SHELL=/opt/freeware/bin/bash
SH=/opt/freeware/bin/bash
(I'm not sure which of or even if either of these
work, but I know that the AIX included ksh causes
problems)
MAKE_FLAGS+="-j2" (speeds up builds dramatically when
you have multiple, slow processors.)

9. install from pkgsrc: devel/patch
10. remove symlink: /usr/pkg/bin/zcat
11. install archivers/gzip


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250