Operating System - HP-UX
1834470 Members
3108 Online
110067 Solutions
New Discussion

ANSI C / Perl /gcc Problem

 
SOLVED
Go to solution
Kalin Evtimov
Regular Advisor

ANSI C / Perl /gcc Problem

Hello!
I have a general Problem with HP-UX. I want to install webminstats for monitoring the System.It uses RRDtool. But, I cannot compile RRDtool with the standard Perl that comes with HP-UX, because it requires ANSI C Compiler, and I don't have it. So, I installed another Perl distribution, that used gcc for compiling and that worked, BUT, webmin uses my standard Perl. So, I made the conclusion, that I have to compile RRDtool with the standard Perl. Is there any way for making it work with gcc and not ANSI C? Thank you.
14 REPLIES 14
H.Merijn Brand (procura
Honored Contributor
Solution

Re: ANSI C / Perl /gcc Problem

Do you have admin rights?

If so, just move the standard perl out of the way, and symlink to the new one

Assuming HP's perl is in /usr/bin, and the new gcc one in /opt/perl, change accordingly

# cd /usr/bin
# mv perl perl.hp
# ln -s /opt/perl/bin/perl perl

Done

I don't know RDD or webmintools, but if you can change the $PATH for those tools, for example by making a shell wrapper round the startup script(s), you could set the $PATH to have the perl you need be found before the perl you want to avoid

so assuming rdd starts from /usr/local/bin/rdd

# cd /usr/local/bin
# mv rdd rdd.org
# cat >rdd <#!/bin/sh
export PATH=/opt/perl/bin:$PATH
exec /usr/local/bin/rdd.org $@
EOF
# chmod 755 rdd

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

But I nedd the standard Perl for running webmin. Is it going to work after I move the standard perl out of the way, and symlink to the new one?

I think there is a bug in this standard Perl, because trying to compile rrdtools with it brings me:
Running Mkbootstrap for RRDs ()
chmod 644 RRDs.bs
rm -f blib/arch/auto/RRDs/RRDs.so
LD_RUN_PATH="" /usr/bin/ld -b +vnocompatwarnings -L/usr/lib/hpux64 RRDs.o -L../src/.libs/ -lrrd_private -lm -o blib/arch/auto/RRDs/RRDs.so
ld: Can't find library or mismatched ABI for -lrrd_private
Fatal error.
*** Error exit code 1

Stop.
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

There you are (trying to) mix 64bit and 32bit libraries and objects (mismatched ABI). You can't.

In case the webadmin tool *requires* the other version, you have to leave it there, and go for my second solution.

Yes, it *is* possible to mix HP C-ANSI-C perl and GNU gcc objects or vice versa, but it isn't /easy/.

Just out of curiousity, what are the two builds coming from? What is the output of:

lt09:/home/merijn 138 > perl -v ; perl -V:cc -V:config_args -V:cf_email -V:osname -V:osvers

This is perl, v5.8.6 built for i686-linux-64int
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

cc='cc';
config_args='-Uusedevel -Uversiononly -Duse64bitint -des';
cf_email='h.m.brand@hccnet.nl';
osname='linux';
osvers='2.6.11.4-20a-default';
lt09:/home/merijn 139 >

for both versions of perl

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

Here for my standard Perl:


This is perl, v5.8.3 built for IA64.ARCHREV_0-thread-multi-LP64
(with 8 registered patches, see perl -V for more detail)

Copyright 1987-2003, Larry Wall

Binary build 809 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jan 19 2005 10:07:33

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

cc='cc';
config_args='-ders -Dcc=cc -Accflags=-DNO_HASH_SEED -Dusethreads -Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duse64bitall -Dd_attribut=undef -Dd_u32align=define -Doptimize=-fast +DSitanium2 +Ofltacc=strict -Duselargefiles -Dinc_version_list=5.8.2/$archname 5.8.2 5.8.1/$archname 5.8.1 5.8.0/$archname 5.8.0 -Duseshrplib -Dprefix=/opt/perl_64 -Dcf_by=ActiveState -Dcf_email=support@ActiveState.com';
cf_email='support@ActiveState.com';
___________________________________________________________
And here for the other one:

This is perl, v5.8.6 built for IA64.ARCHREV_0

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

cc='gcc';
config_args='-d -e -Dcc=gcc -Ui_dbm -Ui_db -Dprefix=/usr/local useposix=true';
cf_email='root@valhalla.cis';
osname='hpux';
osvers='11.23';
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

I think that it is not possible to mix 32 and 64 bit mode. There are two Perl-Modules in the rrdtools source dir, called RRDr and RRDs. I compile RRDr without any problem, but when I try to compile RRDs, then comes the whole bla-bla that I posted before..
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

I *know* that it is not possible to mix 32 and 64 bit mode. On pa-risc.

The first perl you posted is not a `standard' HP perl. It's the ActiveState build of Perl. It's a 64bit threads enabled perl optimized for Itanium2, probably built with HP's cc (looking at the ccflags).

The second perl you posted is a 32bit non-threaded quasi-standard build Perl, built with GNU gcc.

From this I see that you are on Itanium, and I don't know if 32bit and 64bit are ruling eachother out as rigid as on pa-risc, but I'd sure try not to mix.

Deducing from the complete conversation, you were trying to build rdd with the ActivePerl, which doesn't work.

So, why not start from scratch with the rdd stuff, and set your $PATH to find the second perl first

# cd /your/path/to/rdd-1.2.3
# export PATH=/usr/local/bin:$PATH

# perl Makefile.PL
or
# configure --prefix=/usr/local --disable-nls

# make
# make test
or
# make check

# make install

Can you tell us more about the way rdd configures?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

I already compiled RRDtools with the gcc-Perl and it works. The point is, that webmin uses the ActiveState Perl and needs also a Perl Module called RRDs. The RRDs.pm is in the rrdtools source dir:
/mnt/tmp/rrdtools-1.0.49

I try:
/mnt/tmp/rrdtools-1.0.49/perl Makefile.PL
and then
/mnt/tmp/rrdtools-1.0.49/make test
as described in README

Then comes the error msg from above.

- - -
Exactly the same when trying to compile rrdtools with the ActiveState Perl, because it tries to compile the RRDs module.
- - -
I think to remove everything and then to compile one perl with gcc compiler, and not installing perl from depot, then install webmin, and then compile rrdtools with the same perl. Otherwise - great mess.

Thank you for helping me, should I tell you whether I made this work?
________________
For RRDtool see:
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/compiling.html
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

Ahhhhhhhhh. Now I get it.
You cannot build modules in the perl(2) environment and use them in the other perl(1) environment.

The procedure for you is

# perl Makefile.PL
# vi Makefile

* change all CFLAGS that only apply to HP's C to be in gcc style

# make
# make test
# make install

What you could do if you don't know about CFLAGS, is post the generated Makefile here, and have us here at the forum change it for you (don't forget about your points)

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

I don't know how to change the file. I'll be glad to learn how. I have attached the file, because it is pretty long.
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

Hoping that your gcc is a 64bit gcc, the attached modified version could work out. please report the problems if it does not.

Again, you need a 64bit gcc.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

Hoping that your gcc is a 64bit gcc, the attached modified version could work out. please report the problems if it does not.

Again, you need a 64bit gcc.
(This time *with* attachment: sometimes the buttons are just too close for comfort :) )

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

I got:

gcc -c -I.. -I../src -I../gd1.3 -mlp64 -D_POSIX_C_SOURCE=199506L -D_REENTRANT -D_HPUX_SOURCE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -O2 -DVERSION=\"1.000491\" -DXS_VERSION=\"1.000491\" -fPIC "-I/opt/perl_64/lib/5.8.3/IA64.ARCHREV_0-thread-multi-LP64/CORE" -DPERLPATCHLEVEL=8 RRDs.c
In file included from /opt/perl_64/lib/5.8.3/IA64.ARCHREV_0-thread-multi-LP64/CORE/perl.h:4109,
from RRDs.xs:6:
/usr/include/sys/ipc.h:51: error: parse error before "cid_t"
/usr/include/sys/ipc.h:56: error: parse error before '}' token
In file included from /opt/perl_64/lib/5.8.3/IA64.ARCHREV_0-thread-multi-LP64/CORE/perl.h:4110,
from RRDs.xs:6:
/usr/include/sys/sem.h:91: error: field `sem_perm' has incomplete type
In file included from ../src/rrd_tool.h:24,
from RRDs.xs:13:
../config.h:191:1: warning: "VERSION" redefined
:8:1: warning: this is the location of the previous definition
*** Error exit code 1

Stop.

gcc should be 64 bit, because I downloaded it from HP( chose gcc 3.4.3 for IA64)
H.Merijn Brand (procura
Honored Contributor

Re: ANSI C / Perl /gcc Problem

The VERSION is a redefinition somewhere in an include file, and should be easy to get around. The cid_t is a missing or misplaced include file.

If I go to the spe176 (hp's testdrive) I see

49 unsigned int seq; /* slot usage sequence number */
50 # ifdef _INCLUDE_HPUX_SOURCE
51 cid_t cid; /* Compartment ID */
52 # else
53 int __cpad; /* pad for non-hp code */
54 # endif /* _INCLUDE_HPUX_SOURCE */
55 char pad[12];/* room for future expansion */
56 };

spe176:/house/procura 103 > find /usr/include | xargs grep cid_t
/usr/include/sys/ioctl.h:#define CMPT_GET_ENDPOINT _IOR('c', 2, cid_t) /* End Point compartment */
/usr/include/sys/ioctl.h:#define CMPT_GET_PEER _IOR('c', 3, cid_t) /* Peer compartment */
/usr/include/sys/ipc.h: cid_t cid; /* Compartment ID */
/usr/include/sys/ki.h: krecid_t rec_id; /* 2 record ident */
/usr/include/sys/ki_defs.h:typedef unsigned short krecid_t;
/usr/include/sys/types.h: typedef int32_t cid_t; /* For compartment IDs */
/usr/include/sys/types.h: typedef cid_t cmpt_t;
Exit 1
spe176:/house/procura 104 >

So, cid_t is a int32_t, defined in sys/types.h

and the sem.h case:
90 struct semid_ds {
91 struct ipc_perm sem_perm; /* operation permission struct *
/
92 struct __sem *sem_base; /* ptr to first semaphore in set
*/
93 __time_t sem_otime; /* last semop time */

You have arrived at the point of a classical dilemma. Either `fix' the sources to find all the missing defines, or start from scratch by building your own gcc from src, at from which point it better adapts to your system.

Both are time consuming and can lead to Yak-shaving ( http://www.ai.mit.edu/lab/gsb/gsb-archive/gsb2000-02-11.html )

If you go down the track of rebuilding gcc from scratch, my scripts /might/ help you ( http://mirrors.develooper.com/hpux/#Gcc ) modify them for IA64

Then of course you could see if you are missing recent system patches in the C development area.

Enjoy, Have FUN! H.Merijn [ who on his own systems loves these problems as they reveal where the developers lost touch with reality ]
Enjoy, Have FUN! H.Merijn
Kalin Evtimov
Regular Advisor

Re: ANSI C / Perl /gcc Problem

I didn't know that HP-UX is such fun :) I'll check the sources..after lunch.

I already found your page, it's cool :)

Thank you once again!