Bug 63517 - ./apachectl not working in AIX 7.2 and 7.1
Summary: ./apachectl not working in AIX 7.2 and 7.1
Status: RESOLVED INFORMATIONPROVIDED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.4.39
Hardware: Other AIX
: P2 blocker with 2 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-19 09:38 UTC by suyashi1994
Modified: 2020-09-05 05:12 UTC (History)
1 user (show)



Attachments
AIX_7.2 libs installed (997 bytes, text/plain)
2019-06-19 09:38 UTC, suyashi1994
Details

Note You need to log in before you can comment on or make changes to this bug.
Description suyashi1994 2019-06-19 09:38:45 UTC
Created attachment 36632 [details]
AIX_7.2 libs installed

./httpd -t or apachectl not working in AIX 7.2, IBM,8205-E6D

Steps followed :

PATH environment
Utilities like make and ar are in  /usr/bin and gcc is located in /usr/bin in AIX.
Set your PATH
export  PATH=$PATH:/usr/bin

set “export CC=gcc”

Create a folder as build_apache and place httpd-2.4.39
Give rights recursively to httpd-2.4.39 folder as :
Give permission to any folder chmod -R 777 "folder name" 

Build openssl 
§   gunzip/extract(tar xvf) source into a desired location Source location - http://www.openssl.org/source/

§   gzip –d openssl-tar.gz

§   tar  -xvf openssl-.tar

§   cd into openssl-

§   ./config shared  --prefix=/usr/local/ssl –openssldir=/usr/local/ssl

§   gmake

§   gmake install

Verify version, " /usr/local/ssl/bin/openssl version"

AIX-pcre

§   Download pcre from pcre.org
§   Put pcre in build_apache folder and do cd pcre

bash-4.3# cd /usr/local/build_apache/pcre-8.43
bash-4.3# ./configure --prefix=/usr/local/apache2/pcre
Make 
Make install

AIX-zlib

§   gunzip/extract(tar xvf) source into a desired location
§   cd into zlib
bash-4.3# cd /usr/local/zlib-1.2.11
bash-4.3# ./configure -prefix=/usr/local/apache2/zlib
Make 
Make install

AIX-http build 

§   gunzip/extract(tar xvf) source into a desired location     

§   Source location -http://httpd.apache.org/download.cgi#apache24

§   http://archive.apache.org/dist/httpd/

§    gzip –d httpd -2.4.39.tar.gz

§   tar  -xvf httpd -2.4.39.tar

§   cd into httpd-2.4.39

path before configure and make 
/usr/bin:/opt/freeware/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin

make clean

./configure --prefix=/usr/local/apache2 --enable-ssl=shared --enable-deflate=shared --enable-mods-shared=all --with-expat=builtin --with-z=/usr/local/apache2/zlib --with-pcre=/usr/local/apache2/pcre --with-ssl=/usr/local/ssl --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ --enable-v4-mapped

make 

path before make install
/opt/freeware/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin

make install .... works fine
 
cd /usr/local/apache2/bin
./httpd -t


Gives following error:

exec(): 0509-036 Cannot load program ./httpd because of the following errors:
rtld: 0712-001 Symbol __sync_fetch_and_add_8 was referenced
      from module /usr/local/apache2/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_fetch_and_sub_8 was referenced
      from module /usr/local/apache2/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_sub_and_fetch_8 was referenced
      from module /usr/local/apache2/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_val_compare_and_swap_8 was referenced
      from module /usr/local/apache2/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_lock_test_and_set_8 was referenced
      from module /usr/local/apache2/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.


Please find the list of libraries installed in attachment.
Comment 1 Randal T. Rioux 2020-08-29 23:09:01 UTC
I can confirm that I am reproducing the same error with Apache HTTPD 2.4.46 on IBM AIX 7.2 (7200-04-02-2016). 

Has any effort been done to diagnose/patch this issue?
Comment 2 Eric Covener 2020-08-29 23:44:40 UTC
(In reply to Randal T. Rioux from comment #1)
> I can confirm that I am reproducing the same error with Apache HTTPD 2.4.46
> on IBM AIX 7.2 (7200-04-02-2016). 
> 
> Has any effort been done to diagnose/patch this issue?


Looks like an APR issue not an HTTPD issue. This report has no info about the APR build other than that it must have used gcc.


Does it fail with a modern gcc?  Can you find libgcc at runtime?
Comment 3 Randal T. Rioux 2020-08-31 22:04:24 UTC
Here is my process, with versions listed. GCC is 8.3.0 and all necessary libraries appear to be located okay. Thanks for helping out!

# export CFLAGS="-mcpu=power7 -pipe -O2"
# CXXFLAGS=$CFLAGS
# export RM="/usr/bin/rm -f"
# export AR="/usr/bin/ar"
# export LDFLAGS="-Wl,-brtl"

# cd /usr/src
# wget https://mirrors.ocf.berkeley.edu/apache/apr/apr-1.7.0.tar.bz2
# tar xvfj apr-1.7.0.tar.bz2
# rm apr-1.7.0.tar.bz2 && cd apr-1.7.0
# ./configure --enable-threads
# make && make install

# cd /usr/src
# wget https://mirrors.ocf.berkeley.edu/apache/apr/apr-util-1.6.1.tar.bz2
# tar xvfj apr-util-1.6.1.tar.bz2
# rm apr-util-1.6.1.tar.bz2 && cd apr-util-1.6.1
# ./configure --with-apr=/usr/local/apr
# make && make install

# cd /usr/src
# wget https://mirrors.ocf.berkeley.edu/apache/httpd/httpd-2.4.46.tar.bz2
# tar xvfj httpd-2.4.46.tar.bz2
# rm httpd-2.4.46.tar.bz2 && cd httpd-2.4.46
# ./configure --enable-so --enable-cache --enable-mem-cache --enable-ssl --enable-dav --with-apr=/usr/local/apr
# make && make install

bash-5.0# /usr/local/apache2/bin/httpd 
exec(): 0509-036 Cannot load program /usr/local/apache2/bin/httpd because of the following errors:
rtld: 0712-001 Symbol __sync_fetch_and_add_8 was referenced
      from module /usr/local/apr/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_fetch_and_sub_8 was referenced
      from module /usr/local/apr/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_sub_and_fetch_8 was referenced
      from module /usr/local/apr/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_val_compare_and_swap_8 was referenced
      from module /usr/local/apr/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol __sync_lock_test_and_set_8 was referenced
      from module /usr/local/apr/lib/libapr-1.so(), but a runtime definition
      of the symbol was not found.
Comment 4 Randal T. Rioux 2020-09-05 05:12:55 UTC
After a lot of trial and error, I've discovered how vitally important the order of search is for library files.

The following environment variables worked for me (64-bit build), producing a fully functional installation of HTTPD (w/ APR and APR-Utils):

# export CFLAGS="-maix64 -mcpu=power7 -D_LARGE_FILES -pipe -O2 -L/usr/local/lib:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib64:/usr/lib -I/usr/local/include:/opt/freeware/include:/usr/include"
# CXXFLAGS=$CFLAGS
# export RM="/usr/bin/rm -f"
# export AR="/usr/bin/ar -X64"
# export NM="/usr/bin/nm -X64"
# export OBJECT_MODE=64
# export LDFLAGS="-maix64 -Wl,-b64 -Wl,-brtl -Wl,-blibpath:-L/usr/local/lib:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib64:/usr/lib"

apr-utils was configured with this:

./configure --with-apr=/usr/local/apr --with-iconv=/opt/freeware

and HTTPD was configured with this:

./configure --enable-so --enable-ssl --enable-dav --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-pcre=/opt/freeware/bin/pcre-config_64

Hopefully this helps someone else! :-)