- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- perl points to incorrect @INC when embedded in a "...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 03:13 AM
тАО06-17-2009 03:13 AM
perl points to incorrect @INC when embedded in a "C" code
I am trying to embed perl script in C code, but hit upon an incorrect @INC reference in the process.
Hence, i tried to reduce the test case as follows.
----
"perl -V" gives the following @INC Path:
@INC:
/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi
/opt/perl_32/lib/5.8.8
/opt/perl_32/lib/site_perl/5.8.8/PA-RISC1.1-thread-multi
/opt/perl_32/lib/site_perl/5.8.8
/opt/perl_32/lib/site_perl
/opt/perl_32/lib/vendor_perl/5.8.8/PA-RISC1.1-thread-multi
/opt/perl_32/lib/vendor_perl/5.8.8
/opt/perl_32/lib/vendor_perl
-------
# cat main.c
#include
#include
static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
int main(int argc, char **argv, char **env)
{
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
}
#cc -o interpreter main.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
#cat show.pl
#!/usr/bin/perl
sub BEGIN
{
map {print STDERR "INC: $_\n"} @INC;
#push (@INC, "/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi");
#push (@INC, "/opt/perl_32/lib/site_perl/5.8.8/PA-RISC1.1-thread-multi");
#push (@INC, "/opt/perl_32/lib/vendor_perl/5.8.8/PA-RISC1.1-thread-multi");
#map {print STDERR "INC: $_\n"} @INC;
}
## ./interpreter show.pl
INC: /opt/perl_32/lib/5.8.8/PA-RISC2.0-thread-multi
INC: /opt/perl_32/lib/5.8.8
INC: /opt/perl_32/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi
INC: /opt/perl_32/lib/site_perl/5.8.8
INC: /opt/perl_32/lib/site_perl
INC: /opt/perl_32/lib/vendor_perl/5.8.8/PA-RISC2.0-thread-multi
INC: /opt/perl_32/lib/vendor_perl/5.8.8
INC: /opt/perl_32/lib/vendor_perl
INC: .
# ls /opt/perl_32/lib/5.8.8/PA-RISC2.0-thread-multi
/opt/perl_32/lib/5.8.8/PA-RISC2.0-thread-multi not found
Please provide inputs, i have no clue how this incorrect/non-existent @INC is getting printed !
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 04:21 AM
тАО06-17-2009 04:21 AM
Re: perl points to incorrect @INC when embedded in a "C" code
the "-v" option gives a different value for the original perl interpreter and the interpreter-instance created by me
# perl -v
This is perl, v5.8.8 built for PA-RISC1.1-thread-multi
Copyright 1987-2006, 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.
# ./interpreter -v
This is perl, v5.8.8 built for PA-RISC2.0-thread-multi
Copyright 1987-2006, 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 04:52 AM
тАО06-17-2009 04:52 AM
Re: perl points to incorrect @INC when embedded in a "C" code
I suspect if you do:
# cc -o interp interp.c `/opt/perl_64/bin/perl -MExtUtils::Embed -e ccopts -e ldopts`
# ./interp -le 'print map "$_\n",@INC'
...and:
# cc -o interp interp.c `/opt/perl_32/bin/perl -MExtUtils::Embed -e ccopts -e ldopts`
# ./interp -le 'print map "$_\n",@INC'
...that your results are as expected.
What do your symbolic links look like for the folling (mine shown):
# ls -l /opt/perl
lrwxr-xr-x 1 root sys 12 Sep 11 2007 /opt/perl -> /opt/perl_64
smhfpg # ls -ld /opt/perl_64
dr-xr-xr-x 6 bin bin 8192 Oct 10 2008 /opt/perl_64
smhfpg # ls -ld /opt/perl_64/bin/perl
lrwxr-xr-x 1 bin bin 13 Aug 17 2006 /opt/perl_64/bin/perl -> ./perl-static
smhfpg # ls -ld /opt/perl_32/bin/perl
lrwxr-xr-x 1 bin bin 13 Aug 17 2006 /opt/perl_32/bin/perl -> ./perl-static
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 05:11 AM
тАО06-17-2009 05:11 AM
Re: perl points to incorrect @INC when embedded in a "C" code
Thanks for the pointer, but it didn't help though.
Log:
=====
hpmdd78# cc -o interpv1 main.c `/opt/perl_64/bin/perl -MExtUtils::Embed -e ccopts -e ldopts`
hpmdd78# ./interpv1 -le 'print map "$_\n",@INC'
/opt/perl_64/lib/5.8.8/PA-RISC2.0-thread-multi-LP64
/opt/perl_64/lib/5.8.8
/opt/perl_64/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64
/opt/perl_64/lib/site_perl/5.8.8
/opt/perl_64/lib/site_perl
/opt/perl_64/lib/vendor_perl/5.8.8/PA-RISC2.0-thread-multi-LP64
/opt/perl_64/lib/vendor_perl/5.8.8
/opt/perl_64/lib/vendor_perl
.
hpmdd78# cc -o interpv2 main.c `/opt/perl_32/bin/perl -MExtUtils::Embed -e ccopts -e ldopts`
hpmdd78# ./interpv2 -le 'print map "$_\n",@INC'
/opt/perl_32/lib/5.8.8/PA-RISC2.0-thread-multi
/opt/perl_32/lib/5.8.8
/opt/perl_32/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi
/opt/perl_32/lib/site_perl/5.8.8
/opt/perl_32/lib/site_perl
/opt/perl_32/lib/vendor_perl/5.8.8/PA-RISC2.0-thread-multi
/opt/perl_32/lib/vendor_perl/5.8.8
/opt/perl_32/lib/vendor_perl
.
The change seen was that "PA-RISC2.0-thread-multi" and "PA-RISC2.0-thread-multi-LP64".
But the ideal case must ne "PA-RISC1.1-thread-multi" instead of "PA-RISC2.0-thread-multi" in the "perl_32" build :(
The symbolic links are different from yours mine is pointing to /opt/perl_32, the rest are similar.
hpmdd78# ls -l /opt/perl
lrwxr-xr-x 1 root sys 12 Jun 10 10:22 /opt/perl -> /opt/perl_32
hpmdd78# ls -ld /opt/perl_64
dr-xr-xr-x 6 bin bin 96 May 27 11:57 /opt/perl_64
hpmdd78# ls -ld /opt/perl_64/bin/perl
lrwxr-xr-x 1 bin bin 13 Jun 10 10:23 /opt/perl_64/bin/perl -> ./perl-static
hpmdd78# ls -ld /opt/perl_32/bin/perl
lrwxrwxrwx 1 root sys 13 Jun 10 15:21 /opt/perl_32/bin/perl -> ./perl-static
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 05:42 AM
тАО06-17-2009 05:42 AM
Re: perl points to incorrect @INC when embedded in a "C" code
Does running the following show anything unexpected?
# /opt/perl_32/bin/perl -MExtUtils::Embed -le ccopts
# /opt/perl_32/bin/perl -MExtUtils::Embed -le ldopts
...or for that matter, compared to:
# perl -MExtUtils::Embed -le ccopts
# perl -MExtUtils::Embed -le ldopts
Posting your output might be insightful.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2009 05:45 AM
тАО06-17-2009 05:45 AM
Re: perl points to incorrect @INC when embedded in a "C" code
hpmdd78# /opt/perl_32/bin/perl -MExtUtils::Embed -le ccopts
-D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DAportable +DS2.0 +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/CORE
hpmdd78# /opt/perl_32/bin/perl -MExtUtils::Embed -le ldopts
-Wl,-E -Wl,-B,deferred /opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/auto/DynaLoader/DynaLoader.a -L/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/CORE -lperl -lcl -lcres -lnsl -lnm -lmalloc -ldld -lm -lcrypt -lsec -lpthread -lc
hpmdd78# perl -MExtUtils::Embed -le ccopts
-D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DAportable +DS2.0 +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/CORE
hpmdd78# perl -MExtUtils::Embed -le ldopts
-Wl,-E -Wl,-B,deferred /opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/auto/DynaLoader/DynaLoader.a -L/opt/perl_32/lib/5.8.8/PA-RISC1.1-thread-multi/CORE -lperl -lcl -lcres -lnsl -lnm -lmalloc -ldld -lm -lcrypt -lsec -lpthread -lc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2009 09:08 PM
тАО09-15-2009 09:08 PM