Project

General

Profile

Actions

Bug #7279

closed

Zlib load error on HP-UX

Added by alexharv074 (Alex Harvey) about 12 years ago. Updated over 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]
[ruby-core:48909]

Description

This was apparently a known issue on HP-UX and it is preventing me from compiling zlib
http://www.ruby-forum.com/topic/191987

To reproduce -

PA-RISC/HP-UX 11.11

# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
# /usr/local/bin/ruby extconf.rb --with-zlib-include=/usr/local/include --with-zlib-lib=/usr/local/lib
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib1... no
checking for deflateReset() in -lzlib... no
checking for deflateReset() in -lzdll... no
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text

I have attached the mkmf.log.


Files

mkmf.log (5.47 KB) mkmf.log alexharv074 (Alex Harvey), 11/05/2012 09:51 PM
bug-7279.diff (730 Bytes) bug-7279.diff nobu (Nobuyoshi Nakada), 01/28/2013 05:17 PM

Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #7737: problem with generated rbconfig.rb for HaikuClosednobu (Nobuyoshi Nakada)01/23/2013Actions

Updated by alexharv074 (Alex Harvey) about 12 years ago

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 shows, however, that an unknown option +b is being passed directly to gcc.

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 results 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"

However, the make step still doesn't run properly because now -Wl,+b gets passed to ld, which is also wrong.

Thus after the make step has 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
cd ../..

That works fine. Then cd ../.. and make install and the zlib extension is installed.

Someone who understands how all this stuff works better than I do can hopefully turn this into an actual patch.

Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Project changed from Ruby 1.8 to Ruby master
  • Status changed from Open to Feedback
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
Could you try this patch?

diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index c9e738a..fe6f771 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -317,9 +317,9 @@ def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
'CFLAGS' => "#$CFLAGS",
'ARCH_FLAG' => "#$ARCH_FLAG",
'LDFLAGS' => "#$LDFLAGS #{ldflags}",

  •                          'LIBPATH' => libpathflag(libpath),
                             'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
                             'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
    
  • conf['LIBPATH'] = libpath.map {|s| LIBPATHFLAG % RbConfig::expand(s.dup, conf).quote}.join("")
    Config::expand(TRY_LINK.dup, conf)
    end
    =end

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

Updated by mame (Yusuke Endoh) almost 12 years ago

  • Target version changed from 2.0.0 to 2.6
Actions #5

Updated by alexharv074 (Alex Harvey) almost 12 years ago

Hi Nobuyoshi,

Yes the patch works.

For people viewing this in the archives, it's worth knowing that patch and diff are different on HP-UX. To apply this patch -

cp -p lib/mkmf.rb lib/mkmf.rb.orig
cat <<'EOF' >mkmf.hpux.patch

*** lib/mkmf.rb.orig Sat Dec 4 17:34:10 2010
--- lib/mkmf.rb Wed Feb 13 16:29:18 2013


*** 317,325 ****
'CFLAGS' => "#$CFLAGS",
'ARCH_FLAG' => "#$ARCH_FLAG",
'LDFLAGS' => "#$LDFLAGS #{ldflags}",

  •                           'LIBPATH' => libpathflag(libpath),
                              'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
                              'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
    
    Config::expand(TRY_LINK.dup, conf)
    end

--- 317,325 ----
'CFLAGS' => "#$CFLAGS",
'ARCH_FLAG' => "#$ARCH_FLAG",
'LDFLAGS' => "#$LDFLAGS #{ldflags}",
'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")

  • conf['LIBPATH'] = libpath.map {|s| LIBPATHFLAG % RbConfig::expand(s.dup, conf).quote}.join("")
    Config::expand(TRY_LINK.dup, conf)
    end
    EOF
    patch lib/mkmf.rb <mkmf.hpux.patch
Actions #6

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Target version deleted (2.6)
Actions #7

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0