Bug 64557 - compile/linking troubles
Summary: compile/linking troubles
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Build (show other bugs)
Version: 2.4.43
Hardware: Other AIX
: P2 blocker (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-24 13:37 UTC by flynn8765
Modified: 2020-06-25 05:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description flynn8765 2020-06-24 13:37:20 UTC
i need to compile a self contained httpd distribution,  which need stricts library search paths in the binaries. i found out that
something is messing up the resulting binaries.

i use the following build settings:

export OBJECT_MODE=64

export AR="/usr/bin/ar -X64"
export LD="/usr/bin/ld"
export RM="/usr/bin/rm -f"


export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"
export LTFLAGS="--tag=CC --silent"
export CFLAGS="-maix64 -fsigned-char -D_LARGE_FILES -O2 -I$OPENSSLSPATH/include -I/opt/freeware/include"
export LDFLAGS="-L$APPATH/lib -L$OPENSSLPATH/lib -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:$APPATH/lib:/usr/lib:/lib"
export CXXFLAGS=$CFLAGS


the resulting bins contains a messed up search path (httpd for example):

root@aixbuildhostng: /tmp/apatest/bin # dump -X64 -ovH httpd

httpd:

                        ***Object Module Header***
# Sections      Symbol Ptr      # Symbols       Opt Hdr Len     Flags
         4      0x00000000              0               120     0x100f
Flags=( RELFLG EXEC LNNO LSYMS DYNLOAD DEP_SYSTEM )
Timestamp = "Jun 24 12:17:59 2020"
Magic = 0x1f7  (64-bit XCOFF)

                        ***Optional Header***
Tsize       Dsize       Bsize       Tstart      Dstart
0x00077ad4  0x0000c59c  0x00003898  0x10000240  0x20000d14

SNloader    SNentry     SNtext      SNtoc       SNdata
0x0004      0x0002      0x0001      0x0002      0x0002

TXTalign    DATAalign   TOC         vstamp      entry
0x0007      0x0004      0x2000bcc8  0x0001      0x200061a0

maxSTACK    maxDATA     SNbss       magic       modtype
0x00000000  0x00000000  0x0003      0x010b        1L

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x000006c1       0x000012ee       0x000000c3

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000007       0x0001d130       0x00009267       0x0001d1f3


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib:/tmp/apatest/lib:/tmp/apatest/lib:/usr/lib:/lib
1                                    libpcre.a           libpcre.so.1
2                                    libaprutil-1.so
3                                    libexpat.a          libexpat.so.1
4                                    libapr-1.so
5                                    libpthread.a        shr_xpg5_64.o
6                                    libc.a              shr_64.o


Index0 should contain only "/tmp/apatest/lib:/usr/lib:/lib" IMHO. i highly supsect some auttool/libtool rubbish acting up somewhere somehow.
funnily this only concern the binaries (httpd,ab...), the modules are all correctly linked.
any hints whats going on, i'm out of ideas?

i tried to relink with rtl_enable but this kills the binary...

rtl_enable -X64 -o /tmp/aptest/bin/httpd_fixed /tmp/aptest/bin/httpd -blibpath:/tmp/aptest/lib:/usr/lib:/lib

root@aixbuildhostng: /home/packagebuilder/apache2-itsv # dump -X64 -ovH /tmp/aptest/bin/httpd_fixed

/tmp/aptest/bin/httpd_fixed:

                        ***Object Module Header***
# Sections      Symbol Ptr      # Symbols       Opt Hdr Len     Flags
         4      0x00000000              0               120     0x100f
Flags=( RELFLG EXEC LNNO LSYMS DYNLOAD DEP_SYSTEM )
Timestamp = "Jun 24 14:53:19 2020"
Magic = 0x1f7  (64-bit XCOFF)

                        ***Optional Header***
Tsize       Dsize       Bsize       Tstart      Dstart
0x0007f098  0x0000dc68  0x00003890  0x00000000  0x00000000

SNloader    SNentry     SNtext      SNtoc       SNdata
0x0004      0x0002      0x0001      0x0002      0x0002

TXTalign    DATAalign   TOC         vstamp      entry
0x0007      0x0004      0x0000afb8  0x0001      0x00005490

maxSTACK    maxDATA     SNbss       magic       modtype
0x00000000  0x00000000  0x0003      0x010b        1L

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x000006c1       0x000015c6       0x0000009f

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000007       0x0001feb0       0x00009267       0x0001ff4f


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /tmp/aptest/lib:/usr/lib:/lib
1                                    libc.a              shr_64.o
2                                    libpthread.a        shr_xpg5_64.o
3                                    libapr-1.so
4                                    libpcre.a           libpcre.so.1
5                                    libaprutil-1.so
6                                    libexpat.a          libexpat.so.1


root@aixbuildhostng: /home/packagebuilder/apache2-itsv #  /tmp/aptest/bin/httpd_fixed -t -D DUMP_MODULES
Illegal instruction​
Comment 2 flynn8765 2020-06-25 05:18:10 UTC
the guys  at IBM disclosed the "hardcode_libdir_flag_spec" in the apr libtool script as the troublemaker.
as a workaround i did "sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' $BUILDPATH/httpd/srclib/apr/libtool" but i would say this need to be fixed somewhere else (libtool.m4?)