Bug 38805

Summary: Undefined symbols ld error on apache 1.3.34 build on AIX 5.3 using gcc in 64 bit mode
Product: Apache httpd-1.3 Reporter: bpinch
Component: BuildAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED WORKSFORME    
Severity: blocker Keywords: ErrorMessage
Priority: P2    
Version: 1.3.34   
Target Milestone: ---   
Hardware: HP   
OS: AIX   

Description bpinch 2006-02-28 12:21:43 UTC
My initial symptoms were very similar to 
http://issues.apache.org/bugzilla/show_bug.cgi?id=37006 ie "pthread" error 
when compiling under AIX 5.3 using gcc 3.3.2 This said gcc version too old, 
get a GCC for aix 5.3  from 
http://www-03.ibm.com/servers/aix/products/aixos/linux/ezinstall.html and 
install gcc, gcc plusplus, c++ libs and c++devel libs and then the errors are 
gone.....

Which I have, and after a make distclean, the _compilation_ under gcc worked 
but I have an error I am unable to resolve with an undefined symbol with ld on 
AIX.

My compile/link/configure options for gcc/AIX 5.3 for a 64 bit compile are:-
#CFLAGS="-maix64"; export  CFLAGS; LDFLAGS="-maix64"; export  LDFLAGS; 
#EXTRA_LDFLAGS_SHLIB="-b64"; export  EXTRA_LDFLAGS_SHLIB; 

For the archiving program (ar) I set the -Xany option in the *.tmpl files and 
again in ./src/modules/standard/Makefile after  running ./configure

#./configure --prefix=$PREFIX--enable-shared=max --enable-module=most --with-
port=$PORT
#make

The following is the error message without adding -bnoquiet to 
EXTRA_LDFLAGS_SHLIB.

Target "default" is up to date.
<=== src/lib
===> src/modules
===> src/modules/standard
        gcc -c  -I../../os/unix -I../../include   -DAIX=530 -U__STR__ -
DAIX_BIND_PROCESSOR -DUSE_HSREGEX -maix64 `../../apaci` mod_so.c
        rm -f libstandard.a
        ar -Xany cr libstandard.a mod_so.o
        ranlib libstandard.a
        gcc -c  -I../../os/unix -I../../include   -DAIX=530 -U__STR__ -
DAIX_BIND_PROCESSOR -DUSE_HSREGEX -maix64 `../../apaci` -fpic -DSHARED_MODULE 
mod_status.c && mv mod_status.o mod_status.lo
        ld -H512 -T512 -bhalt:4 -bM:SRE -bnoentry -
bI:../../support/httpd.exp  -bE:`echo mod_status.so|sed -e 's:\.so$:.exp:'` -
lc -b64 -o mod_status.so mod_status.lo
ld: 0711-317 ERROR: Undefined symbol: .__fixunssfdi
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: The error code from the last command is 8.


Stop.
make: The error code from the last command is 1.
<<

with loader option -bnoquiet

>>
ILELIST: Number of previously inserted files processed: 2
(ld): imports ../../support/httpd.exp
IMPORTS: Symbols imported from import file ../../support/httpd.exp: 432
(ld): exports mod_status.exp
EXPORTS: Symbols exported: 1
(ld): resolve
RESOLVE: 195 of 3647 symbols were kept.
(ld): addgl /usr/lib/glink64.o
ADDGL: Glink code added for 32 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
        The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-
File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing 
Symbol
 ------------------------------------------------------------------------------
----------------
 .__fixunssfdi             [64]    ER PR mod_status.c(mod_status.lo)
                                   0000240c .text    R_RBR    [100]   
<.status_handler>
                                   00002670 .text    R_RBR    [100]   
<.status_handler>
ER: The return code is 8.
make: The error code from the last command is 8.
<<

Any suggestions/advice?
Brian.
Comment 1 Jeff Trawick 2006-02-28 12:30:12 UTC
See http://people.apache.org/~trawick/apache13aix.html

You need to use the EXTRA_LDFLAGS_SHLIB to work around this gcc oddity.
Comment 2 bpinch 2006-03-03 04:17:38 UTC
following the apache 1.3 on aix 
http://people.apache.org/~trawick/apache13aix.html note gave
# find / -name "libgcc.*" -print
./opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/libgcc.a
./opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/ppc64/libgcc.a
./opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/pthread/libgcc.a
./opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/pthread/ppc64/libgcc.a

So somethings similar to the following were tried including just one -lgcc

#EXTRA_LDFLAGS_SHLIB="-b64 -L/opt/freeware/lib/gcc-lib/powerpc-ibm-
aix5.3.0.0/3.3.2 -lgcc -L/opt/freeware/lib/gcc-lib/powerpc-ibm-
aix5.3.0.0/3.3.2/ppc64 -lgcc -L/opt/freeware/lib/gcc-lib/powerpc-ibm-
aix5.3.0.0/3.3.2/pthread -lgcc -L/opt/freeware/lib/gcc-lib/powerpc-ibm-
aix5.3.0.0/3.3.2/pthread/ppc64  -lgcc"; export  EXTRA_LDFLAGS_SHLIB; echo 
$EXTRA_LDFLAGS_SHLIB


The ld error remained in that the symbol remained unresolved.

However, adding to the still undefined symbol to __fixunssfdi (there was only 
one) to src/support/httpd.exp as explained in 
http://people.apache.org/~trawick/apache13aix.html allowed apache to link and 
subsequently start as a webserver.

Thanks
Brian






Comment 3 William A. Rowe Jr. 2006-03-03 04:32:39 UTC
  Try the link flag --static-libgcc and report back if this works.
  I'm unsure if this flag is libtool specific or generally applicable
  to any gcc compilation.
Comment 4 bpinch 2006-03-19 13:18:40 UTC
As a link option the following is not permitted

EXTRA_LDFLAGS_SHLIB="-b64  -static-libgcc"; export  EXTRA_LDFLAGS_SHLIB; echo 
$EXTRA_LDFLAGS_SHLIB

As a CFLAGS option it is apparently permitted
CFLAGS="-maix64 -static-libgcc"; export  CFLAGS; echo $CFLAGS

But it still came up with same error 

ie Undefined symbol: .__fixunssfdi, still requiring adding to the apache 
symbols file to allow to link edit.

Regards
Brian