Operating System - HP-UX
1833302 Members
2781 Online
110051 Solutions
New Discussion

Re: Invalid linker options during build of Apache

 
Ralph Grothe
Honored Contributor

Invalid linker options during build of Apache

Hello C coders,

I had to build my custom Apache to accomodate support for most DSO standard Apache modules as well as statically loaded mod_perl, and dynamically loaded PHP support.
This was necessary because the Apache build HP distributes as precompiled depot wasn't usable at all for me because it was built with threading Perl support (opposed to my Perl build for Oracle OCI compatibility), and it
seems to be built with gcc.

Thus, I configured the mod_perl, php, and finally Apache as outlined in the INSTALL and README.configure

The make went well for the mod_perl, php, and the creation of object files of apache.
But finally the linker bailed out with the below error messages.


ld -b -o libphp4.so mod_php4.so-o libmodphp4.a -L/usr/local/lib -L/usr/local/mysql/lib -L/u
sr/local/lib -L/usr/local/mysql/lib -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4
-L/usr/local/lib -L/usr/local/mysql/lib -lexpat -lmysqlclient -lz -lm -lnsl -lm -lpthread -Wl,-E
-Wl,-B,deferred -L/usr/local/lib /opt/perl5/lib/5.8.0/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/op
t/perl5/lib/5.8.0/PA-RISC2.0/CORE -lperl -lcl -lpthread -lnsl -lnm -lmalloc -ldld -lm -lc -lndir -lcry
pt -lsec -lm -L/usr/local/lib -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/local/mysql/lib -Lmodul
es/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4 -L/usr/local/lib -L/usr/local/mysql/lib
-lexpat -lmysqlclient -lz -lm -lnsl -lm -lpthread -Wl,-E -Wl,-B,deferred -L/usr/local/lib /opt/pe
rl5/lib/5.8.0/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5/lib/5.8.0/PA-RISC2.0/CORE -lperl -l
cl -lpthread -lnsl -lnm -lmalloc -ldld -lm -lc -lndir -lcrypt -lsec
ld: Unrecognized argument: -Wl,-E
ld: Usage: ld [options] [flags] files
*** Error exit code 1

Stop.
*** Error exit code 1


The message sounds plausible to me though I'm not a C hacker, and thus lack ld familiarity.

The make of the modules must have squeezed in some syntactically strange comma separated options like -Wl,-E etc.

Only this string alone is dispersed in several Makefiles in the source tree of apache itself.

# find . -type f -name Makefile|xargs grep -l -- '-Wl,-E'
./src/ap/Makefile
./src/lib/expat-lite/Makefile
./src/lib/Makefile
./src/main/Makefile
./src/modules/standard/Makefile
./src/modules/perl/Makefile
./src/modules/php4/Makefile
./src/modules/Makefile
./src/os/unix/Makefile
./src/support/Makefile
./src/Makefile

For instance just the 1st occurance in the Makefile in the src subdir

# grep -n -- '-Wl,-E' src/Makefile|head -1
48:PERL_LIBS=-Wl,-E -Wl,-B,deferred -L/usr/local/lib /opt/perl5/lib/5.8.0/PA-RISC2.0/auto/DynaLoader
/DynaLoader.a -L/opt/perl5/lib/5.8.0/PA-RISC2.0/CORE -lperl -lcl -lpthread -lnsl -lnm -lmalloc -ldld -
lm -lc -lndir -lcrypt -lsec


Is this correct syntax in Makefile parlance?

Would it help if I substituted all occurrences of ',' by \040 (whitespace)?

How could I remedy the broken link phase whithout having to go through all the hassle of reconfiguring and remaking the other Apache module stuff that already passed successfully again?

Rgds.
Ralph
Madness, thy name is system administration
2 REPLIES 2
Ralph Grothe
Honored Contributor

Re: Invalid linker options during build of Apache

Well, I sed-ed a substitute of s/-Wl,/ /g in all the above mentioned Makefiles.
That caused make to continue until it again aborted,
this time with an "invalid loader fixup" error.

Tail of this time's make


: libperl.a
<=== src/modules/perl
===> src/modules/php4
rm -f libphp4.so
ld -b -o libphp4.so mod_php4.so-o libmodphp4.a -L/usr/local/lib -L/usr/local/mysql/lib -L/u
sr/local/lib -L/usr/local/mysql/lib -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4
-L/usr/local/lib -L/usr/local/mysql/lib -lexpat -lmysqlclient -lz -lm -lnsl -lm -lpthread -E -
B,deferred -L/usr/local/lib /opt/perl5/lib/5.8.0/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl
5/lib/5.8.0/PA-RISC2.0/CORE -lperl -lcl -lpthread -lnsl -lnm -lmalloc -ldld -lm -lc -lndir -lcrypt -ls
ec -lm -L/usr/local/lib -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/local/mysql/lib -Lmodules/php
4 -L../modules/php4 -L../../modules/php4 -lmodphp4 -L/usr/local/lib -L/usr/local/mysql/lib -lexpa
t -lmysqlclient -lz -lm -lnsl -lm -lpthread -E -B,deferred -L/usr/local/lib /opt/perl5/lib/5.8.
0/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5/lib/5.8.0/PA-RISC2.0/CORE -lperl -lcl -lpthread
-lnsl -lnm -lmalloc -ldld -lm -lc -lndir -lcrypt -lsec
ld: (Warning) Unsupported keyword -B,deferred to -B,deferred option - both ignored
ld: (Warning) Unsupported keyword -B,deferred to -B,deferred option - both ignored
ld: Invalid loader fixup in text space needed in output file for symbol "$00000018" in input file: "li
bmodphp4.a(main.o)". Make sure it was compiled with +z/+Z.
*** Error exit code 1

Stop.


It seems to require a PIC flag like +Z.
Is there a chance to proceed from here, or will I have to redo all this time trying the +Z CCFLAG?
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Invalid linker options during build of Apache

OK, I also solved the PIC issue by simply doing a make distclean, and rerunning configure this time with mod_php as not enabled as shared, i.e. statically linked.
Running the make after this produced absolutely no errors, and everything went fine.
Madness, thy name is system administration