Re: [netcdfgroup] PDL-NetCDF

Hi Tyler: It looks to me as if the -fPIC flag needs to be specified when compiling the netcdf library. This has to be done before installing PDL-NetCDF.

We have CentOS5x x86_64 machines here. Our recipe for compiling netcdf and PDL-NetCDF is in the attached file.

Regards,

  Doug

dhunt@xxxxxxxx
Software Engineer IV
UCAR - COSMIC, Tel. (303) 497-2611

On Mon, 23 Mar 2009, Tyler Cruickshank wrote:

Hi Doug.

I've run into a problem installing PDL-NetCDF on my CentOS5x x86_64 machine.  I can create a 
makefile ok, but make is producing the error pasted below.  Following the advice in 
PROBLEMS, I edited my Makefile.PL to reflect 'CCFLAGS'      => "-Dbool=int 
-g3".  I see that the error messages wants me to recompile using -fPIC, but I am not 
quite sure what to do with that.  Can you direct me?

Thanks.

-tyler

------------------------------------------------------------------------------
[root@avalanche PDL-NetCDF-0.94]# make

/usr/bin/perl -I/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi 
"-MPDL::PP qw/PDL::NetCDF PDL::NetCDF NetCDF/" netcdf.pd
cp NetCDF.pm blib/lib/PDL/NetCDF.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp  -typemap 
/usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap 
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/PDL/Core/typemap.pdl -typemap 
typemap  NetCDF.xs > NetCDF.xsc && mv NetCDF.xsc NetCDF.c
gcc -c  -I/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/PDL/Core -I/usr/local/include -Dbool=int 
-g3 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 
-mtune=generic   -DVERSION=\"0.94\" -DXS_VERSION=\"0.94\" -fPIC 
"-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE"   NetCDF.c
In file included from 
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:2120,
                from NetCDF.xs:6:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/handy.h:85:1: warning: 
"bool" redefined
<command line>:1:1: warning: this is the location of the previous definition
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_put_att_schar':
NetCDF.xs:634: warning: pointer targets in passing argument 6 of 
'nc_put_att_schar' differ in signedness
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_get_att_schar':
NetCDF.xs:652: warning: pointer targets in passing argument 4 of 
'nc_get_att_schar' differ in signedness
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_put_vara_schar':
NetCDF.xs:1144: warning: pointer targets in passing argument 5 of 
'nc_put_vara_schar' differ in signedness
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_get_vara_schar':
NetCDF.xs:1166: warning: pointer targets in passing argument 5 of 
'nc_get_vara_schar' differ in signedness
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_put_var_schar':
NetCDF.xs:1476: warning: pointer targets in passing argument 3 of 
'nc_put_var_schar' differ in signedness
NetCDF.xs: In function 'XS_PDL__NetCDF_nc_get_var_schar':
NetCDF.xs:1493: warning: pointer targets in passing argument 3 of 
'nc_get_var_schar' differ in signedness
Running Mkbootstrap for PDL::NetCDF ()
chmod 644 NetCDF.bs
rm -f blib/arch/auto/PDL/NetCDF/NetCDF.so
gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic NetCDF.o   -o 
blib/arch/auto/PDL/NetCDF/NetCDF.so     \
          -L/usr/local/lib -lnetcdf    \

/usr/bin/ld: /usr/local/lib/libnetcdf.a(attr.o): relocation R_X86_64_32 against 
`a local symbol' can not be used when making a shared object; recompile with 
-fPIC
/usr/local/lib/libnetcdf.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/PDL/NetCDF/NetCDF.so] Error 1

For netcdf-3.6.3 and PDL-NetCDF-0.93, installing netcdf into 
/ops/tools/[lib|include] using
the Portland group F90 compiler.

If you want to install to the normal netcdf location, do not specify:

-I/ops/tools/include
--prefix=/ops/tools

and export NETCDF_LIBDIR and NETCDF_INCDIR appropriately (should not be 
necessary
for a default netcdf install).

If you do not need FORTRAN, then you should not worry about FC, F90 or the 
-DpgiFortran flag.


tar -xzf netcdf-3.6.3.tar.gz
cd netcdf-3.6.3
export FC=pgf90 # we use portland group FORTRAN 90
export F90=pgf90
export CC=gcc
export CFLAGS='-fPIC'
export CPPFLAGS='-DNDEBUG -DpgiFortran -fPIC'
export CXX='g++'
export FFLAGS='-I/usr/include -I/ops/tools/include'
./configure --prefix=/ops/tools
make
make install
cp f90/netcdf.mod    /ops/tools/include
cp f90/typesizes.mod /ops/tools/include

tar -xzf PDL-NetCDF-0.93.tar.gz
cd PDL-NetCDF-0.93
export NETCDF_LIBDIR='/ops/tools/lib'
export NETCDF_INCDIR='/ops/tools/include'
perl Makefile.PL
make
make test
make install
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: