Forum: Ruby-core [Ruby 1.8 - Bug #7279][Open] Zlib load error on HP-UX

Posted by alexharv074 (Alex Harvey) (Guest)
on 2012-11-05 13:51
(Received via mailing list)
Issue #7279 has been reported by alexharv074 (Alex Harvey).

----------------------------------------
Bug #7279: Zlib load error on HP-UX
https://bugs.ruby-lang.org/issues/7279

Author: alexharv074 (Alex Harvey)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]


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

<pre>
# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
</pre>

<pre>
# /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
</pre>

<pre>
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
</pre>

<pre>
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text
</pre>

I have attached the mkmf.log.
Posted by alexharv074 (Alex Harvey) (Guest)
on 2012-12-06 03:32
(Received via mailing list)
Issue #7279 has been updated by alexharv074 (Alex Harvey).


I found a workaround.

There is some documentation of HP-UX PA-RISC compiler here
http://h21007.www2.hp.com/portal/site/dspp/menuite...

(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.
----------------------------------------
Bug #7279: Zlib load error on HP-UX
https://bugs.ruby-lang.org/issues/7279#change-34440

Author: alexharv074 (Alex Harvey)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]


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

<pre>
# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
</pre>

<pre>
# /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
</pre>

<pre>
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
</pre>

<pre>
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text
</pre>

I have attached the mkmf.log.
Posted by Nobuyoshi Nakada (nobu)
on 2013-01-28 09:19
(Received via mailing list)
Issue #7279 has been updated by nobu (Nobuyoshi Nakada).

File bug-7279.diff added
Category set to build
Target version set to 2.0.0


----------------------------------------
Bug #7279: Zlib load error on HP-UX
https://bugs.ruby-lang.org/issues/7279#change-35687

Author: alexharv074 (Alex Harvey)
Status: Feedback
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: 2.0.0
ruby -v: ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]


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

<pre>
# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
</pre>

<pre>
# /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
</pre>

<pre>
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
</pre>

<pre>
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text
</pre>

I have attached the mkmf.log.
Posted by mame (Yusuke Endoh) (Guest)
on 2013-02-18 16:30
(Received via mailing list)
Issue #7279 has been updated by mame (Yusuke Endoh).

Target version changed from 2.0.0 to next minor


----------------------------------------
Bug #7279: Zlib load error on HP-UX
https://bugs.ruby-lang.org/issues/7279#change-36542

Author: alexharv074 (Alex Harvey)
Status: Feedback
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: next minor
ruby -v: ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]


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

<pre>
# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
</pre>

<pre>
# /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
</pre>

<pre>
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
</pre>

<pre>
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text
</pre>

I have attached the mkmf.log.
Posted by alexharv074 (Alex Harvey) (Guest)
on 2013-02-25 04:18
(Received via mailing list)
Issue #7279 has been updated by alexharv074 (Alex Harvey).


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

----------------------------------------
Bug #7279: Zlib load error on HP-UX
https://bugs.ruby-lang.org/issues/7279#change-36982

Author: alexharv074 (Alex Harvey)
Status: Feedback
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: next minor
ruby -v: ruby 1.8.7 (2012-06-29 patchlevel 370) [hppa2.0w-hpux11.11]


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

<pre>
# swlist
...
  gcc                                   4.2.3          gcc
  libgcc                                4.2.3          libgcc
  m4                                    1.4.16         m4
  make                                  3.82           make
</pre>

<pre>
# /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
</pre>

<pre>
# file /usr/local/lib/libz.sl
/usr/local/lib/libz.sl: PA-RISC1.1 shared library
</pre>

<pre>
# file /usr/local/include/zlib.h
/usr/local/include/zlib.h:      c program text
</pre>

I have attached the mkmf.log.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.