Re: relocation against dynamic symbol

From: Steve Fletcher <Steve.Fletcher_at_nyahnyahspammersnyahnyah>
Date: Wed, 08 Apr 2009 14:10:40 -0500

I went through and recompiled all the other tools with the flags
exported -fPIC as suggested
then PyNIO was happy with it all. Thank you for your help!
Steve

Mary Haley wrote:
> Steve,
>
> As you mentioned below, the problem seems to be when you mix PIC code
> with non-PIC code. That is, if you compile some code with -fPIC and
> some without.
>
> Usually -fPIC is the default, so I'm surprised that you are running
> into this issue. I think we have to assume this is still the issue
> and just make sure that all your code gets built with -fPIC.
>
> My recommendation is to compile everything with -fPIC (if you haven't
> already), and then make sure that NCL and PyNIO get built with -fPIC
> as well.
>
> Before building NetCDF, HDF4, HDF5, etc, I set the following
> environment variables:
>
> export CC=gcc
> export CXX=g++
> export FC=gfortran
> export F77=gfortran
> export CFLAGS=-fPIC
> export FFLAGS=-fPIC
> export F90FLAGS=-fPIC
> export CXXFLAGS=-fPIC
>
> When building NCL, you can get the -fPIC option by editing
> $NCARG/config/LINUX and making sure you have "-fPIC" on the CcOptions
> and FcOptions lines. You will need to rerun "make Everything" to make
> sure this takes effect.
>
> I believe PyNIO should get the -fPIC option by virture of FFLAGS being
> set.
>
> Keep me posted.
>
> --Mary
>
>
>
>
> On Tue, 7 Apr 2009, Steve Fletcher wrote:
>
>
>> OK. After Cleaning out the PyNIO directory and untarring and logging out and
>> back in.
>>
>> I set ENV variables:
>> export HAS_NETCDF4=1
>> export NETCDF4_PREFIX=/usr/local/netcdf-4.0_gcc
>> export HDF_PREFIX=/usr/local/hdf4
>> export NCARG_ROOT=/usr/local/ncarg5.0
>> and tried again. The hdf5 libraries did show up, but so did
>> the same error messages.
>>
>> gcc -pthread -shared build/temp.linux-ia64-2.5/niomodule.o
>> -L/usr/local/ncarg5.0/lib -L/usr/local/hdf4/lib
>> -L/usr/local/netcdf-4.0_gcc/lib -lnio -lmfhdf -ldf -ljpeg -lpng -lz -lnetcdf
>> -lhdf5_hl -lhdf5 -lsz -o build/lib.linux-ia64-2.5/PyNIO/nio.so
>> /usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/bin/ld:
>> /usr/local/hdf4/lib/libdf.a(herr.o): @gprel relocation against dynamic symbol
>> error_top
>> /usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/bin/ld:
>> /usr/local/hdf4/lib/libdf.a(herr.o): @gprel relocation against dynamic symbol
>> error_top
>> /usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/bin/ld:
>> /usr/local/hdf4/lib/libdf.a(herr.o): @gprel relocation against dynamic symbol
>> error_top
>>
>>
>> Mary Haley wrote:
>>
>>> Steve,
>>>
>>> One thing that I noticed is that you enabled NetCDF-4 support when you
>>> built NetCDF. This means that when you compile PyNIO, the HDF5
>>> libraries must get included on the final load line. I didn't see the
>>> libraries listed on your compile line:
>>>
>>> gcc -pthread -shared build/temp.linux-ia64-2.5/niomodule.o
>>> -L/usr/local/ncarg5.0/lib -L/usr/local/hdf4/lib -lnio -lmfhdf -ldf
>>> -ljpeg -lpng -lz -lnetcdf -o build/lib.linux-ia64-2.5/PyNIO/nio.so
>>> /usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/bin/ld:
>>> /usr/local/hdf4/lib/libdf.a(herr.o): @gprel relocation against dynamic
>>>
>>>
>>> The libraries you should see are "-lhdf5_hl -lhdf5 -lsz". These only
>>> get loaded if the HAS_NETCDF4 environment variable is set to something
>>> greater than 0.
>>>
>>> So, we need to find out why setting HAS_NETCDF4 to 1 is not working in
>>> your case. I assume you are building version 1.3.0b1?
>>>
>>> --Mary
>>>
>>>
>>> On Mon, 6 Apr 2009, David Brown wrote:
>>>
>>>
>>>> OK, we will have to look into this further. Thanks for the report. We make
>>>> have some more questions shortly.
>>>> -dave
>>>>
>>>> On Apr 6, 2009, at 3:21 PM, Steve Fletcher wrote:
>>>>
>>>>
>>>>> OK. I had it both ways for the HAS_NETCDF4 since I typed it in wrong the
>>>>> first time.
>>>>> I copied the HDF5 libraries and includes into the netcdf4 directory, but
>>>>> it dies in exactly
>>>>> the same place with the same error.
>>>>> Steve
>>>>>
>>>>> David Brown wrote:
>>>>>
>>>>>> Hi Steve,
>>>>>>
>>>>>> We have noticed a couple of issues that might be affecting your build:
>>>>>> 1) The environment variable for NetCDF4 should be HAS_NETCDF4 rather
>>>>>> than HAVE_NETCDF4.
>>>>>> 2) The current build process expects that the HDF5 libraries live in the
>>>>>> same location that the NetCDF4 library is installed.
>>>>>> You could either move your HDF5 libraries or create appropriate
>>>>>> symbolic links.
>>>>>> Hopefully this will get you further along. Let us know if you have
>>>>>> further problems.
>>>>>> -dave
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Apr 6, 2009, at 2:35 PM, Steve Fletcher wrote:
>>>>>>
>>>>>>
>>>>>>> I'm trying to build PyNIO and running into problems. These are the
>>>>>>> messages I got.
>>>>>>> gcc -pthread -shared build/temp.linux-ia64-2.5/niomodule.o
>>>>>>> -L/usr/local/ncarg5.0/lib -L/usr/local/hdf4/lib -lnio -lmfhdf -ldf
>>>>>>> -ljpeg -lpng -lz -lnetcdf -o build/lib.linux-ia64-2.5/PyNIO/nio.so
>>>>>>> /usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/bin/ld:
>>>>>>> /usr/local/hdf4/lib/libdf.a(herr.o): @gprel relocation against dynamic
>>>>>>> symbol error_top
>>>>>>>
>>>>>>> Most of the google pages I saw suggested some version of CFLAGS=-fpic
>>>>>>> or
>>>>>>> -fPIC. Tried both without success.
>>>>>>>
>>>>>>> I was able to compile the older version of ncl_ncarg for the libnio.a,
>>>>>>> but haven't yet found a way around the shared library problem. Any
>>>>>>> suggestions
>>>>>>> would be appreciated.
>>>>>>>
>>>>>>> Below is how the other tools were built.
>>>>>>> ARCH:
>>>>>>> IA64
>>>>>>>
>>>>>>> OS:
>>>>>>> SUSE Linux Enterprise Server 10 (ia64)
>>>>>>> VERSION = 10
>>>>>>> PATCHLEVEL = 2
>>>>>>>
>>>>>>> relevant ENV:
>>>>>>> NCARG_ROOT=/usr/local/ncarg5.0
>>>>>>> HAVE_NETCDF4=1
>>>>>>> NETCDF4_PREFIX=/usr/local/netcdf-4.0_gcc
>>>>>>> HDF_PREFIX=/usr/local/hdf4
>>>>>>>
>>>>>>> HDF4 build:
>>>>>>> It was created by HDF configure 4.2r4, which was
>>>>>>> generated by GNU Autoconf 2.61. Invocation command line was
>>>>>>>
>>>>>>> $ ./configure --prefix=/usr/local/hdf4 --enable-fortran --enable-cxx
>>>>>>> --include
>>>>>>> dir=/usr/local/hdf4/include/hdf --disable-netcdf CC=gcc CXX=g++
>>>>>>> FC=gfortran
>>>>>>> F77=gfortran F90=gfortran
>>>>>>>
>>>>>>>
>>>>>>> Netcdf4 build:
>>>>>>> It was created by netCDF configure 4.0, which was
>>>>>>> generated by GNU Autoconf 2.62. Invocation command line was
>>>>>>>
>>>>>>> $ ./configure --prefix=/usr/local/netcdf-4.0_gcc
>>>>>>> --with-hdf5=/usr/local/hdf5-g
>>>>>>> cc --with-szlib=/usr/local/szip --enable-netcdf-4 CC=gcc CXX=g++
>>>>>>> FC=gfortran F90
>>>>>>> =gfortran F77=gfortran
>>>>>>>
>>>>>>> Make Output from ncl_ncarg-5.0.0:
>>>>>>> f77 Compiler gfortran
>>>>>>> f77 Flags -fPIC -fno-second-underscore -fno-range-check -O
>>>>>>> C Compiler gcc
>>>>>>> cc Flags -ansi -fPIC -O -I./include -I/usr/X11R6/include
>>>>>>> -I/usr/l
>>>>>>> ocal/hdf4/include -I/usr/local/netcdf-4.0_gcc/include
>>>>>>> -I/usr/local/hdf5-gcc/incl
>>>>>>> ude -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
>>>>>>> -DNeedFuncProto
>>>>>>> _______________________________________________
>>>>>>> pyngl-talk mailing list
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>>>>>
>>>>
>>
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
Received on Wed Apr 08 2009 - 13:10:40 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 24 2009 - 15:35:01 MDT