Problem compiling HDF5: --disable-shared

Hi,

I want to compile HDF5 1.8.3 using gcc 4.3.3 and Intel Fortran Compiler
11.0 (x86_64) on an Ubuntu 9.04 x86_64.

If I don't use --disable-shared when doing ./configure, the build
process returns the following message:

/usr/bin/ld: /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/paulo/Modelos/rams60_aug2009/build/lib/libz.a: could not read
symbols: Bad value
collect2: ld returned 1 exit status
make[2]: ** [libhdf5.la] Erro 1
make[2]: Saindo do diretório
`/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
make[1]: ** [all] Erro 2
make[1]: Saindo do diretório
`/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
make: ** [all-recursive] Erro 1

and the compilation stops.

If I use the option --disable-shared, everything (make, make check, make
install, make check-install) seems Ok.

Then I compile the code which uses HDF5 and no errors occurs. However,
when I try to run my executable, I get the following message:

rams-6.0-opt: error while loading shared libraries: RTLD_NEXT used in
code not dynamically loaded

I suppose I should compile HDF5 without --disable-shared (or with
--enable-shared) but, once it don't work, I don't know what to do.

I'm locked at this stage for days. Could anyone give me some help,
please?

Cheers,
Paulo Santiago

I would suggest either rebuild your zlib with -fPIC or install the
libz package from Ubuntu instead of building your own?

==rob

···

On Wed, Sep 02, 2009 at 10:08:17AM -0300, Paulo Santiago wrote:

Hi,

I want to compile HDF5 1.8.3 using gcc 4.3.3 and Intel Fortran Compiler
11.0 (x86_64) on an Ubuntu 9.04 x86_64.

If I don't use --disable-shared when doing ./configure, the build
process returns the following message:

/usr/bin/ld: /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/paulo/Modelos/rams60_aug2009/build/lib/libz.a: could not read
symbols: Bad value

--
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA

Hi Barbara,

I saw I was doing some confusion on ZLIB compilations and directories.
Then I'm restarting from the very beginning. Now I'm using

./configure --shared --prefix=/home/paulo/Modelos/rams60_aug2009/build

to configure ZLIB and

./configure F77=ifort CFLAGS=-fPIC
--prefix=/home/paulo/Modelos/rams60_aug2009/build
--with-zlib=/home/paulo/Modelos/rams60_aug2009/build/include,/home/paulo/Modelos/rams60_aug2009/build/lib --enable-szlib=/home/paulo/Modelos/rams60_aud2009/build --enable-encoding --enable-cxx --with-gnu-ld --enable-shared

to configure HDF5 build. If it's important, I'm using the command

./configure F77=ifort CFLAGS=-fPIC
--prefix=/home/paulo/Modelos/rams60_aug2009/build --enable-encoding
--with-gnu-ld --enable-shared --enable-cxx

to configure SZLIB.

The difference is HDF5 compiled succesfully without --disable-shared.
Again, I compile my code without errors. However, when I try to run it I
get the same message:

rams-6.0-opt: error while loading shared libraries: RTLD_NEXT used in
code not dynamically loaded

Rob, I don't know how to build zlib with -fPIC and I found no
information about it on ZLIB website.

I apologize if I'm boring with this, but I'm far to be an specialist on
building linux apps.

···

--
Paulo Santiago

Em Qua, 2009-09-02 às 10:00 -0500, Barbara Jones escreveu:

Hello Paulo,

It looks like it either could be finding the wrong ZLIB library or it
can't find the library.

When you configure HDF5 are you specifying "--with-zlib=incdir,libdir"
(where incdir is the path to the ZLIB includes, and libdir is the
path to the ZLIB library)?

If yes, and you are sure your ZLIB library was built for Linux
Ubuntu 9.04 x86_64, then try adding the path to the (shared) ZLIB library
to the LD_LIBRARY_PATH environment variable, prior to building HDF5.

There could also be a 32-bit and 64-bit ZLIB library on your system,
or the wrong ZLIB library was installed. Make sure you are using the
right one, or build ZLIB from source.

You can obtain the ZLIB source code from the HDF5 web page, here:

   http://www.hdfgroup.org/ftp/lib-external/zlib/1.2/src/

The FAQ in the top directory of the ZLIB source has information
on building.

-Barbara Jones
help@hdfgroup.org

> Hi,
>
> I want to compile HDF5 1.8.3 using gcc 4.3.3 and Intel Fortran Compiler
> 11.0 (x86_64) on an Ubuntu 9.04 x86_64.
>
> If I don't use --disable-shared when doing ./configure, the build
> process returns the following message:
>
> /usr/bin/ld: /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a(compress.o):
> relocation R_X86_64_32 against `a local symbol' can not be used when
>making a shared object; recompile with -fPIC
> /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a: could not read
> symbols: Bad value
> collect2: ld returned 1 exit status
> make[2]: ** [libhdf5.la] Erro 1
> make[2]: Saindo do diretório
> `/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
> make[1]: ** [all] Erro 2
> make[1]: Saindo do diretório
> `/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
> make: ** [all-recursive] Erro 1
>
> and the compilation stops.
>
> If I use the option --disable-shared, everything (make, make check, make
> install, make check-install) seems Ok.
>
> Then I compile the code which uses HDF5 and no errors occurs. However,
> when I try to run my executable, I get the following message:
>
> rams-6.0-opt: error while loading shared libraries: RTLD_NEXT used in
> code not dynamically loaded
>
> I suppose I should compile HDF5 without --disable-shared (or with
> --enable-shared) but, once it don't work, I don't know what to do.
>
> I'm locked at this stage for days. Could anyone give me some help,
> please?
>
> Cheers,
> Paulo Santiago
>

--

Paulo,

You can get ZLIB source code form our Web site:

http://www.hdfgroup.org/ftp/lib-external/zlib/1.2/src/

It takes about thirty seconds to configure, build, test and install.

1. Unpack the file tar file
2. Change directory to the zlib source directory zlib-1.2.3
3. Set up CC environment variable to use -fPIC flag with gcc (depending on your shell.....setenv CC "gcc -fPIC")
4. ./configure --prefix=/....
5. make
6. make test
7 make install

Done :slight_smile:

···

On Sep 2, 2009, at 12:13 PM, Paulo Santiago wrote:

Hi Barbara,

I saw I was doing some confusion on ZLIB compilations and directories. Then I'm restarting from the very beginning. Now I'm using

./configure --shared --prefix=/home/paulo/Modelos/rams60_aug2009/build

to configure ZLIB and

./configure F77=ifort CFLAGS=-fPIC --prefix=/home/paulo/Modelos/rams60_aug2009/build --with-zlib=/home/paulo/Modelos/rams60_aug2009/build/include,/home/paulo/Modelos/rams60_aug2009/build/lib --enable-szlib=/home/paulo/Modelos/rams60_aud2009/build --enable-encoding --enable-cxx --with-gnu-ld --enable-shared

to configure HDF5 build. If it's important, I'm using the command

./configure F77=ifort CFLAGS=-fPIC --prefix=/home/paulo/Modelos/rams60_aug2009/build --enable-encoding --with-gnu-ld --enable-shared --enable-cxx

to configure SZLIB.

The difference is HDF5 compiled succesfully without --disable-shared. Again, I compile my code without errors. However, when I try to run it I get the same message:

rams-6.0-opt: error while loading shared libraries: RTLD_NEXT used in code not dynamically loaded

Rob, I don't know how to build zlib with -fPIC and I found no information about it on ZLIB website.

I apologize if I'm boring with this, but I'm far to be an specialist on building linux apps.

--
Paulo Santiago

Em Qua, 2009-09-02 às 10:00 -0500, Barbara Jones escreveu:

Hello Paulo,

It looks like it either could be finding the wrong ZLIB library or it
can't find the library.

When you configure HDF5 are you specifying "--with-zlib=incdir,libdir"
(where incdir is the path to the ZLIB includes, and libdir is the
path to the ZLIB library)?

If yes, and you are sure your ZLIB library was built for Linux
Ubuntu 9.04 x86_64, then try adding the path to the (shared) ZLIB library
to the LD_LIBRARY_PATH environment variable, prior to building HDF5.

There could also be a 32-bit and 64-bit ZLIB library on your system,
or the wrong ZLIB library was installed. Make sure you are using the
right one, or build ZLIB from source.

You can obtain the ZLIB source code from the HDF5 web page, here:

   http://www.hdfgroup.org/ftp/lib-external/zlib/1.2/src/

The FAQ in the top directory of the ZLIB source has information
on building.

-Barbara Jones
help@hdfgroup.org

> Hi,
>
> I want to compile HDF5 1.8.3 using gcc 4.3.3 and Intel Fortran Compiler
> 11.0 (x86_64) on an Ubuntu 9.04 x86_64.
>
> If I don't use --disable-shared when doing ./configure, the build
> process returns the following message:
>
> /usr/bin/ld: /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a(compress.o):
> relocation R_X86_64_32 against `a local symbol' can not be used when
>making a shared object; recompile with -fPIC
> /home/paulo/Modelos/rams60_aug2009/build/lib/libz.a: could not read
> symbols: Bad value
> collect2: ld returned 1 exit status
> make[2]: ** [libhdf5.la] Erro 1
> make[2]: Saindo do diretório
> `/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
> make[1]: ** [all] Erro 2
> make[1]: Saindo do diretório
> `/home/paulo/Modelos/rams60_aug2009/libs/hdf5-1.8.3/src'
> make: ** [all-recursive] Erro 1
>
> and the compilation stops.
>
> If I use the option --disable-shared, everything (make, make check, make
> install, make check-install) seems Ok.
>
> Then I compile the code which uses HDF5 and no errors occurs. However,
> when I try to run my executable, I get the following message:
>
> rams-6.0-opt: error while loading shared libraries: RTLD_NEXT used in
> code not dynamically loaded
>
> I suppose I should compile HDF5 without --disable-shared (or with
> --enable-shared) but, once it don't work, I don't know what to do.
>
> I'm locked at this stage for days. Could anyone give me some help,
> please?
>
> Cheers,
> Paulo Santiago
>

--

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org