Subject: Compiling apache with mod_perl + mod_ssl on HP-UX 10.2; link problem

From: Ian Macdonald <[email-masked]>
Date: Fri, 19 Jul 2002 17:01:35 +1000

Hi,

I've been running apache 1.3.26 with mod_perl 1.26 statically linked in
for a while now with no problems.

I've recently tried to add mod_ssl to the configuration and the apache
build now fails at the final link like so:
 
cc  -DHPUX10 -Aa -Ae -D_HPUX_SOURCE -DMOD_SSL=208110 -DMOD_PERL
-DUSE_PERL_SSI  -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-DUSE_HSREGEX -DEAPI -DNO_DL_NEEDED -Ae -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64  `./apaci` -L/usr/local/ssl/lib   \
              -o httpd buildmark.o modules.o  modules/ssl/libssl.a 
modules/perl/libperl.a  modules/standard/libstandard.a  main/libmain.a 
./os/unix/libos.a  ap/libap.a regex/libregex.a   -ldbm -lssl -lcrypto
-Wl,-E -Wl,-B,deferred  
/opt/perl5/lib/5.6.1/PA-RISC1.1/auto/DynaLoader/DynaLoader.a
-L/opt/perl5/lib/5.6.1/PA-RISC1.1/CORE -lperl -lnsl_s -ldld -lm -lc
-lndir -lcrypt -lsec  -lm
/usr/ccs/bin/ld: Unsatisfied symbols:
   __umoddi3 (code)
   __udivdi3 (code)
*** Error exit code 1

Searching on the mod_perl list archive revealed one answer which was to
use the GNU ld instead; unfortunately, this doesn't seem easy on HP-UX,
as ld is not part of the standard GNU binutils package for HP-UX and
compiling the generic binutils manually doesn't build any version of ld
as far as I could tell.

The missing symbols are present in the global symbols list produced by
"nm -g /usr/local/lib/ssl/libcrypto.a", looking like this. Moving the
"-lcrypto" token around in the link line or duplicating it in various
places doesn't have any effect.
         U __udivdi3
         U __umoddi3

The config file for apache looks like this:

CC="cc" \
CFLAGS=" -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 " \
SSL_BASE="/usr/local/ssl" \
./configure \
"--with-layout=Apache" \
"--enable-module=ssl" \
"--activate-module=src/modules/perl/libperl.a" \
"--disable-rule=EXPAT" \
"--prefix=/opt/httpd_perl" \
"$@"

If I chop out the CC & CFLAGS settings, the build uses gcc and completes
ok, but then dumps core with a stack violation as soon as a perl
document is requested. I figure it's easier letting mod_perl build with
cc the way it wants to and try and fix this link issue than address a
mysterious core dump.

I can easily build with either mod_perl or mod_ssl configured and both
versions operate correctly once built.

Answers to any of these questions would be greatly appreciated:
* Why does the apache link fail?
* How do you build GNU ld for HP-UX 10.20?
* Why does mod_perl configure the apache build to use cc rather than
gcc, and can you override this without provoking core dumps?

Other version info:
mod_ssl-2.8.10-1.3.26
openssl-0.9.6d
All software mentioned was built with default config except as mentioned
above.

Thanks,
Ian

-- 
Ian Macdonald
[email-masked]
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email-masked]
Automated List Manager                            [email-masked]

---

From: Lutz Jaenicke <[email-masked]>
Date: Fri, 19 Jul 2002 09:30:51 +0200

> compiling the generic binutils manually doesn't build any version of ld

This solution is only partly correct.
The real reason for your problem is that at least some of your objects
have been compiled with gcc. The missing functions are part of libgcc.a,
which is available somewhere in your gcc installation.
>From your "nm" of libcrypto.a it seems that openssl was compiled with gcc.
Thus, 2 possible solutions:
* Add -L/path/to/where/libgcc/is/ -lgcc after -lcrypto, maybe at the end of
  the list. (I think this is what GNU ld makes automatically.)
* Recompile every component using HP's compiler. That's how I do it.
  Works fine for me :-)

Best regards,
	Lutz
-- 
Lutz Jaenicke                             [email-masked]
http://www.aet.TU-Cottbus.DE/personen/jaenicke/
BTU Cottbus, Allgemeine Elektrotechnik
Universitaetsplatz 3-4, D-03044 Cottbus
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email-masked]
Automated List Manager                            [email-masked]

---

From: Ian Macdonald <[email-masked]>
Date: Mon, 22 Jul 2002 15:43:48 +1000

Thanks Lutz; I've gone with option 1 (easier in the short term) and it
works fine. Keeping option 2 in reserve for now.

Just in case I come across something that demands the gnu ld, do you
know why this is hard to find for HP-UX? And does hard==impossible?

Thanks again,
Ian 
-- 
Ian Macdonald
[email-masked]

---

From: Lutz Jaenicke <[email-masked]>
Date: Mon, 22 Jul 2002 09:25:00 +0200

> know why this is hard to find for HP-UX? And does hard==impossible?

As far as I know, gnu ld does not support HP-UX and I am not aware of
any effort of the GNU people to build one. I don't know why this is the
case. From the past (I use HP-UX for a decade), GCC also could not generate
debugger support in the object files (-g not supported), which was due to
HP not revealing the technical details. Now, that GDB is the standard
debugger for HP-UX, this is of course different.
HP's 32bit object format is somewhat proprietary, but the 64bit format
now is standard ELF. I therefore suspect, that nobody will spend the time
to adapt GNU ld for HP.

Best regards,
	Lutz

---

From: John Ott <[email-masked]>
Date: Mon, 22 Jul 2002 12:59:30 -0400

> know why this is hard to find for HP-UX? And does hard==impossible?

It is not supported yet for HP-UX 11. x

 I 've yet to find anything the "demands" it,
but I generally use HPs compliers and utilities.

later
John