Welcome! Log In Create A New Profile

Advanced

unable to generate an nginx dynamic library on IBM AIX system using xlc++ compiler

Posted by raadiy 
unable to generate an nginx dynamic library on IBM AIX system using xlc++ compiler
January 27, 2023 05:11AM
Hi,

I am trying to build a dynamic nginx load module on IBM AIX 7.2.0.
I am using IBM C++ compiler - xlc++ version 13.1.3.
The version of nginx that I am using is 1.22.1.

I am unable to successfully generate an nginx load module for use with dynamic linking.
Here are the steps that i followed.

1. Obtain nginx 1.22.1 source from http://nginx.org/en/download.html
2. unzip and untar nginx tar file and get the source tree
3. Configure nginx as follows:
./configure --prefix=/home/raadiy/nginx_test3 --builddir=/home/raadiy/nginx_test3 --with-cc=/opt/IBM/xlC/13.1.3/bin/xlc++ --with-cc-opt="-qlanglvl=extended0x -D__IBMCPP_TR1__ -q32 -I/opt/IBM/xlC/13.1.3/include" --with-ld-opt="-bnoipath -brtl -bexpfull -L /opt/IBM/xlC/13.1.3/lib " --with-http_ssl_module --without-http_rewrite_module --without-http_gzip_module --with-compat --with-http_v2_module --with-http_stub_status_module --modules-path=/home/raadiy/nginx_test3/nginx_modules

4. configure is successfull, and I run the makefile and get the nginx binaries.
so far, so good.

5. Next I try to generate the dynamic library as follows:

./configure --prefix=/home/raadiy/nginx_test3 --builddir=/home/raadiy/nginx_test3 --with-cc=/opt/IBM/xlC/13.1.3/bin/xlc++ --with-cc-opt="-qlanglvl=extended0x -D__IBMCPP_TR1__ -q32 -I/opt/IBM/xlC/13.1.3/include " --with-ld-opt="-bnoipath -brtl -bexpfull -L /opt/IBM/xlC/13.1.3/lib" --with-http_ssl_module --without-http_rewrite_module --without-http_gzip_module --with-compat --with-http_v2_module --with-http_stub_status_module --add-dynamic-module=/iscp/fs03/eadiraa/ababu/.ngrest/ngrest/modules/nginx_module_dyn --modules-path=/home/raadiy/my_nginx_modules

6. The configure is successful as above, if I include "-qmkshrobj" in the configure command as part of "--with-cc-opt" to indicate to xlc++ to generate a shared object, the build fails with the following:

checking for int size ...Could not load program /pt/raajesh/ngsii/nginx_test3/autotest:
The program does not have an entry point or
the o_snentry field in the auxiliary header is invalid.
Examine file headers with the 'dump -ohv' command.
bytes

After some looking around, i decided to remove the "-qmkshrobj" from the --with-cc-opt in the configure command line and it finally succeeded.

7. Next I ran the make file from step 6 as "make modules". It failed since the "-shared" option is not suitable to the "xlc++" compiler. I modified the make file to use "-qmkshrobj" instead of "-shared", and then ran the make file as "make modules". This time it generated the following link/load errors.

ld: 0711-317 ERROR: Undefined symbol: .ngx_pcalloc
ld: 0711-317 ERROR: Undefined symbol: ngx_http_core_module
ld: 0711-317 ERROR: Undefined symbol: .ngx_http_read_client_request_body
ld: 0711-317 ERROR: Undefined symbol: .ngx_http_send_header
ld: 0711-317 ERROR: Undefined symbol: .ngx_http_output_filter
ld: 0711-317 ERROR: Undefined symbol: .ngx_http_finalize_request
ld: 0711-317 ERROR: Undefined symbol: .ngx_list_push
ld: 0711-317 ERROR: Undefined symbol: .ngx_read_file
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: 1254-004 The error code from the last command is 8.

8. I am unable to go past this, and generate a shared object which loaded successfully. I attempted to build libraries of the various object files generated by nginx (core, http, ssl ) etc, generated in step 4 above and used those in the make file above, the shared object was generated, but nginx dumps core inside the module while trying to set the configuration.


I believe I should not be modifying the makefile by hand, and that merely supplying the right options to the configure stage should suffice. However I tried the above steps to see if i could debug the issue.

Any thoughts or suggestions, would be of immense help.

Thank you
raadiy
Hi,

I later modified the generated makefile where it builds the modules to replace "-shared" with "-G". Perhaps nginx developers can modify the build for AIX to include this.

Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 269
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready