perl-DBI / perl-DBD-oracle installation - perl

What I want to do is connecting and retrieving data from oracle database through perl.
What i did(as oracle account) is like below.....
$ rpm -qa|grep DBI
perl-DBI-1.52-2.el5
$ wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.17.tar.gz
$ tar -zxf DBD-Oracle-1.17.tar.gz
$ cd DBD-Oracle-1.17
$ perl Makefile.PL
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)
Remember to actually *READ* the README file! Especially if you have any problems.
Using Oracle in /sw/oracle/app/oracle/product/102
DEFINE _SQLPLUS_RELEASE = "1002000500" (CHAR)
Oracle version 10.2.0.5 (10.2)
Found /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Using /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Your LD_LIBRARY_PATH env var is set to '/sw/oracle/app/oracle/product/102/lib:/usr/lib:/sw/oracle/app/oracle/product/102/lib32:.'
Reading /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Reading /sw/oracle/app/oracle/product/102/rdbms/lib/env_rdbms.mk
Attempting to discover Oracle OCI build rules
gcc -c -o DBD_ORA_OBJ.o DBD_ORA_OBJ.c
by executing: [make -f /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
Oracle oci build command:
[true -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -o DBD_ORA_EXE DBD_ORA_OBJ.o -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread]
Found header files in /sw/oracle/app/oracle/product/102/rdbms/public.
Checking for functioning wait.ph
Constant subroutine __USE_POSIX undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 8.
Constant subroutine __USE_POSIX2 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 9.
Constant subroutine __USE_POSIX199309 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 10.
Constant subroutine __USE_POSIX199506 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 11.
Constant subroutine __USE_XOPEN undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 12.
Constant subroutine __USE_XOPEN_EXTENDED undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 13.
Constant subroutine __USE_UNIX98 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 14.
Constant subroutine __USE_LARGEFILE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 16.
Constant subroutine __USE_LARGEFILE64 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 17.
Constant subroutine __USE_FILE_OFFSET64 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 18.
Constant subroutine __USE_BSD undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 19.
Constant subroutine __USE_SVID undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 20.
Constant subroutine __USE_MISC undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 21.
Constant subroutine __USE_GNU undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 23.
Constant subroutine __USE_REENTRANT undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 24.
Constant subroutine _POSIX_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 49.
Constant subroutine _POSIX_C_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 51.
Constant subroutine _XOPEN_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 53.
Constant subroutine _XOPEN_SOURCE_EXTENDED undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 55.
Constant subroutine _LARGEFILE64_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 57.
Constant subroutine _LARGEFILE_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 104.
Constant subroutine __USE_ISOC99 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 108.
Constant subroutine __GNU_LIBRARY__ undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 156.
Operator or semicolon missing before &__inline at (eval 167) line 1.
Ambiguous use of & resolved as operator & at (eval 167) line 1.
Constant subroutine __need_size_t undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/stddef.ph line 148.
Scalar found where operator expected at (eval 241) line 1, near "'int' $__val"
(Missing operator before $__val?)
Number found where operator expected at (eval 245) line 1, near ") 0"
(Missing operator before 0?)
Number found where operator expected at (eval 246) line 1, near ") 1"
(Missing operator before 1?)
Number found where operator expected at (eval 247) line 1, near ") 2"
(Missing operator before 2?)
Constant subroutine __need_timespec undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/time.ph line 49.
Hexadecimal number > 0xffffffff non-portable at (eval 447) line 1.
Hexadecimal number > 0xffffffff non-portable at (eval 448) line 1.
Constant subroutine __need_timeval undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/bits/time.ph line 23.
System: perl5.008008 linux builder10.centos.org 2.6.18-53.el5 #1 smp mon nov 12 02:14:55 est 2007 x86_64 x86_64 x86_64 gnulinux
Compiler: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
Linker: /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Oracle makefiles would have used these definitions but we override them:
CC: $(COMPDIR)/bin/gcc
CFLAGS: $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\
$(SHARED_CFLAG) $(USRFLAGS)
[$(GFLAG) -O3 $(CDEBUG) -m32 -trigraphs -fPIC -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -fno-strict-aliasing $(LPFLAGS) $(USRFLAGS)]
LDFLAGS: $(LDFLAGS32)
[-m32 -o $# -L/sw/oracle/app/oracle/product/102/rdbms//lib32/ -L/sw/oracle/app/oracle/product/102/lib32/ -L/sw/oracle/app/oracle/product/102/lib32/stubs/]
Linking with OTHERLDFLAGS = -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread [from 'build' rule]
Checking if your kit is complete...
Looks good
LD_RUN_PATH=/sw/oracle/app/oracle/product/102/lib:/sw/oracle/app/oracle/product/102/rdbms/lib
Using DBD::Oracle 1.17.
Using DBD::Oracle 1.17.
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle
*** If you have problems...
read all the log printed above, and the README and README.help.txt files.
(Of course, you have read README by now anyway, haven't you?)
$ make
cp Oracle.pm blib/lib/DBD/Oracle.pm
cp oraperl.ph blib/lib/oraperl.ph
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp Oraperl.pm blib/lib/Oraperl.pm
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
/usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/Driver.xst > Oracle.xsi
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" Oracle.c
Oracle.c: In function 'XS_DBD__Oracle__db_ora_lob_append':
Oracle.xs:201: warning: unused variable 'startp'
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" dbdimp.c
dbdimp.c: In function 'ora_db_login6':
dbdimp.c:652: warning: value computed is not used
dbdimp.c: In function 'dbd_rebind_ph_char':
dbdimp.c:1052: warning: value computed is not used
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" oci8.c
oci8.c: In function 'fetch_func_rset':
oci8.c:626: warning: value computed is not used
oci8.c: In function 'dbd_rebind_ph_lob':
oci8.c:711: warning: value computed is not used
oci8.c: In function 'ora_blob_read_mb_piece':
oci8.c:778: warning: comparison is always false due to limited range of data type
oci8.c: In function 'ora_describe':
oci8.c:1267: warning: comparison is always false due to limited range of data type
oci8.c: In function 'post_execute_lobs':
oci8.c:2118: warning: value computed is not used
oci8.c: At top level:
oci8.c:563: warning: 'fetch_func_nty' defined but not used
Running Mkbootstrap for DBD::Oracle ()
chmod 644 Oracle.bs
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Oracle.o dbdimp.o oci8.o -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread -o blib/arch/auto/DBD/Oracle/Oracle.so \
\
chmod 755 blib/arch/auto/DBD/Oracle/Oracle.so
cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs
chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs
/usr/bin/perl "-Iblib/arch" "-Iblib/lib" ora_explain.PL ora_explain
Extracted ora_explain from ora_explain.PL with variable substitutions.
cp ora_explain blib/script/ora_explain
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/ora_explain
Manifying blib/man1/ora_explain.1
Manifying blib/man3/DBD::Oracle.3pm
Manifying blib/man3/DBD::Oraperl.3pm
$ make install
Warning: You do not have permissions to install into /usr/share/man/man1 at /usr/lib/perl5/5.8.8/ExtUtils/Install.pm line 114.
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ sudo - chmod 777 /usr/share/man
Warning: You do not have permissions to install into /usr/bin at /usr/lib/perl5/5.8.8/ExtUtils/Install.pm line 114.
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ sudo - chmod 777 /usr/bin
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ perl -e 'use DBD::Oracle'
install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: /sw/oracle/app/oracle/product/102/lib/libnnz10.so: cannot restore segment prot after reloc: Permission denied at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at ./ora_dump.pl line 7
I've checked permission of /sw/oracle/app/oracle/product/102/lib/libnnz10.so.
My machine is on CentOS release 5.5 and 10g Enterprise Edition Release 10.2.0.5.0...
What am I missing?

Sounds like an issue with SELinux. Try disabling it and see if this resolves your problem:
http://www.crypt.gen.nz/selinux/disable_selinux.html

I do not know what you are missing and where you are going wrong. But I always follow below method and it has worked 100% times for me. Try this method and if it does not work, then I can definitely make it work for you....
One thing I notice in your post is that you are getting permissions issues. Try running these steps as root.
My environment: Oracle 11G running on remote box
My desktop: ubunt/fedora/RHEL/CenOS
I have implemented this on all above 4 flavors of Linux and they all work perfectly.
Here are the steps (Follow 'em the sequence given):
Install Perl DBI module
install below 3 rpm for oracle instant client from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I am using 64 bit linux box, so choose your RPM accordingly.
set below variables:
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
ORACLE_HOME=/usr/lib/oracle/11.2/client64
also add ORACLE_HOME to your PATH variable
download DBD::Oracle ver 1.44 from CPAN.
untar the module and run below commands in given sequence:
perl Makefile.PL
make make
install
DONE !!!

Related

Can't locate Data/Dumper.pm when building dssp - perl is installed but cannot be found?

I am trying to build dssp (https://github.com/cmbi/dssp) on a server-node (not on server-login), and I am facing a problem with how the system finds dependencies. I am working on a centos 7.
The procedure of building dssp is : run ./autogen to get a configure.sh file and then execute that one. Then run make.
Running whereis perl and whereis perl5 I get:
[mavridks#haswell-182 dssp-2.3.0]$ whereis perl
perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz
[mavridks#haswell-182 dssp-2.3.0]$ whereis perl5
perl5: /usr/lib64/perl5 /usr/share/perl5
Then, running ./autogen I get the error:
Can't locate Data/Dumper.pm in #INC
(#INC contains:
/hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.)
at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf/Autom4te/C4che.pm line 33.
BEGIN failed--compilation aborted
at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf/Autom4te/C4che.pm line 33.
Compilation failed in require
at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/bin/autom4te line 37.
BEGIN failed--compilation aborted
at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/bin/autom4te line 37.
aclocal: error: echo failed with exit status: 2
(Line breaks added for readability.)
It seems to me that this error when autoconf is called has something to do with not locating correctly the Perl files or having more paths than it should? Another thought would be that I don't have root privileges on the server and that perhaps this creates a problem?
Any ideas or suggestions are welcomed.
NOTE:
The server uses a module system to load various dependencies. I need Autotools and Boost. The module I am using, if this is something of importance, are
[mavridks#haswell-182 dssp-2.3.0]$ module list
Currently Loaded Modules:
1) numactl/.2.0.10-GCC-4.8.4 (H)
2) hwloc/.1.10.1-GCC-4.8.4 (H)
3) OpenMPI/1.8.4-GCC-4.8.4
4) OpenBLAS/0.2.13-GCC-4.8.4-LAPACK-3.5.0
5) gompi/1.7.20
6) FFTW/3.3.4-gompi-1.7.20
7) ScaLAPACK/2.0.2-gompi-1.7.20-OpenBLAS-0.2.13-LAPACK-3.5.0
8) goolf/1.7.20
9) bzip2/.1.0.6-goolf-1.7.20 (H)
10) zlib/.1.2.8-goolf-1.7.20 (H)
11) Boost/1.58.0-goolf-1.7.20
12) slurm/18-08-4-1-hits
13) GCC/4.8.4
14) gcc/dummy
15) sge/dummy
16) M4/1.4.17-GCC-4.8.4
17) Autoconf/2.69-GCC-4.8.4
18) Automake/1.15-GCC-4.8.4
19) libtool/2.4.6-GCC-4.8.4
20) Autotools/20150215-GCC-4.8.4
Where:
H: Hidden Module
EDIT:
After the comment of Håkon Hægland I get:
[mavridks#haswell-005 ~]$ perl --version | grep 'This is'
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-thread-multi
[mavridks#haswell-005 ~]$ perl -MData::Dumper -E 'say $INC{"Data/Dumper.pm"}'
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/Data/Dumper.pm
EDIT 2:
Here is the result after re-running the ./autogen
[mavridks#haswell-112 dssp-2.3.0]
$ PERL5LIB=/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/lib/perl5/5.30.0 ./autogen.sh
/hits/sw/shared/apps/Automake/1.15-GCC-4.8.4/bin/aclocal:
Perl lib version (5.30.0) doesn't match executable '/usr/bin/perl' version (5.16.3)
at /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/Config.pm line 62.
Compilation failed in require
at /hits/sw/shared/apps/Automake/1.15-GCC-4.8.4/share/automake-1.15/Automake/Config.pm line 41.
BEGIN failed--compilation aborted
at /hits/sw/shared/apps/Automake/1.15-GCC-4.8.4/share/automake-1.15/Automake/Config.pm line 41.
Compilation failed in require
at /hits/sw/shared/apps/Automake/1.15-GCC-4.8.4/bin/aclocal line 37.
BEGIN failed--compilation aborted
at /hits/sw/shared/apps/Automake/1.15-GCC-4.8.4/bin/aclocal line 37.
(Line breaks added for readability.)
EDIT 3:
After a lot of helpful comments and an answer I am adding some more info:
First one connects to the server login-node. Running whereis perl gives:
[mavridks#haswell-login ~]$ whereis perl
perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz
and also, running
[mavridks#haswell-login ~]$ perl --version
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-
linux-thread-multi
(with 39 registered patches, see perl -V for more detail)
.Finally one gets:
[mavridks#haswell-login ~]$ perl -MData::Dumper -E 'say
$INC{"Data/Dumper.pm"}'
/usr/lib64/perl5/vendor_perl/Data/Dumper.pm
Side-note: What do we get running perl -V?
a) On the login-node:
[mavridks#haswell-login ~]$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
Platform:
osname=linux, osvers=3.10.0-693.17.1.el7.x86_64, archname=x86_64-linux-thread-multi
uname='linux x86-01.bsys.centos.org 3.10.0-693.17.1.el7.x86_64 #1 smp thu jan 25 20:13:58 utc 2018 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root#localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.8.5 20150623 (Red Hat 4.8.5-36)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -fstack-protector'
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro '
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API USE_SITECUSTOMIZE
Locally applied patches:
Fedora Patch1: Removes date check, Fedora/RHEL specific
Fedora Patch3: support for libdir64
Fedora Patch4: use libresolv instead of libbind
Fedora Patch5: USE_MM_LD_RUN_PATH
Fedora Patch6: Skip hostname tests, due to builders not being network capable
Fedora Patch7: Dont run one io test due to random builder failures
Fedora Patch9: Fix find2perl to translate ? glob properly (RT#113054)
Fedora Patch10: Fix broken atof (RT#109318)
Fedora Patch13: Clear $# before "do" I/O error (RT#113730)
Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)
Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)
Fedora Patch16: Do not leak with attribute on my variable (RT#114764)
Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)
Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)
Fedora Patch19: Do not crash when vivifying $|
Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329)
Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396)
Fedora Patch22: Fix leaking tied hashes (RT#107000) [1]
Fedora Patch23: Fix leaking tied hashes (RT#107000) [2]
Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]
Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT#106212)
Fedora Patch26: Make regexp safe in a signal handler (RT#114878)
Fedora Patch27: Update h2ph(1) documentation (RT#117647)
Fedora Patch28: Update pod2html(1) documentation (RT#117623)
Fedora Patch29: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)
RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/crypt.t (RT#121591)
RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912)
RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)
RHEL Patch33: Remove CPU-speed-sensitive test in Benchmark test
RHEL Patch34: Make File::Glob work with threads again
RHEL Patch35: Fix CRLF conversion in ASCII FTP upload (CPAN RT#41642)
RHEL Patch36: Do not leak the temp utf8 copy of namepv (CPAN RT#123786)
RHEL Patch37: Fix duplicating PerlIO::encoding when spawning threads (RT#31923)
RHEL Patch38: Add SSL support to Net::SMTP (CPAN RT#93823) [1]
RHEL Patch39: Add SSL support to Net::SMTP (CPAN RT#93823) [2]
RHEL Patch40: Add SSL support to Net::SMTP (CPAN RT#93823) [3]
RHEL Patch41: Add SSL support to Net::SMTP (CPAN RT#93823) [4]
RHEL Patch42: Do not overload ".." in Math::BigInt (CPAN RT#80182)
RHEL Patch43: Fix CVE-2018-18311 Integer overflow leading to buffer overflow
Built under linux
Compiled at Jan 21 2019 22:09:19
#INC:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.
[mavridks#haswell-login ~]$
b) On the gpu-node:
[mavridks#haswell-179 ~]$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
Platform:
osname=linux, osvers=3.10.0-693.17.1.el7.x86_64, archname=x86_64-linux-thread-multi
uname='linux x86-01.bsys.centos.org 3.10.0-693.17.1.el7.x86_64 #1 smp thu jan 25 20:13:58 utc 2018 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root#localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.8.5 20150623 (Red Hat 4.8.5-36)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -fstack-protector'
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro '
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API USE_SITECUSTOMIZE
Locally applied patches:
Fedora Patch1: Removes date check, Fedora/RHEL specific
Fedora Patch3: support for libdir64
Fedora Patch4: use libresolv instead of libbind
Fedora Patch5: USE_MM_LD_RUN_PATH
Fedora Patch6: Skip hostname tests, due to builders not being network capable
Fedora Patch7: Dont run one io test due to random builder failures
Fedora Patch9: Fix find2perl to translate ? glob properly (RT#113054)
Fedora Patch10: Fix broken atof (RT#109318)
Fedora Patch13: Clear $# before "do" I/O error (RT#113730)
Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)
Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)
Fedora Patch16: Do not leak with attribute on my variable (RT#114764)
Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)
Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)
Fedora Patch19: Do not crash when vivifying $|
Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329)
Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396)
Fedora Patch22: Fix leaking tied hashes (RT#107000) [1]
Fedora Patch23: Fix leaking tied hashes (RT#107000) [2]
Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]
Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT#106212)
Fedora Patch26: Make regexp safe in a signal handler (RT#114878)
Fedora Patch27: Update h2ph(1) documentation (RT#117647)
Fedora Patch28: Update pod2html(1) documentation (RT#117623)
Fedora Patch29: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)
RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/crypt.t (RT#121591)
RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912)
RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)
RHEL Patch33: Remove CPU-speed-sensitive test in Benchmark test
RHEL Patch34: Make File::Glob work with threads again
RHEL Patch35: Fix CRLF conversion in ASCII FTP upload (CPAN RT#41642)
RHEL Patch36: Do not leak the temp utf8 copy of namepv (CPAN RT#123786)
RHEL Patch37: Fix duplicating PerlIO::encoding when spawning threads (RT#31923)
RHEL Patch38: Add SSL support to Net::SMTP (CPAN RT#93823) [1]
RHEL Patch39: Add SSL support to Net::SMTP (CPAN RT#93823) [2]
RHEL Patch40: Add SSL support to Net::SMTP (CPAN RT#93823) [3]
RHEL Patch41: Add SSL support to Net::SMTP (CPAN RT#93823) [4]
RHEL Patch42: Do not overload ".." in Math::BigInt (CPAN RT#80182)
Built under linux
Compiled at Oct 30 2018 18:59:43
#INC:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.
Then one connects to a gpu-node. It seems we still have the same perl:
[mavridks#haswell-179 ~]$ whereis perl
perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz
but now Data/Dumber is no more ( running perl -MData::Dumper -E 'say $INC{"Data/Dumper.pm"}' ):
[mavridks#haswell-179 ~]$ perl -MData::Dumper -E 'say $INC{"Data/Dumper.pm"}'
Can't locate Data/Dumper.pm in #INC (#INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
Then the IT department suggested loading the perl module; the server is built on a module system where all groups have the ability to load software as modules ( appending the right files in the path - this is the system used https://lmod.readthedocs.io/en/latest/#overview). So, if we run module load Perl we have:
[mavridks#haswell-179 ~]$ whereis perl
perl: /usr/bin/perl /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl /usr/share/man/man1/perl.1.gz
which means we have changed something( the distribution used may I say?). But now we have:
[mavridks#haswell-179 ~]$ perl -MData::Dumper -E 'say $INC{"Data/Dumper.pm"}'
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/lib/perl5/5.30.0/x86_64-linux-thread-multi/Data/Dumper.pm
which means we have the Data/Dumper on the system.
Finally, one need to load all the autotools as a module too. Then, it seems that the execution of the autogen.sh script is looking for perl modules from the system ( the one from login and not gpu) but of course it can't locate them.
[mavridks#haswell-179 dssp-2.3.0]$ ./autogen.sh
Can't locate Data/Dumper.pm in #INC (#INC contains: /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf/Autom4te/C4che.pm line 33.
BEGIN failed--compilation aborted at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/share/autoconf/Autom4te/C4che.pm line 33.
Compilation failed in require at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/bin/autom4te line 37.
BEGIN failed--compilation aborted at /hits/sw/shared/apps/Autoconf/2.69-GCC-4.8.4/bin/autom4te line 37.
aclocal: error: echo failed with exit status: 2
You have two builds of perl installed.
/usr/bin/perl, v5.16.3[1]
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl, v5.30.0[2]
I shall dub them "system perl" and "modular perl" respectively.
The system perl doesn't have Data::Dumper installed.[3]
The modular perl does have Data::Dumper installed.[4]
whereis shows only the system perl in your PATH, but later commands show perl invoking the modular perl. So either perl is an alias for the modular perl,[5] or you ran your tests in different environments (i.e. your PATH changed).
Is it appropriate to set PERL5LIB?
At one point, you set env var PERL5LIB to /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/lib/perl5/5.30.0. This is not appropriate.
This is incorrect for the system perl.[6]
This is unnecessary for the modular perl. It is redundant.[7]
Why doesn't the system perl have Data::Dumper installed?
Perl has certain modules that come with it. For virtually as long as support for modules has existed in Perl, this has included Data::Dumper. Data::Dumper should always be available.
However, certain linux distros split Perl into multiple packages. It appears that Data::Dumper is found in the perl(Data::Dumper) package in CentOS 7.
So the solution is to install that package.
Since Data::Dumper is dual-lived, it can also be installed from CPAN. This doesn't require any special permissions. That said, I usually recommend installing perl locally instead of messing with the system perl. It seems you already have such a Perl. This leads us to the next sub-answer.
What if I want to use the modular perl?
I'm not sure.
A quick experiment leads me to believe this can be solved by simply placing the modular perl in the PATH before /usr/bin.
export PATH="/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin:$PATH"
Alternatively, quick experiments suggest that both of the following also work:
./configure PERL=/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl
PERL=/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl ./configure
If these don't do the trick, this can be asked as a separate question.
What if I disagree with something in this answer?
Some of my statements were guesses. For example, /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl wasn't mentioned anywhere in your question. If you believe I've made a mistake, please provide the output of the following command (parens and all):
(
echo 'System perl:'
/usr/bin/perl -v | grep 'This is'
PERL5LIB= /usr/bin/perl -e'CORE::say for #INC'
echo
echo "Data::Dumper in system perl?"
PERL5LIB= /usr/bin/perl -e'
use Data::Dumper;
CORE::say $Data::Dumper::VERSION;
CORE::say INC{"Data/Dumper.pm"};
'
echo
echo 'Modular perl:'
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -v | grep 'This is'
PERL5LIB= /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -e'CORE::say for #INC'
echo
echo "Data::Dumper in modular perl?"
PERL5LIB= /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -e'
use Data::Dumper;
CORE::say $Data::Dumper::VERSION;
CORE::say $INC{"Data/Dumper.pm"};
'
echo
echo 'Perl env vars:'
perl -e'CORE::say "$_: $ENV{$_}" for grep /^PERL/, keys(%ENV)'
echo
echo 'type perl:'
type perl
)
Footnotes.
This can be verified using
/usr/bin/perl -v | grep 'This is'
This can be verified using
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -v | grep 'This is'
This can be verified using
/usr/bin/perl -e'use Data::Dumper;'
This can be verified using
/hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -e'use Data::Dumper;'
In some shells (incl dash, bash and ksh), this can be verified using
type perl
This is what lead to Perl lib version (5.30.0) doesn't match executable '/usr/bin/perl' version (5.16.3).
This can be verified using
PERL5LIB= /hits/sw/shared/apps/Perl/5.30.0-GCCcore-8.3.0/bin/perl -e'CORE::say for #INC;'

ODBM_File.xs: too few arguments to function ‘dbmclose’ while building perl

I have been attempting to install Perl 5-22.0 locally on a server (on SUSE Linux x86_64). I was able to run .configure on the source code, but following the make command, I obtained the following error:
CE=2 -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -O2 -DVERSION=\"1.12\" -DXS_VERSION=\"1.12\" -fPIC "-I../.." ODBM_File.c
ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’:
ODBM_File.xs:128: error: too few arguments to function ‘dbmclose’
make[1]: *** [ODBM_File.o] Error 1
make[1]: Leaving directory `/home1/02568/mshpak/perl/perl-5.22.0/ext/ODBM_File'
make[1]: Entering directory `/home1/02568/mshpak/perl/perl-5.22.0/ext/ODBM_File'
cc -c -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -O2 -DVERSION=\"1.12\" -DXS_VERSION=\"1.12\" -fPIC "-I../.." ODBM_File.c
ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’:
ODBM_File.xs:128: error: too few arguments to function ‘dbmclose’
make[1]: *** [ODBM_File.o] Error 1
make[1]: Leaving directory `/home1/02568/mshpak/perl/perl-5.22.0/ext/ODBM_File'
Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 574.
make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 25
What is error code 512, and is there a straightforward way to correct this (presumably something related to the ODBM_File directory's contents)?
Thank you
This is a known issue on SUSE Linux:
error: too few arguments to function 'dbmclose'
Building ODBM_File on some (Open)SUSE distributions might run into this error, as the header file is broken. There are two ways to deal with this
Disable the use of ODBM_FILE
Configure ... -Dnoextensions=ODBM_File
Fix the header file, somewhat like this:
--- a/usr/include/dbm.h 2010-03-24 08:54:59.000000000 +0100
+++ b/usr/include/dbm.h 2010-03-24 08:55:15.000000000 +0100
## -59,4 +59,4 ## extern datum firstkey __P((void));
extern datum nextkey __P((datum key));
-extern int dbmclose __P((DBM *));
+extern int dbmclose __P((void));

Linking OpenMP with Matlab mex files [duplicate]

I've written a program of the following form:
#include "stuff_I_need.h"
int main(){
construct_array(); // uses OpenMP pragma's
print_array();
return(0);
}
that compiles, links, and runs correctly with the following command:
`gcc44 -I/home/matteson/sundials/include/ main.c -lm -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial -fopenmp -o /home/matteson/MPI_test/CVODE_test/main_test`
"gcc44" is simply gcc version 4.4 and is named like this because it's being compiled on a cluster that maintains several versions of gcc. The libraries sundials_cvode and sundials_nvecserial are used in the solving of several differential equations during the construction of the array.
Now when I want to transfer over to Matlab and try to compile the mex file of the form:
#include "stuff_I_need.h"
void mexFunction(int nlhs,mxArray* plhs[], int nrhs, const mxArray* prhs[]){
construct_array(); // uses OpenMP pragma's
print_array();
}
and try to compile with the following command in Matlab:
>> mex -v CC="gcc44" CFLAGS="\$CFLAGS -I/home/matteson/sundials/include/ -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial" mex_cvode.c
I get the following messages culminating in a link error:
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
FILE = /home/matteson/.matlab/R2010b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /misc/linux/64/opt/pkg/matlab/R2010b
-> CC = gcc44
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -L/home/matteson/sundials/lib -lsundials_nvecserial
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc44
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmpofopenmp
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
Warning: You are using gcc version "4.4.4". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> gcc44 -c -I/misc/linux/64/opt/pkg/matlab/R2010b/extern/include -I/misc/linux/64/opt/pkg/matlab/R2010b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -L/home/matteson/sundials/lib -lsundials_nvecserial -DMX_COMPAT_32 -O -DNDEBUG "mex_cvode.c"
-> gcc44 -O -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmpofopenmp -o "mex_cvode.mexa64" mex_cvode.o -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
mex_cvode.o: In function `mexFunction':
mex_cvode.c:(.text+0x2b2): undefined reference to `N_VNew_Serial'
mex_cvode.c:(.text+0x2db): undefined reference to `N_VNew_Serial'
mex_cvode.c:(.text+0x35b): undefined reference to `CVodeCreate'
mex_cvode.c:(.text+0x39c): undefined reference to `CVodeInit'
mex_cvode.c:(.text+0x3dd): undefined reference to `CVodeSVtolerances'
mex_cvode.c:(.text+0x412): undefined reference to `CVodeSetUserData'
mex_cvode.c:(.text+0x449): undefined reference to `CVDense'
mex_cvode.c:(.text+0x482): undefined reference to `CVDlsSetDenseJacFn'
mex_cvode.c:(.text+0x50c): undefined reference to `CVode'
mex_cvode.c:(.text+0x5b4): undefined reference to `N_VDestroy_Serial'
mex_cvode.c:(.text+0x5c0): undefined reference to `N_VDestroy_Serial'
mex_cvode.c:(.text+0x5cc): undefined reference to `CVodeFree'
collect2: ld returned 1 exit status
mex: link of ' "mex_cvode.mexa64"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Somehow, I'm not giving the correct flags to link appropriately. As I get the same set of errors (plus a few more) if I remove the commands to link in the gcc44 command, I'm pretty sure that I'm not getting the compiler to "see" the libraries.
My questions are :
If my analysis of the error is correct, what flags do I need to pass to the mex compilation command to successfully link?
Alternatively, what are the gcc flags to compile and link outside of the Matlab environment to compile a .mex64 executable?
If my analysis is wrong, where to go from here?
I think I've ruled out the unsupported compiler warning since I've been able to compile simple mex with OpenMP programs using gcc 4.4, but these did not have to link against anything except the math library. Also, if I compile with version gcc version 4.1.2 or 4.3.4 with or without the "-fopenmp" flags I get the same error.
In the end I do need version 4.4 because of certain OpenMP support that did not appear in prior versions.
Thanks in advance for the help.
--Andrew
Edits: (#KWATFORD)
So I tried the command with the statements outside the the quotes, and got the error:
-> gcc44 -c -I/home/matteson/sundials/include/ -I/misc/linux/64/opt/pkg/matlab/R2010b/extern/include -I/misc/linux/64/opt/pkg/matlab/R2010b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -fopenmp -DMX_COMPAT_32 -O -DNDEBUG "mex_cvode.c"
-> gcc44 -O -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmp -o "mex_cvode.mexa64" mex_cvode.o -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
/usr/bin/ld: /home/matteson/sundials/lib/libsundials_cvode.a(cvode.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/matteson/sundials/lib/libsundials_cvode.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
mex: link of ' "mex_cvode.mexa64"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
I'm a bit confused about the suggestion to recompile with "-fPIC" because when I look at the gcc44 command I see the -fPIC as an option.
Are they saying to recompile the library with -fPIC?
I don't have the source for the library, if the suggestion is to recompile the library is there a workaround?
What does "relocation against local object" mean?
My continued thanks.
Try not putting the -l, -L, or -I arguments in those environment variables. The mex function will handle those types of arguments directly. So perhaps something like:
mex -v CC="gcc44" CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial mex_cvode.c
Kwatford put me on the right track with the second question. I was able to get the mex command to work by rebuilding the sundials solver with shared libraries. Specifically, I built with:
% make distclean
% ./configure --prefix=/home/matteson/sundials --enable-shared
% make
% make install
Also, thanks to kwatford for the fix to the original by calling:
mex -v CC="gcc44" CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial mex_cvode.c
since mex knows how to handle the -L and -I.
Matlab uses its own libstdc and libstdc++.
The shortcut would be to do a symbolink to those libraries to the gcc44 libraries that you want to use.
But this may not be the desired way to go. You could try compiling outside matlab prompt and see if it still fails compilation first.

How to link during Matlab's MEX compilation

I've written a program of the following form:
#include "stuff_I_need.h"
int main(){
construct_array(); // uses OpenMP pragma's
print_array();
return(0);
}
that compiles, links, and runs correctly with the following command:
`gcc44 -I/home/matteson/sundials/include/ main.c -lm -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial -fopenmp -o /home/matteson/MPI_test/CVODE_test/main_test`
"gcc44" is simply gcc version 4.4 and is named like this because it's being compiled on a cluster that maintains several versions of gcc. The libraries sundials_cvode and sundials_nvecserial are used in the solving of several differential equations during the construction of the array.
Now when I want to transfer over to Matlab and try to compile the mex file of the form:
#include "stuff_I_need.h"
void mexFunction(int nlhs,mxArray* plhs[], int nrhs, const mxArray* prhs[]){
construct_array(); // uses OpenMP pragma's
print_array();
}
and try to compile with the following command in Matlab:
>> mex -v CC="gcc44" CFLAGS="\$CFLAGS -I/home/matteson/sundials/include/ -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial" mex_cvode.c
I get the following messages culminating in a link error:
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
FILE = /home/matteson/.matlab/R2010b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /misc/linux/64/opt/pkg/matlab/R2010b
-> CC = gcc44
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -L/home/matteson/sundials/lib -lsundials_nvecserial
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc44
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmpofopenmp
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
Warning: You are using gcc version "4.4.4". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> gcc44 -c -I/misc/linux/64/opt/pkg/matlab/R2010b/extern/include -I/misc/linux/64/opt/pkg/matlab/R2010b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -L/home/matteson/sundials/lib -lsundials_nvecserial -DMX_COMPAT_32 -O -DNDEBUG "mex_cvode.c"
-> gcc44 -O -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmpofopenmp -o "mex_cvode.mexa64" mex_cvode.o -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
mex_cvode.o: In function `mexFunction':
mex_cvode.c:(.text+0x2b2): undefined reference to `N_VNew_Serial'
mex_cvode.c:(.text+0x2db): undefined reference to `N_VNew_Serial'
mex_cvode.c:(.text+0x35b): undefined reference to `CVodeCreate'
mex_cvode.c:(.text+0x39c): undefined reference to `CVodeInit'
mex_cvode.c:(.text+0x3dd): undefined reference to `CVodeSVtolerances'
mex_cvode.c:(.text+0x412): undefined reference to `CVodeSetUserData'
mex_cvode.c:(.text+0x449): undefined reference to `CVDense'
mex_cvode.c:(.text+0x482): undefined reference to `CVDlsSetDenseJacFn'
mex_cvode.c:(.text+0x50c): undefined reference to `CVode'
mex_cvode.c:(.text+0x5b4): undefined reference to `N_VDestroy_Serial'
mex_cvode.c:(.text+0x5c0): undefined reference to `N_VDestroy_Serial'
mex_cvode.c:(.text+0x5cc): undefined reference to `CVodeFree'
collect2: ld returned 1 exit status
mex: link of ' "mex_cvode.mexa64"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Somehow, I'm not giving the correct flags to link appropriately. As I get the same set of errors (plus a few more) if I remove the commands to link in the gcc44 command, I'm pretty sure that I'm not getting the compiler to "see" the libraries.
My questions are :
If my analysis of the error is correct, what flags do I need to pass to the mex compilation command to successfully link?
Alternatively, what are the gcc flags to compile and link outside of the Matlab environment to compile a .mex64 executable?
If my analysis is wrong, where to go from here?
I think I've ruled out the unsupported compiler warning since I've been able to compile simple mex with OpenMP programs using gcc 4.4, but these did not have to link against anything except the math library. Also, if I compile with version gcc version 4.1.2 or 4.3.4 with or without the "-fopenmp" flags I get the same error.
In the end I do need version 4.4 because of certain OpenMP support that did not appear in prior versions.
Thanks in advance for the help.
--Andrew
Edits: (#KWATFORD)
So I tried the command with the statements outside the the quotes, and got the error:
-> gcc44 -c -I/home/matteson/sundials/include/ -I/misc/linux/64/opt/pkg/matlab/R2010b/extern/include -I/misc/linux/64/opt/pkg/matlab/R2010b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -fopenmp -DMX_COMPAT_32 -O -DNDEBUG "mex_cvode.c"
-> gcc44 -O -pthread -shared -Wl,--version-script,/misc/linux/64/opt/pkg/matlab/R2010b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -fopenmp -o "mex_cvode.mexa64" mex_cvode.o -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial -Wl,-rpath-link,/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -L/misc/linux/64/opt/pkg/matlab/R2010b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
/usr/bin/ld: /home/matteson/sundials/lib/libsundials_cvode.a(cvode.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/matteson/sundials/lib/libsundials_cvode.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
mex: link of ' "mex_cvode.mexa64"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
I'm a bit confused about the suggestion to recompile with "-fPIC" because when I look at the gcc44 command I see the -fPIC as an option.
Are they saying to recompile the library with -fPIC?
I don't have the source for the library, if the suggestion is to recompile the library is there a workaround?
What does "relocation against local object" mean?
My continued thanks.
Try not putting the -l, -L, or -I arguments in those environment variables. The mex function will handle those types of arguments directly. So perhaps something like:
mex -v CC="gcc44" CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial mex_cvode.c
Kwatford put me on the right track with the second question. I was able to get the mex command to work by rebuilding the sundials solver with shared libraries. Specifically, I built with:
% make distclean
% ./configure --prefix=/home/matteson/sundials --enable-shared
% make
% make install
Also, thanks to kwatford for the fix to the original by calling:
mex -v CC="gcc44" CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial mex_cvode.c
since mex knows how to handle the -L and -I.
Matlab uses its own libstdc and libstdc++.
The shortcut would be to do a symbolink to those libraries to the gcc44 libraries that you want to use.
But this may not be the desired way to go. You could try compiling outside matlab prompt and see if it still fails compilation first.

Error: Cannot parse function definition from ' hello()' in Mytest.xs, line 9

I am trying to use perl XS in RHEL 5.
but simple programm is giving error.I followed same code as in Example 1 in perldoc perlxstut
Can anyone help me in correcting the following error?
[root#localhost Mytest]#
[root#localhost Mytest]# pwd
/home/nikole/perlcode/Mytest
[root#localhost Mytest]# ls
blib lib MANIFEST Mytest.xs pm_to_blib README
Changes Makefile.PL Mytest.c Mytest.xsc ppport.h t
[root#localhost Mytest]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Mytest
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]# make
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap Mytest.xs > Mytest.xsc && mv Mytest.xsc Mytest.c
Error: Cannot parse function definition from ' hello()' in Mytest.xs, line 9
Please specify prototyping behavior for Mytest.xs (see perlxs manual)
make: *** [Mytest.c] Error 1
[root#localhost Mytest]#
Thanks Ryan. I removed white spaces between void and hello, and it solved the problem. After editing, my Mytest.xs looks like
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
MODULE = Mytest PACKAGE = Mytest
void
hello()
CODE:
printf("Hello, world!\n");
Update
Hi Ryan & cjm,
I resolved error in doing make as above but my perl programm is giving error now
" use: command not found"
Any ideas?
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Mytest
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]# make
gcc -c -I. -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE" Mytest.c
Running Mkbootstrap for Mytest ()
chmod 644 Mytest.bs
rm -f blib/arch/auto/Mytest/Mytest.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib Mytest.o -o blib/arch/auto/Mytest/Mytest.so \
\
chmod 755 blib/arch/auto/Mytest/Mytest.so
cp Mytest.bs blib/arch/auto/Mytest/Mytest.bs
chmod 644 blib/arch/auto/Mytest/Mytest.bs
Manifying blib/man3/Mytest.3pm
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]# cat hello
#! /usr/bin/perl -w
use ExtUtils::testlib;
use Mytest;
Mytest::hello();
[root#localhost Mytest]#
[root#localhost Mytest]# cat hello
#! /usr/bin/perl -w
use ExtUtils::testlib;
use Mytest;
Mytest::hello();
[root#localhost Mytest]#
[root#localhost Mytest]# ls -l hello
-rwxrwxrwx 1 root root 87 Apr 8 04:01 hello
[root#localhost Mytest]#
[root#localhost Mytest]#
[root#localhost Mytest]# ./hello
./hello: line 2: use: command not found
./hello: line 3: use: command not found
./hello: line 4: syntax error near unexpected token `;'
./hello: line 4: ` Mytest::hello();'
[root#localhost Mytest]#
Update
thanks Ryan,
removed white spaces between void and hello
it solved problem
After editing , my Mytest.xs looks like
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
MODULE = Mytest PACKAGE = Mytest
void
hello()
CODE:
printf("Hello, world!\n");
In your Mytest.xs remove the whitespace in front of hello();
Update:
Your new problem, "command not found..." doesn't sound like Perl is running your program. I think it may be from whitespace before "#!/usr/bin/perl" in hello.