Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8 (172 Views)
Reply
Occasional Visitor
Bill Harpley
Posts: 4
Registered: ‎02-11-2009
Message 1 of 14 (172 Views)

Obscure "HiRes.so" problem when buidling Perl 5.8.8

Hello,

I am building Perl 5.8.8 on HP-UX 11.31 (Itanium):

bash-3.00# model
ia64 hp server rx3600

I eventually want to get to a position where I can install the DBI and DBD:Oracle modules. But before I can attempt that I must first install Perl into /usr/local.

This is a customer owned server, so I do not want to disturb the existing Perl installation in /opt/perl.

I am building Perl with GCC 4.2.4 and GNU 'make'. I have done a lot of research into building Perl on Itanium boxes and have followed "best practice" for configuring Perl for DBI and DBD:Oracle.

I have been able to solve a number of problems which I have so far encountered. But now I have hit upon something really obscure. In fact, it is so obscure that a Google search returns only one hit from 2002:
http://markmail.org/message/dvav6g4ym4p6g4tk

Basically what happens is that I call gmake to build Perl and when it reaches the point where it wants to configure the Time::HiRes module it bombs out with "Error 2":

Making Time::HiRes (dynamic)
Configuring Time::HiRes...
Have syscall()... looking for syscall.h... found .
Looking for gettimeofday()... found.
Looking for setitimer()... found.
Looking for getitimer()... found.
You have interval timers (both setitimer and getitimer).
Looking for ualarm()... found.
Looking for usleep()... found.
Looking for nanosleep()... testing... found.
You can mix subsecond sleeps with signals, if you want to.
(It's still not portable, though.)
Looking for clock_gettime()... found.
Looking for clock_getres()... found.
Looking for clock_nanosleep()... NOT found.
Looking for clock()... found.
Writing Makefile for Time::HiRes
gmake[1]: Entering directory `/tmp/xfiles/perl-5.8.8/ext/Time/HiRes'
gmake[1]: Leaving directory `/tmp/xfiles/perl-5.8.8/ext/Time/HiRes'
gmake[1]: Entering directory `/tmp/xfiles/perl-5.8.8/ext/Time/HiRes'
cp HiRes.pm ../../../lib/Time/HiRes.pm
../../../miniperl "-I../../../lib" "-I../../../lib" ../../../lib/ExtUtils/xsubpp -typemap ../../../lib/ExtUtils/typemap -typemap tc
gcc -c -D_POSIX_C_SOURCE=199506L -D_REENTRANT -D_HPUX_SOURCE -mlp64 -DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-stc
HiRes.xs:73:1: warning: "CLOCK_REALTIME" redefined
In file included from /usr/include/time.h:12,
from ../../../perl.h:961,
from HiRes.xs:16:
/opt/hp-gcc-4.2.4/lib/gcc/ia64-hp-hpux11.23/4.2.4/include/sys/_time.h:94:1: warning: this is the location of the previous definition
HiRes.xs:74:1: warning: "CLOCK_VIRTUAL" redefined
/opt/hp-gcc-4.2.4/lib/gcc/ia64-hp-hpux11.23/4.2.4/include/sys/_time.h:96:1: warning: this is the location of the previous definition
HiRes.xs:75:1: warning: "CLOCK_PROFILE" redefined
/opt/hp-gcc-4.2.4/lib/gcc/ia64-hp-hpux11.23/4.2.4/include/sys/_time.h:97:1: warning: this is the location of the previous definition
In file included from HiRes.xs:691:
const-c.inc: In function 'constant_14':
const-c.inc:102: error: 'CLOCK_REALTIME' undeclared (first use in this function)
const-c.inc:102: error: (Each undeclared identifier is reported only once
const-c.inc:102: error: for each function it appears in.)
HiRes.c: In function 'XS_Time__HiRes_clock_gettime':
HiRes.c:1361: error: 'CLOCK_REALTIME' undeclared (first use in this function)
HiRes.c: In function 'XS_Time__HiRes_clock_getres':
HiRes.c:1428: error: 'CLOCK_REALTIME' undeclared (first use in this function)
gmake[1]: *** [HiRes.o] Error 1
gmake[1]: Leaving directory `/tmp/xfiles/perl-5.8.8/ext/Time/HiRes'
gmake: *** [lib/auto/Time/HiRes/HiRes.so] Error 2

If I look in these directories, this is what I find:

bash-3.00# ls -l lib/auto/Time/HiRes/HiRes.so
lib/auto/Time/HiRes/HiRes.so not found


bash-3.00# ls -l /tmp/xfiles/perl-5.8.8/ext/Time/HiRes
total 720
-r--r--r-- 1 1013 1013 25810 Dec 17 2005 Changes
-rw-rw-rw- 1 root sys 43666 Feb 11 10:56 HiRes.c
-r--r--r-- 1 1013 1013 19023 Dec 17 2005 HiRes.pm
-r--r--r-- 1 1013 1013 28746 Dec 17 2005 HiRes.xs
-rw-r--r-- 1 root sys 28169 Feb 11 10:56 Makefile
-r--r--r-- 1 1013 1013 17974 Dec 17 2005 Makefile.PL
drwxrwxrwx 6 root sys 96 Feb 11 10:56 blib
-rw-rw-rw- 1 root sys 10697 Feb 11 10:56 const-c.inc
-rw-rw-rw- 1 root sys 2657 Feb 11 10:56 const-xs.inc
drwxr-xr-x 2 1013 1013 96 Feb 9 14:19 fallback
drwxr-xr-x 2 1013 1013 8192 Feb 9 14:19 hints
-rw-rw-rw- 1 root sys 0 Feb 11 10:56 pm_to_blib
-r--r--r-- 1 1013 1013 117099 May 21 2005 ppport.h
drwxr-xr-x 2 1013 1013 96 Feb 9 14:19 t
-r--r--r-- 1 1013 1013 6775 Oct 20 2002 typemap
-rw-rw-rw- 1 root sys 95 Feb 11 10:56 xdefine

So why does it bomb out when attempting to build the HiRes module? Would I have any more luck with Perl 5.8.9 ??

Thanks in advance for any advice you are able to give.

Regards,
Bill Harpley
Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 2 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

No problems here.

What argumets did you use for Configure?

$ sh ./Configure -Dprefix=/usr/local -Duse64bitall -A prepend:libswanted='cl pthread ' -Dcc=gcc -des

Is most likely what you would have needed

Time-HiRes-1.9719 $ model
ia64 hp server rx2660
Time-HiRes-1.9719 $ uname -r
B.11.31
Time-HiRes-1.9719 $ gcc -dumpversion
4.2.4
Time-HiRes-1.9719 $ make --version | head -1
GNU Make 3.80
Time-HiRes-1.9719 $ gperl -v | grep built
This is perl, v5.8.9 built for IA64.ARCHREV_0-LP64
Time-HiRes-1.9719 $ gperl Makefile.PL
Configuring Time::HiRes...
Have syscall()... looking for syscall.h... found .
Looking for gettimeofday()... found.
Looking for setitimer()... found.
Looking for getitimer()... found.
You have interval timers (both setitimer and getitimer).
Looking for ualarm()... found.
Looking for usleep()... found.
Looking for nanosleep()... testing... found.
You can mix subsecond sleeps with signals, if you want to.
(It's still not portable, though.)
Looking for clock_gettime()... found.
Looking for clock_getres()... found.
Looking for clock_nanosleep()... NOT found.
Looking for clock()... found.
Looking for stat() subsecond timestamps...
Trying struct stat st_atimespec.tv_nsec...NOT found.
Trying struct stat st_atimensec...NOT found.
Trying struct stat st_atime_n...NOT found.
Trying struct stat st_atim.tv_nsec...NOT found.
Trying struct stat st_uatime...NOT found.
You do not seem to have stat subsecond timestamps.
Checking if your kit is complete...
Looks good
Writing Makefile for Time::HiRes
Now you may issue 'make'. Do not forget also 'make test'.
Time-HiRes-1.9719 $ make test
cp HiRes.pm blib/lib/Time/HiRes.pm
/u/usr/merijn/bin/gperl /opt/perl64/lib/5.8.9/ExtUtils/xsubpp -typemap /opt/per
l64/lib/5.8.9/ExtUtils/typemap -typemap typemap HiRes.xs > HiRes.xsc && mv HiRe
s.xsc HiRes.c
gcc -c -mlp64 -DPERL_DONT_CREATE_GVSV -D_HPUX_SOURCE -DDEBUGGING -fno-strict-a
liasing -pipe -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g
-O -DVERSION=\"1.9719\" -DXS_VERSION=\"1.9719\" -fPIC "-I/opt/perl64/lib/5.8.
9/IA64.ARCHREV_0-LP64/CORE" -DTIME_HIRES_NANOSLEEP -DTIME_HIRES_CLOCK_GETTIME -
DTIME_HIRES_CLOCK_GETRES -DTIME_HIRES_CLOCK -DATLEASTFIVEOHOHFIVE HiRes.c
Running Mkbootstrap for Time::HiRes ()
chmod 644 HiRes.bs
rm -f blib/arch/auto/Time/HiRes/HiRes.so
/usr/bin/ld -b -L/pro/local/lib -L/usr/lib/hpux64 HiRes.o -o blib/arch/auto/Ti
me/HiRes/HiRes.so \
\

chmod 755 blib/arch/auto/Time/HiRes/HiRes.so
cp HiRes.bs blib/arch/auto/Time/HiRes/HiRes.bs
chmod 644 blib/arch/auto/Time/HiRes/HiRes.bs
PERL_DL_NONLAZY=1 /u/usr/merijn/bin/gperl "-MExtUtils::Command::MM" "-e" "test_h
arness(0, 'blib/lib', 'blib/arch')" t/*.t
t/HiRes....ok
All tests successful.
Files=1, Tests=40, 23 wallclock secs ( 0.06 usr 0.01 sys + 12.81 cusr 0.93 csys = 13.81 CPU)
Result: PASS
Time-HiRes-1.9719 $

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
Occasional Visitor
Bill Harpley
Posts: 4
Registered: ‎02-11-2009
Message 3 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Hi,

Thanks for your help !!

The command line that I used to build Perl was:

./Configure -Dcc=gcc -Dprefix=/usr/local/ -Dusethreads -Duse64bitall -A prepend:libswanted=â cl pthread â

I also used the '-des' option on the first run but it bombed out with an error. A quick Google search showed that that a guy had a similar problem about a year ago and he got around it by not using '-des'. The ./Configure script ran OK after I tried that.

I have GNU make installed in /usr/local/bin/make . It is at the front of my Unix path, so I just call it with the 'gmake' command. (The version from HP Porting Centre is called gmake).

bash-3.00# gmake --version | head -1
GNU Make 3.81

So far I have done :

bash# ./Configure -Dcc=gcc -Dprefix=/usr/local/ -Dusethreads -Duse64bitall -A prepend:libswanted=â cl pthread â

RESULT: after a bit of tweaking it ran OK.
Then I ran the 'make':

bash# gmake

But this only gets as far as ...

gmake[1]: Leaving directory `/tmp/xfiles/perl-5.8.8/ext/Time/HiRes'
gmake: *** [lib/auto/Time/HiRes/HiRes.so] Error 2

... and them it bombs out.

Given that the approach that I am using is very similar to the one that you have described, could there be any other reason why it fails at this point ??

Regards,
Bill Harpley



Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 4 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Too many to guess.

1. Did you install all the wanted include files?
2. Are they up-to-date?
3. Did you rebuild gcc on your system from source, or did you use gcc from a pre-installed depot? This might have influences way beyond your imagination if the structures from the include files don't match
4. Why o why do you want -Dusethreads? Unless you actually plan to use threads in perl scripts, it will just slow down everything else.

HP installs perl in /opt/perl_32 and /opt/perl_64. If you install from my depot's you will get perl in /opt/perl32 and /opt/perl64. Maybe that is enough for you to continue.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
Occasional Visitor
Bill Harpley
Posts: 4
Registered: ‎02-11-2009
Message 5 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

"Did you install all the wanted include files?"

COMMENT: I am not sure what you mean by this.
This is a standard Perl source and I am not attempting to include any extra modules during the build. ( DBI and DBD:Oracle will be built when I get Perl working).


I downloaded and installed GCC from the HP developer website at http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=2a08725cc2...


". Why o why do you want -Dusethreads?"
COMMENT: I have read conflicting advice about this. Some people say that if you want to use DBD::Oracle then it is best to use threaded Perl. Other people advise against it. So I thought that I would start with a threaded Perl and see what happens.

I started out last Friday with a plan to install one of your pre-built versions of Perl for Itanium. I decided against this because:
(1) it was going to install into /opt and I did not wish to overwrite the existing customer installation. However, as you have pointed out, your pre-built Perl installs into /opt/perl (not /opt/perl_32 or /opt/perl_64) However, there is a link in /opt like this:

lrwxr-xr-x 1 root sys 12 Jul 15 2008 perl -> /opt/perl_32
dr-xr-xr-x 6 bin bin 96 Jul 15 2008 perl_32
dr-xr-xr-x 6 bin bin 96 Jul 15 2008 perl_64

I am not sure if it is possible to have a link called 'perl' and a directory called 'perl'. I suspect that it is OK because they both point to different inodes. I will have to have to perform some experiments in /tmp to find out for sure !!

(2) The other reason why I decided to build from scratch is that I have read that the chances of success with DBD:Oracle are greater if you use the same compiler to build both Perl and the DBD::Oracle module. This is my first attempt to do this, so I decided to "play safe" and build it all from scratch. Of course, the GCC compiler which you use to make the pre-built distributions is probably not the same which I downloaded from the HP depot ;-)

If you cannot think of any other reason for my current problem, then I may have another attempt at using the prebuilt distribution for UX 11.31 ( perl 5.8.9 + defined-or + DBI 1.607 + Tk 804.028_501 built with gcc-4.2.4 ). Is this built as 32 or 64 bit ??

Many thanks,
Bill Harpley
Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 6 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

> "Did you install all the wanted include files?"
>
> COMMENT: I am not sure what you mean by this.

System include files get installed and/or updated from HP patched, like the quality packs.

# swlist -l fileset | grep -- -INC

will show you what you have installed. If you already have the needed files (I have no idea what you could be missing), they will automatically be updated if you install patches from HP.

GNU gcc from HP download should be OK, but there is always the chance of files not being in sync with your system.

> I have read conflicting advice about threaded perl

A perl ready for DBI & DBD::Oracle does *NOT* need to be threaded. The only need for Oracle is that perl itself is linked against libpthread.so

My advice is to NOT use a threaded perl unless you actually have plans to use threads in perl.

> I started out last Friday with a plan to install one of your pre-built versions of Perl for Itanium. I decided against this because:

My perl installs in /opt/perl32 and /opt/perl64 (without the underscores) and does not touch/use /opt/perl at all. That is just a symlink to what your favourite version is to be.

All four will happily live side-by-side

http://mirrors.develooper.com/hpux/perl-5.8.9-dor-11.31-ia64.sd.bz was built with GNU gcc-4.2.4, so it should give you no problems

That depot contains BOTH the 32bit and the the 64bit build. You can select to install either of those or both. It is a standard depot.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
Occasional Visitor
Bill Harpley
Posts: 4
Registered: ‎02-11-2009
Message 7 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Thanks for your further help.

Out of curiosity, I thought I would try building Perl version 5.8.9

I am pleased to say that this built without any problems. So 5.8.9 looks to be a good bet for GCC 4.2.4 and HP-UX 11.31

I also took your advice about threaded Perl and built a "vanilla" unthreaded version.

However, 'make test' fails :

Failed 5 tests out of 1103, 99.55% okay.
../ext/POSIX/t/time.t
../lib/ExtUtils/t/Constant.t
../lib/ExtUtils/t/PL_FILES.t
../lib/ExtUtils/t/basic.t
../lib/ExtUtils/t/recurs.t

I will try and run './perl harness' to diagnose and fix the problems. But if it looks as though this is going to take a long time them I will definitely install the pre-built version of Perl 5.8.9

Once again, many thanks for your expert advice.

Regards,

Bill Harpley



Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 8 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

> Failed 5 tests out of 1103, 99.55% okay.
> ../ext/POSIX/t/time.t

this one is HP's fault. That has already been filed as a bug in libc. The problem is that when you use a TimeZone like

UTC0UTC

libc will make some bad calculations in native time functions. This problem only occurs on 11.31. There is nothing you can do about that at this moment.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,898
Registered: ‎03-06-2006
Message 9 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

>H.Merijn: The problem is that when you use a TimeZone like: UTC0UTC

Why, this is incorrect. Just use UTC0. If you use "UTC0UTC" it will use US DST rules.
Please use plain text.
Respected Contributor
Shinji Teragaito_1
Posts: 212
Registered: ‎12-20-2007
Message 10 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Hi,

I met the same problem before.

The following three defines ext/Time/HiRes/HiRes.xs should be commented on 11.31:

/* HP-UX has CLOCK_XXX values but as enums, not as defines.
* The only way to detect these would be to test compile for each. */
# ifdef __hpux
# define CLOCK_REALTIME CLOCK_REALTIME
# define CLOCK_VIRTUAL CLOCK_VIRTUAL
# define CLOCK_PROFILE CLOCK_PROFILE
# endif /* # ifdef __hpux */

Hope this helps you,

Shinji
Please use plain text.
Respected Contributor
Shinji Teragaito_1
Posts: 212
Registered: ‎12-20-2007
Message 11 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Ooops, I forgot to mention one more thing.

I met the HiRes issue when building Perl 5.10.0 on 11.31.

Shinji
Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 12 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Dennis, UTC0 would indeed be what most (all) users would use, but there is still an error in the code behind the scenes, and only 11.31 is barfing here.

Here is the test program that was used to expose it:
--8<--- tz.c
#include
#include
#include
#include

char *prt (struct tm *t)
{
char *timebuf = calloc (40, 1);
sprintf (timebuf, "%4d-%02d-%02d %2d:%02d:%02d",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
return (timebuf);
} /* prt */

int main (int arc, char *argv[])
{
char *tz[6] = { "UTC", "GMT", "UTC0UTC", "GMT0GMT", "MET", "MET-1METDST" };
int i;
time_t lt, now = time (NULL);
struct tm *tp, *lp;

for (i = 0; i < 6; i++) {
(void)printf ("%-11s ", tz[i]);
setenv ("TZ", tz[i], 1);
tzset ();
tp = localtime (&now);
lt = mktime (tp);
lp = localtime (<);
(void)printf ("%ld %s : %ld %s (%6ld)\n",
now, prt (tp), lt, prt (lp), lt - now);
}
return (0);
} /* main */
-->8---

Compile and run that on all machines you have access to, and see the difference.

--8<--- 11.31 output
UTC 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
GMT 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
UTC0UTC 1234424250 2009-02-11 21:37:30 : 1234406250 2009-02-11 21:37:30 (-18000)
GMT0GMT 1234424250 2009-02-11 21:37:30 : 1234406250 2009-02-11 21:37:30 (-18000)
MET 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
MET-1METDST 1234424250 2009-02-12 8:37:30 : 1234424250 2009-02-12 8:37:30 ( 0)
-->8---

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,898
Registered: ‎03-06-2006
Message 13 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

>H.Merijn: UTC0 would indeed be what most (all) users would use

None of your timezones are valid except for MET-1METDST. While UTC0UTC is syntacticly valid, it isn't semantically UTC:
$ TZ=UTC0UTC dst.pl
Sun Mar 08 01:59:59 UTC 2009 --> Sun Mar 08 03:00:00 UTC 2009
Sun Nov 01 01:59:59 UTC 2009 --> Sun Nov 01 01:00:00 UTC 2009

On my 11.31 system it works fine. Looking at the libc patch, I find PHCO_38048.

Ah, since you can only use setenv(3) on 11.31, I replaced it by putenv. Using setenv(3) causes it to fail. Not sure why only those two are bad?
Please use plain text.
Honored Contributor
H.Merijn Brand (procura
Posts: 6,185
Registered: ‎10-13-1997
Message 14 of 14 (172 Views)

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

I have the same patch installed.

Changing setenv () to putenv () does not change that behaviour on my system.

FYI I have done there excercises with someone from HP, and eventually he was able to reproduce.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation