Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.93k stars 553 forks source link

building a dynamically linked Perl 5.6.1 on HPUX 11.0 #5752

Closed p5pRT closed 21 years ago

p5pRT commented 22 years ago

Migrated from rt.perl.org#15129 (status was 'resolved')

Searchable as RT15129$

p5pRT commented 22 years ago

From Michael.Schuh@airborne.com

Greetings all\,

I recently (like\, 40 minutes ago) installed Perl 5.6.1 on an HPUX 11.0 system. As my goal is to interact with an Oracle database\, I followed Lincoln Baxter's README.hpux (THANK YOU!) and tried to build a dynamically linked version of Perl. However\, in earlier attempts (stretching back over the last week or so) it died in the linking stage\, admonishing me that a file was created without position independent code and advising me that I should recompile using the "+z" flag. As I was using gcc (which has no +z flag) this was very confusing until I noticed that the file to which the message was referring was libgdbm\, which I had built just last week\, and realized that I was using HPUX's ld ('cuz the GNU binutils ld won't work on HPUX) and this ld doesn't know about gcc.

Well\, it was simple enough to fix​: go back to the libgdm build and add -fPIC to the complier options. After that\, Perl built and loaded just like the documentation says it should.

My "bug"? It would have helped me\, I think\, if the three sets of documentation were more blatant about building everything PIC. The configure/build process for libgdbm does not have an obvious method to specify PIC\, and neither the Perl documentation nor Lincoln Baxter's README.hpux remind the user that all files in a dynamic build need to be PIC. Yes\, it's "well known" (and\, if I had been asked\, would have said as much...)\, but a mild reminder might have helped me.

Also\, in the Makefile for libgdbm​:

30c30 \< CFLAGS = -O -fPIC


CFLAGS = -O

although this is specific to gcc.

As is often the case in the software biz\, just a few characters can make all the difference.

Thank you\, and thank you very much for various contributions.

-- Mike Schuh

p5pRT commented 21 years ago

From @doughera88

This bug report is mostly due to issues arising from the build of libgdbm\, which is not under perl's control. The README.hpux in 5.8.0 does address the issue\, but only in terms of HP's compiler flags. The following patch specifies the approrpriate gcc flags (-fpic or -fPIC) as well.

Alternatively\, I suppose we could enhance Configure to skip libgdbm if it isn't built appropriately (or the hpux.sh hints file could move libgdbm over into the static extensions)\, but I'll leave that to HP-UX experts.

With this small patch\, I'll close that bug report.

Inline Patch ```diff --- perl-current/README.hpux Tue Sep 10 06:32:32 2002 +++ perl-andy/README.hpux Mon Dec 2 11:56:03 2002 @@ -68,7 +68,7 @@ require the use of HP compiler-specific command-line flags. If you decide to use gcc, make sure your installation is recent and -complete, and be sure to read the Perl README file for more gcc-specific +complete, and be sure to read the Perl INSTALL file for more gcc-specific details. =head2 PA-RISC @@ -203,6 +203,7 @@ 1. Compile source modules with +z or +Z flag to create a .o module which contains Position-Independent Code (PIC). The linker will tell you in the next step if +Z was needed. + (For gcc, the appropriate flag is -fpic or -fPIC.) 2. Link the shared library using the -b flag. If the code calls any functions in other system libraries (e.g., libm), it must @@ -238,7 +239,8 @@ HP is aware of this problem. Search the HP-UX cxx-dev forums for discussions about the subject. The short answer is that B (all libraries, everything) must be compiled with C<+z> or C<+Z> to be -PIC (position independent code). In HP-UX 11.00 or newer the linker +PIC (position independent code). (For gcc, that would be +C<-fpic> or C<-fPIC>). In HP-UX 11.00 or newer the linker error message should tell the name of the offending object file. A more general approach is to intervene manually, as with an example for -- Andy Dougherty doughera@lafayette.edu ```
p5pRT commented 21 years ago

@doughera88 - Status changed from 'new' to 'resolved'

p5pRT commented 21 years ago

From @tux

On Mon 02 Dec 2002 18​:04\, Andy Dougherty \doughera@&#8203;lafayette\.edu wrote​:

This bug report is mostly due to issues arising from the build of libgdbm\, which is not under perl's control. The README.hpux in 5.8.0 does address the issue\, but only in terms of HP's compiler flags. The following patch specifies the approrpriate gcc flags (-fpic or -fPIC) as well.

Alternatively\, I suppose we could enhance Configure to skip libgdbm if it isn't built appropriately (or the hpux.sh hints file could move libgdbm over into the static extensions)\, but I'll leave that to HP-UX experts.

With this small patch\, I'll close that bug report.

Double thanks\, aplied as change #18231

FWIW IMHO the hpux.sh ain't worth the tuits\, but you never know :)

--- perl-current/README.hpux Tue Sep 10 06​:32​:32 2002 +++ perl-andy/README.hpux Mon Dec 2 11​:56​:03 2002 @​@​ -68\,7 +68\,7 @​@​ require the use of HP compiler-specific command-line flags.

If you decide to use gcc\, make sure your installation is recent and -complete\, and be sure to read the Perl README file for more gcc-specific +complete\, and be sure to read the Perl INSTALL file for more gcc-specific details.

=head2 PA-RISC @​@​ -203\,6 +203\,7 @​@​ 1. Compile source modules with +z or +Z flag to create a .o module which contains Position-Independent Code (PIC). The linker will tell you in the next step if +Z was needed. + (For gcc\, the appropriate flag is -fpic or -fPIC.)

 2\. Link the shared library using the \-b flag\.  If the code calls
    any functions in other system libraries \(e\.g\.\, libm\)\, it must

@​@​ -238\,7 +239\,8 @​@​ HP is aware of this problem. Search the HP-UX cxx-dev forums for discussions about the subject. The short answer is that B\ (all libraries\, everything) must be compiled with C\<+z> or C\<+Z> to be -PIC (position independent code). In HP-UX 11.00 or newer the linker +PIC (position independent code). (For gcc\, that would be +C\<-fpic> or C\<-fPIC>). In HP-UX 11.00 or newer the linker error message should tell the name of the offending object file.

A more general approach is to intervene manually\, as with an example for -- Andy Dougherty doughera@​lafayette.edu

-- H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using perl-5.6.1\, 5.8.0 & 633 on HP-UX 10.20 & 11.00\, AIX 4.2\, AIX 4.3\,   WinNT 4\, Win2K pro & WinCE 2.11. Smoking perl CORE​: smokers@​perl.org http​://archives.develooper.com/daily-build@​perl.org/ perl-qa@​perl.org send smoke reports to​: smokers-reports@​perl.org\, QA​: http​://qa.perl.org

p5pRT commented 21 years ago

@jhi - Status changed from 'open' to 'resolved'

p5pRT commented 21 years ago

From @jhi

I'm marking the problem ticket as resolved.

p5pRT commented 21 years ago

@jhi - Status changed from 'open' to 'resolved'