Re: [netcdfgroup] Problems compiling netcdf

Have you tried using the suggested -fPIC? I think it is enough to set also 
CFLAGS=-fPIC among the whole lot of options you already use in netcdf's 
./configure line.


From: Svancara, Randall 
Sent: Sunday, July 24, 2011 8:31 PM
To: netcdfgroup@xxxxxxxxxxxxxxxx 
Subject: [netcdfgroup] Problems compiling netcdf


Hi, 


I am experiencing difficulty compiling netcdf.  Here is how I have compiled the 
software:


1. Compile zlib 1.2.5


 1184  CC=gcc ./configure --prefix=/home/software/zlib-1.2.5_gcc
 1185  make
 1186  make install


2. Compile szip 2.1
 1200  ./configure --prefix=/home/software/szip-2.1_gcc
 1201  make
 1203  make install


3. Compile HD5 


 1224  CC=/home/software/mpi/gcc/openmpi-1.4.3/bin/mpicc  ./configure 
--prefix=/home/software/hd5-1.8.7_gcc_openmpi --enable-parallel 
--enable-production --with-szlib=/home/software/szip-2.1_gcc/lib 
--with-zlib=/home/software/zlib-1.2.5_gcc --disable-shared
 1225  make
 1226  make install


3. Compile NetCDF


 fc=mpif90 cxx=mpicxx CC=mpicc 
CPPFLAGS="-I/home/software/hd5-1.8.7_gcc_openmpi/include 
-I/home/software/szip-2.1_gcc/include -I/home/software/zlib-1.2.5_gcc/include" 
LDFLAGS="-L/home/software/hd5-1.8.7_gcc_openmpi/lib 
-L/home/software/szip-2.1_gcc -L/home/software/zlib-1.2.5_gcc" ./configure  
--prefix=/home/software/netcdf-4.1.3
make


I receive the following error during the build:


Making all in liblib
make[2]: Entering directory 
`/home/admins/rsvancara/SOFTWARE/NetCDF/netcdf-4.1.3/liblib'
/bin/sh ../libtool  --tag=CC   --mode=compile mpicc -DHAVE_CONFIG_H -I. -I.. 
-I../fortran  -I../include    -I../libsrc4  
-I/home/software/hd5-1.8.7_gcc_openmpi/include 
-I/home/software/szip-2.1_gcc/include -I/home/software/zlib-1.2.5_gcc/include  
-g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c -o 
libnetcdf_la-stub.lo `test -f 'stub.c' || echo './'`stub.c
libtool: compile:  mpicc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I../include 
-I../libsrc4 -I/home/software/hd5-1.8.7_gcc_openmpi/include 
-I/home/software/szip-2.1_gcc/include -I/home/software/zlib-1.2.5_gcc/include 
-g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c 
stub.c  -fPIC -DPIC -o .libs/libnetcdf_la-stub.o
libtool: compile:  mpicc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I../include 
-I../libsrc4 -I/home/software/hd5-1.8.7_gcc_openmpi/include 
-I/home/software/szip-2.1_gcc/include -I/home/software/zlib-1.2.5_gcc/include 
-g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c 
stub.c -o libnetcdf_la-stub.o >/dev/null 2>&1
mv -f .deps/libnetcdf_la-stub.Tpo .deps/libnetcdf_la-stub.Plo
/bin/sh ../libtool --tag=CC   --mode=link mpicc  -g -O2 -version-number 7:1:1  
-L/home/software/hd5-1.8.7_gcc_openmpi/lib -L/home/software/szip-2.1_gcc 
-L/home/software/zlib-1.2.5_gcc -o libnetcdf.la -rpath 
/home/software/netcdf-4.1.3/lib libnetcdf_la-stub.lo 
../libdispatch/libnetcdf2.la ../libdispatch/libdispatch.la 
../libsrc/libnetcdf3.la  ../libsrc4/libnetcdf4.la  -lhdf5_hl -lhdf5 -lm -lz
libtool: link: mpicc -shared  -fPIC -DPIC  .libs/libnetcdf_la-stub.o  
-Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a 
../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a 
../libsrc4/.libs/libnetcdf4.a -Wl,--no-whole-archive  
-L/home/software/hd5-1.8.7_gcc_openmpi/lib -L/home/software/szip-2.1_gcc 
-L/home/software/zlib-1.2.5_gcc -L/home/software/zlib-1.2.5_gcc/lib 
/home/software/hd5-1.8.7_gcc_openmpi/lib/libhdf5_hl.a 
/home/software/hd5-1.8.7_gcc_openmpi/lib/libhdf5.a -lm -lz  -O2   -Wl,-soname 
-Wl,libnetcdf.so.7 -o .libs/libnetcdf.so.7.1.1
/usr/bin/ld: /home/software/hd5-1.8.7_gcc_openmpi/lib/libhdf5_hl.a(H5DS.o): 
relocation R_X86_64_32 against `a local symbol' can not be used when making a 
shared object; recompile with -fPIC
/home/software/hd5-1.8.7_gcc_openmpi/lib/libhdf5_hl.a: could not read symbols: 
Bad value
collect2: ld returned 1 exit status
make[2]: *** [libnetcdf.la] Error 1
make[2]: Leaving directory 
`/home/admins/rsvancara/SOFTWARE/NetCDF/netcdf-4.1.3/liblib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/admins/rsvancara/SOFTWARE/NetCDF/netcdf-4.1.3'
make: *** [all] Error 2


Spefically:


/usr/bin/ld: /home/software/hd5-1.8.7_gcc_openmpi/lib/libhdf5_hl.a(H5DS.o): 
relocation R_X86_64_32 against `a local symbol' can not be used when making a 
shared object; recompile with -fPIC


I am not sure why I am receiving this error from HD5.  Anyone have a good build 
recipe for this software they care to share?


Thanks,

Randall








--------------------------------------------------------------------------------


_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/
  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: