Operating System - Linux
1828184 Members
2742 Online
109975 Solutions
New Discussion

Re: compiling problem in Perl module in HP UNIX 11i

 
CA1490051
Frequent Advisor

compiling problem in Perl module in HP UNIX 11i

Hi all,

We have installed avtive perl 5.8.8 in HP UNIX 11i machine.

This is the thread which was closed explicitly by HP i didnt understood why it was closed.

Any how i am posting it with different subject line.

I want to call a perl subroutine from my C/C++ code.

For this i tried perldoc perlembed,

There is a good man page available there.
i am using the cc command given in that

but if i try to compile the code it gives lot of errors i think some libraries which ae specific to HP UNIX are missing can some one tell me where i can get the libraried related to this topic.

thanks and regars
Vikram
25 REPLIES 25
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>This is the thread which was closed explicitly by HP, I didn't understood why it was closed.

Which? This is still there:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1180226

>but if i try to compile the code it gives lot of errors. i think some libraries which are specific to HP UNIX are missing

What are your errors?
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i


Hi Dennis,

Below are some errors i am getting if i try to compile the insert program given in the perldoc perlembed man pages.



/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/perlvars.h", line 69: error #2757:
variable "EXT" is not a type name
PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/perlvars.h", line 69: error #2065:
expected a ";"
PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/perlvars.h", line 73: error #2077-D:
this declaration has no storage class or type specifier
PERLVARI(Guse_safe_putenv, int, 1)
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/perlvars.h", line 73: error #2065:
expected a ";"
PERLVARI(Guse_safe_putenv, int, 1)
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/reentr.inc", line 234: error #2757:
variable "PerlInterpreter" is not a type name
dTHX;
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/reentr.inc", line 234: error #2029:
expected an expression
dTHX;
^

"/opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi/CORE/reentr.inc", line 234: error #2018:
expected a ")"
dTHX;


I dont know ehat all libraries i should include or i shoud reinstall the PERL ????

Please let me know your feedback
thnaks and regards
Vikram
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>Below are some errors i am getting if i try to compile the insert program given in the perldoc perlembed man pages.
".../perlvars.h", line 69: error #2757: variable "EXT" is not a type name
PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler)

These look like macro errors.
You need to compile with -E -.i to see if you see anything obvious.

>I don't know what all libraries i should include or i should reinstall the PERL????

You haven't gotten to the link stage so it has nothing to do with libs yet.
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

I compiled the code with -E option, i am using following Makefile to compile the code

I didnt got any error or warning messages what exactily do you man by something is obvious.

Please let me know your views.


INC = -I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/ \
-I/opt/perl/lib/5.8.8 \
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi \
-I/usr/local/xibin
LIB = -L/usr/lib/hpux32/ \
-L/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/ \
-L/opt/perl/lib/5.8.8

#LFLAGS = -E

src=HelloWorld.c

all : $(SRC)
cc $(LFLAGS) $(INC) -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LIB) $(SRC) -lperl -lm
#cc $(INC) $(LFLAGS) -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LIB) -o Hello $(SRC) -lperl -lm

My perl Installation resides in /opt/perl/


thanks and regards
Vikram

Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>I compiled the code with -E option, i am using following Makefile to compile the code

I don't see any compiles with "-E -.i"?

This will create a HelloWorld.i for each HelloWorld.c.

>I didn't got any error or warning messages what exactly do you mean by something is obvious.

Compiling with -E bypasses the compile stage but lets you look at the macro expansion.
You would then have to look at the corresponding line to "perlvars.h", line 69".

You could try bypassing this step by not adding "-E -.i" and instead use "+legacy_cpp" and then the error messages may point right at the macro expansion.
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

I am referring to the man pages and deifining all the flags needed as indicated in the perl -V command output.

I tried with +legacy_cpp but cc is not recognising this flag.

I think i am missing some path settings and switches that should be defined .

Because in the error i am also getting this kind of errors
cc: "/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/perl.h", line 3464: error 1000: Unexpected symbol: "char".

I am not understanding how to go with these kinf of errors .

Please let me know your inputs this .

thanks and regards
Vikram

H.Merijn Brand (procura
Honored Contributor

Re: compiling problem in Perl module in HP UNIX 11i

What is your cc pointing at? Do you use the ANSI C-compiler or the bundled braindead compiler?

In the latter case, you could as well stop immediately, as perl needs a full-ANSI C compiler.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Merijn,

If I give man cc
It displays

Requires Optional ansi C compiler

Do you mean the compiler i am using is not ANSI C from this.

If yes after installing the ANSI C compiler i should reinstall PERL as it should be compiled with ANSI C Compiler?


thanks and regards
Vikram
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>I tried with +legacy_cpp but cc is not recognising this flag.

I can't see how it wouldn't. From your error message format above, it seems you are using aCC6 on IPF. What version?( Or cadvise?)

>I think i am missing some path settings and switches that should be defined.

Possible.

>Because in the error i am also getting this kind of errors
cc: ".../perl.h", line 3464: error 1000: Unexpected symbol: "char".

This error style is the PA C compiler, no longer IPF. What's changing??

>I am not understanding how to go with these kind of errors.

Compile with -E and redirect stdout to a file foo.i. Then use vi to look at that file around line 3464 for perl.h. You'll have to look at the #number entries for perl.h and interpolate where 3464 is.

>H.Merijn: Do you use the ANSI C-compiler

It seems like it.

>If I give man cc
Requires Optional ansi C compiler

It looks like you have it.
H.Merijn Brand (procura
Honored Contributor

Re: compiling problem in Perl module in HP UNIX 11i

if I look at cc on my 11.23/IPF, I get:

/u/usr/merijn 101 > cc --version
cc: HP C/aC++ B3910B A.06.15 [May 16 2007]
/u/usr/merijn 102 > ls -l /usr/bin/cc
lr-xr-xr-t 1 root sys 15 Nov 28 13:30 /usr/bin/cc -> /opt/aCC/bin/cc

The bundled compiler is like

/u/usr/merijn 103 > ls -l /usr/ccs/bin/cc
lrwxr-xr-x 1 iwww 191 12 Jan 4 2006 /usr/ccs/bin/cc -> ./cc_bundled

That one is useless.

On a totally different path, why do you use the ActivePerl builds? And do you really want a 32bit perl?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
James R. Ferguson
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Vikram:

> This is the thread which was closed explicitly by HP i didnt understood why it was closed. Any how i am posting it with different subject line.

You posted the same thread twice, no doubt when the forum was slow or thowing posting errors. Thus, I asked that the modeerators remove the duplicate thread before there were any replies posted to both copies.

I responded, as did others, to your initial query here:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1180226

For continuity and completeness of this entire dialog, it would have been better to have had this thread a part of the aforementioned first one.

Regards!

...JRF...


Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>H.Merijn: The bundled compiler is like ...
>That one is useless.

Quite the contrary. On IPF the bundled C compiler can't do K&R, so what's left? :-)
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi All,


Not necessary i have to use perl_32 i have installed the Active Perl newly in /opt/perl/.... with this perl version also i am getting the same errors .

I also tried the same thing in Linux - 9i also there also the same errors are coming.

Any inputs please.

One thing from my side is i will install the ANSI C compiler and install perl newly on that and try and i will update the results.

thanks and regards
Vikram
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>Any inputs please.

If you attach your HelloWorld.i I can take a look at it.
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

I tried with ANSI C compiler,

Still i get same errors.

I tried with gcc on Linux on my PC there also same errors are coming.

I am attaching my HelloWorld.c and also here is my Makefile

Please change the L Path and I Paths if you are using the Makefile.



INC = -I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/EXTERN.h \
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/INTERN.h \
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/perl.h \
-I/opt/perl/lib/5.8.8 \
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi \
-I/usr/local/xibin
INCPATH = -I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/
LIBPATH = -L/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/
LIB = -L/usr/lib/hpux32/ \
-L/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/ \
-L/opt/perl/lib/5.8.8

LFLAGS = -O2 -Olimit 2900

src=HelloWorld.c

all : $(SRC)
cc $(LFLAGS) $(INCPATH) -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LIBPATH) -o Hello $(SRC) -lperl -lm
#cc $(INC) $(LFLAGS) -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LIB) -o Hello $(SRC) 'perl -MExtUtils::Embed -e ccopts -e ldopts'





thanks and regards
Vikram
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>I am attaching my HelloWorld.c and also here is my Makefile

Can you please attach the HelloWorld.i created by -E.

-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/EXTERN.h
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/INTERN.h
-I/opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/perl.h

-I are directory paths, not file paths, remove these three. (But this is only used in the commented out command.)

>LFLAGS = -O2 -Olimit 2900

2900 isn't valid for HP's compiler.
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

Sorry for the late reply.

Please find the Preprocessor output file attached.



thanks and regards
Vikram
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

It appears some EXT macro is broken?

Can you redo that -E compile but add -Wp,-C,-G and attach that .i file.
Also /opt/perl/lib/5.8.8/PA-RISC1.1-thread-multi/CORE/EXTERN.h.

Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>It appears some EXT macro is broken?
>Can you redo that -E compile but add -Wp,-C,-G and attach that .i file.

Ok, I did this. Your problem is that you have a lemon HelloWorld.c, where did you get this?

Looking at my perldoc perlembed for "5.8.0" clearly shows this order:
#include
#include

I didn't see any mention of , so you should remove that too.
Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

This is probably a good link:
http://perldoc.perl.org/perlembed.html
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

I have removed the INTERN.h and also perlapi.h from my program and if i give -Wp the compiler complains that "-Wp" unknown option.

Any how i am attaching both the files with Wp and without Wp flag in the Makefile.

Please have a look at it and let me know your feedback.


thanks and regards
Vikram

CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

oops i forgot to attch one more file .

Signs of Old Age as u mentioned earlier !!!!!!!!!


Please find it attached now.


thanks and regards
Vikram



Dennis Handly
Acclaimed Contributor

Re: compiling problem in Perl module in HP UNIX 11i

>I have removed the INTERN.h and also perlapi.h from my program

Then it should just work. No need to use debugging options after I solved it.

>if i give -Wp the compiler complains that "-Wp" unknown option.

You used?: -Wp,-C,-G
You seemed to replace "," by space.

>Please have a look at it and let me know your feedback.

The problem was already solved when I could make it myself and moved EXTERN.h up.
CA1490051
Frequent Advisor

Re: compiling problem in Perl module in HP UNIX 11i

Hi Dennis,

Thank you very for your support .

Yes the problem was in the Header file inclusion i included

#include
before perl.h
The code is compiling now.

But, it is having some problems with the linking the output file (Hello the executable)it is generating is not having the executablr permissions.

If i do that file manually executable, it created a core dump.

If i open the core through wdb,
the debugger stops at the line

PL_exit_flags |= PERL_EXIT_DESTRUCT_END ;
in source code i think i have to go through in detail what exactly these flags are doing.

If i get a solution i will update in the forum .
If you already know the solution please let me know.

Also, the same code if i try to compile on LINUX machine, it says,
stray error 226

I dont what is this stray ERROR .

Please let me know if you have got any knowledge of this.

thanks and regards
Vikram