FAQ: Porting Opensource packages to AIX PDF Print E-mail
User Rating: / 4
Written by Michael Felt   

I have been spending some time lately porting opensource packages to AIX. For rootvg forums I am dependent on PHP for example, and as I look for ways to improve things I discover I need yet another module added into php. By the way, php has always been one of the harder opensource packages to get compiled.

Initially, there are just a few questions - because I'll only add a question AFTER I have the anwser.

Q. What steps are needed to compile an opensource package?
A. Generally, for AIX the steps are the same as for any *nix platform. Have a working compiler, download the package - ususally a compressed tar file (.gz, tgz, bz2, zip),uncompress and extract the source files to a seperate directory, cd to the package "root", and run the sequence: ./configure; make; make test; make install.

Q. What are common problems with porting opensource on AIX, or *nix?
A. The most common problem is not having a requirement already installed. For example, some projects require gnumake, a specific version of autoconf or libtool to configure or make (build). The may be requirements at link time (configure generally checks for these first) such as libz.a or libssl.a (Z compression and openssl support). And these requirements might have requirements.

Q. What is wrong? I am getting a message (exec(): 0509-036 Cannot load program sapi/cli/php because of the following errors:) that a library cannot be found but the link worked fine?
A. The AIX linker seems to have a different way of looking at resolving things than the program does at runtime. I have run into this a couple of times while building PHP. In this case - after I built curl support into PHP.
Build complete.
Don't forget to run 'make test'.

michael@x054:[/data/home/michael/prj/php5.2-200910031430]r sapi
sapi/cli/php -v
exec(): 0509-036 Cannot load program sapi/cli/php because of the following errors:
        0509-022 Cannot load module /usr/local/lib/libcurl.a(libcurl.so.4).
        0509-150   Dependent module /usr/local/ssl/lib/libcrypto.a(libcrypto.so.0.9.8) could not be loaded.
        0509-152   Member libcrypto.so.0.9.8 is not found in archive
        0509-022 Cannot load module php.
        0509-150   Dependent module /usr/local/lib/libcurl.a(libcurl.so.4) could not be loaded.
        0509-022 Cannot load module .

This can be fixed by specifying a LIBPATH environment specific for this application:
LIBPATH=/usr/local/lib:/usr/lib sapi/cli/php -v
PHP 5.2.12-dev (cli) (built: Oct  3 2009 15:54:54)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
This is how you are able to override the default, or compiled, LIBPATH in the application.

Q. How can I see an applications default LIBPATH settings.
A. dump -H application
michael@x054:[/data/home/michael/prj/php5.2-200910031430]r dump
dump -H sapi/cli/php

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00001574       0x0000d0a1       0x0000017a      

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x0000000b       0x000bca8c       0x0001de11       0x000bcc06      

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER             
0      /usr/local/lib:/usr/local/ssl/lib:/usr/lib/lib:/usr/local/mysql/lib:/usr/vac/lib:/usr/lib:/lib                                        
1                                    libmysqlclient.so                      
2      /usr/local/lib                libfreetype.a       libfreetype.so.6   
3      /usr/local/lib                libpng12.a          libpng12.so.0      
4                                    libiconv.a          shr4.o             
5      /usr/local/lib                libcurl.a           libcurl.so.4       
6      /usr/local/lib                libxml2.a           libxml2.so.2       
7                                    libpthread.a        shr_comm.o         
8                                    libpthread.a        shr_xpg5.o         
9                                    libc.a              shr.o              
10                                   librtl.a            shr.o              

Q. How can I modify the default LIBPATH for an opensource package.
A. You need to specify the -blibpath argument to the LDFLAGS environment variables (it must be exported!) before running ./configure.
export LDFLAGS='-blibpath:/usr/lib/local:/usr/lib:/usr/local/mysql/lib'

Q. What is the best default directory?
A. I don't dare say which is best. There are, in my opinion, two good choices on AIX. Either /usr/local or /opt/local. The directory /usr/local is very popular in the rest of the *nix world. However, when AIX 5L (for Linux Affinity) came out IBM introduced the the /opt directory for optional software. Bull Freeware and AIX RPM packages seem to prefer the /opt directory as a root rather than /usr. I used /usr/local for years. And even though I say /usr/local and /opt/local are the two expected choices I have chosen to use a non-standard directory for installation - /data/local - and I keep it outside of the rootvg voulme group. Because most configure scripts expect include files, libraries, etc in /usr/local (and some even have /opt/local) I have a symbolic link for /usr/local pointing to /data/local.(ln -s /data/local /usr/local). In any case I highly recommend a seperate logical volume and file system - ideally seperate form rootvg volume group.

Q. How can I get a hung "make test" to complete?
A. Most of the time there are tests that fail - so called known bugs. But sometimes a test just hangs for hours. I made the mistake of pressing 'ctrl-C' to stop the failed test - but it stopped the whole make test process. To get a finished report I had to start the tests again, and then when the test hangs - use ps to find the process ID of the test and kill it seperately. The test monitor program will see that the test has not completed properly, mark it as a FAIL, and start the next test. And when the final test completes you will have a test report you can save and/or send to the opensource developers.

< Prev   Next >