Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message.

add shr4.o shared members from /usr/lib/libiconv.a to  /opt/freeware/lib/libiconv.a
add shr.o shared members from /usr/lib/libiconv.a to  /opt/freeware/lib/libiconv.a
add shr4_64.o shared members from /usr/lib/libiconv.a to  /opt/freeware/lib/libiconv.a

How do I go about adding these shared members to the /opt/freeware/lib/libiconv.a?
Edit: my first thought is to link the two using ln as below, but I would appreciate anyone's input.

ln -sf /usr/lib/libiconv.a /opt/freeware/lib/libiconv.a

Thanks!

Adding that link didn't work. I get the following error when I try to do a make of php 5.3.14

/softwarelocal/apache/SQL_and_PHP/php-5.3.14# ./configure --prefix=/opt/freeware/php --with-apxs2=/opt/freeware/sbin/apxs --with-config-file-path=/opt/freeware/etc/httpd/conf --with-gd --with-zlib-dir=/opt/freeware/lib --enable-shared --disable-static --with-png-dir=/opt/freeware/lib --with-zlib --with-bz2=/opt/freeware/bin  --with-libxml-dir=/opt/freeware/lib --with-jpeg-dir=/opt/freeware/lib --with-png-dir=/opt/freeware/lib --with-xpm-dir=/opt/freeware/lib --with-freetype-dir=/opt/freeware/lib --with-mysql=/opt/freeware/mysql/mysql5.1 --host=powerpc-ibm-aix7.1.0.0
/softwarelocal/apache/SQL_and_PHP/php-5.3.14#/opt/freeware/bin/make
~
ld: 0711-317 ERROR: Undefined symbol: .libiconv_open
ld: 0711-317 ERROR: Undefined symbol: .libiconv
ld: 0711-317 ERROR: Undefined symbol: .libiconv_close
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
make: *** [sapi/cli/php] Error 1

I then did a 'make clean' (specifying the full path of make again, so as to not use AIX's make) and then removed the link and reinstalled the libiconv rpm.
I then used the same configure args above and run into the following

/softwarelocal/apache/SQL_and_PHP/php-5.3.14#/opt/freeware/bin/make
~
Generating phar.php
exec(): 0509-036 Cannot load program /softwarelocal/apache/SQL_and_PHP/php-5.3.14/sapi/cli/php because of the following errors:
        0509-022 Cannot load module /opt/freeware/lib/libfreetype.a(libfreetype.so.6).
        0509-150   Dependent module /usr/local/mysql/lib/libz.a(libz.so.1) could not be loaded.
        0509-152   Member libz.so.1 is not found in archive
        0509-022 Cannot load module php.
        0509-150   Dependent module /opt/freeware/lib/libfreetype.a(libfreetype.so.6) could not be loaded.
        0509-022 Cannot load module .
make: *** [ext/phar/phar.php] Error 255

I've also tried building it just using AIX's compiler, contrary to all the write-ups I've seen, but that always fails with the following:

/bin/sh /softwarelocal/apache/SQL_and_PHP/php-5.3.14/libtool --silent --preserve-dup-deps --mode=compile /softwarelocal/apache/SQL_and_PHP/php-5.3.14/meta_ccld  -Imain/ -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/main/ -DPHP_ATOM_INC -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/include -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/main -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14 -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/ext/date/lib -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/ext/ereg/regex -I/opt/freeware/include/libxml2 -I/usr/include/freetype2 -I/opt/freeware/mysql/mysql5.1/include -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/ext/sqlite3/libsqlite -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/TSRM -I/softwarelocal/apache/SQL_and_PHP/php-5.3.14/Zend  -D_THREAD_SAFE  -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS   -c main/internal_functions_cli.c -o main/internal_functions_cli.lo
        echo '\
\
Generating phar.php
/bin/sh[14]: /softwarelocal/apache/SQL_and_PHP/php-5.3.14/sapi/cli/php:  not found.
make: 1254-004 The error code from the last command is 127.


Stop.

Any suggestions?

EDIT: the basic instructions I've been going off of are here - IBM Developer

I wonder why it doesn't suffice to add the library and its path to the "LIBPATH" (or similar) environment variable, so that it is found when needed. I don't know if using softlinks instead has any chance of working, but it "feels wrong" from the start IMHO.

Use the ar command to extract the mentioned objects from the library /usr/lib/libiconv.a , then put them into the library /opt/freeware/lib/libiconv.a . If this library doesn't exist create it from scratch. This should work.

See the man page of ar for details and the AIX compiler reference manual for details about the linkage editor of the Xlc compiler.

I hope this helps.

bakunin

After digging into this a little further it is (now) my understanding that the libraries are slightly different, so linking or pointing to the /usr/lib by updating the variable creates a mess when I try to get something to compile using the GNU libiconv.

I'll try your suggestion using ar shortly and update the thread accordingly. Thank you for your help,
Dan

1 Like

Dan,

I am running into the exact same problem when trying to compile PHP 2.4.3.

Have you had any luck fixing this problem? What steps did you take to get it to work? I am running the latest AIX RPM of libiconv. I do not appear to have a /usr/lib/libiconv.a on my system. I do have one in /opt/freeware/lib.

Thanks!

Have you set the variables "LD_LIBRARY_PATH" and "LIBPATH" both to the respective locations?

Some programs from the Solaris/Linux world expect $LD_LIBRARY_PATH to evaluate to the library location and don't care for the AIX pendant $LIBPATH, which is why it is a good safety measure to set both.

I hope this helps.

bakunin