It turns out static linking didn't work either but for the benefit of people reading this in the archives I found a workaround -
There is some documentation of HP-UX PA-RISC compiler here
http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=4727276391695110VgnVCM100000275d6e10RCRD
(There's probably a better one somewhere but that's the one I used.)
The +b option is used by the linker to embed a library path list in the
executable for use at run time. However, if passing these options via
CC or GCC then the option should be -Wl,+b. The mkmf.log file showed,
however, that an unknown option +b was being passed directly to gcc. I found this was coming from configuration in /usr/local/lib/ruby/1.8/hppa2.0w-hpux11.11/rbconfig.rb.
After running configure I made the following change in config.status -
mv config.status config.status.orig
sed -e 's/^.*RPATHFLAG.*$/S["RPATHFLAG"]=" -Wl,+b%1$-s"/'
config.status.orig >config.status
chmod +x config.status
./config.status
This resulted in /usr/local/lib/ruby/1.8/hppa2.0w-hpux11.11/rbconfig.rb
having
# grep RPATHFLAG
/usr/local/lib/ruby/1.8/hppa2.0w-hpux11.11/rbconfig.rb
CONFIG["RPATHFLAG"] = " -Wl,+b%1$-s"
which is what I wanted.
However, the make step still didn't run properly because -Wl,+b
was now passed to ld, which is also wrong.
Thus after the make step finished I made another change -
cd ext/zlib
mv Makefile Makefile.orig
sed -e 's#^LIBPATH.*$#LIBPATH = -L. -L$(topdir) -L/usr/local/lib
+b/usr/local/lib#' Makefile.orig >Makefile
make
That works fine.
Then cd ../.. && make install and the zlib extension
was installed.
I also updated the redmine ticket
https://bugs.ruby-lang.org/issues/7279