Static linking of HDF5 not supported?

3,917 views
Skip to first unread message

Jeremy Cowles

unread,
Jun 13, 2011, 1:57:14 PM6/13/11
to alembic-d...@googlegroups.com
Hi,

When compiling against the static release of hdf5 (which the
bootstrapper seems to recommend), I get the following error when trying
to build Alembic:

/.../lib/hdf5-1.8.7-linux-x86_64-static/lib/libhdf5.a(H5Z.o): In
function `H5Z_init_interface':
H5Z.c:(.text+0x257): undefined reference to `SZ_encoder_enabled'

I think this is because it cant find hdf5/lib/libsz.a. If I manually
compile and point it at libsz.a, it works fine.

Building against the shared HDF5 release works as expected without any
intervention, but I figured I would post this in case anyone else has
the same problem.


--
Jeremy

Joe Ardent

unread,
Jun 13, 2011, 7:44:14 PM6/13/11
to alembic-d...@googlegroups.com
Jeremy Cowles wrote:
> Hi,
>
> When compiling against the static release of hdf5 (which the
> bootstrapper seems to recommend), I get the following error when trying
> to build Alembic:
>
> /.../lib/hdf5-1.8.7-linux-x86_64-static/lib/libhdf5.a(H5Z.o): In
> function `H5Z_init_interface':
> H5Z.c:(.text+0x257): undefined reference to `SZ_encoder_enabled'
>
> I think this is because it cant find hdf5/lib/libsz.a. If I manually
> compile and point it at libsz.a, it works fine.
>

Hey Jeremy, I'm 99% certain that's because you're building hdf5 in a
way we don't recommend. We count on szip being disabled by default, and
zlib being enabled by default, so here's how we configure our HDF5 build:

setenv LDFLAGS "-fPIC" ; \
setenv CFLAGS "-m64 -fPIC" ; \
./configure \
--prefix=/usr/local/hdf5-1.8.7/ \
--with-pic \
--disable-shared \
--enable-production \
--disable-debug \
--enable-threadsafe --with-pthread=/usr/include,/usr/lib


-Joe

Jeremy Cowles

unread,
Jun 13, 2011, 8:08:14 PM6/13/11
to alembic-d...@googlegroups.com
Ah, I actually used the official HDF5 binary release from here:

http://www.hdfgroup.org/HDF5/release/obtain5.html

Seems like a good thing to add to the build notes in README.txt.

--
Jeremy

Rob Pieke

unread,
Jun 14, 2011, 2:06:46 AM6/14/11
to alembic-d...@googlegroups.com
FWIW, we're using HDF5 with szip support (for not particularly good reason) in addition to zlib support here too. Everything seems to work just fine. It's just, like you said, sometimes szip has to be explicitly pulled in during linking.

________________________________________
From: Jeremy Cowles [jco...@pixar.com]
Sent: 14 June 2011 01:08
To: alembic-d...@googlegroups.com
Subject: Re: [alembic-discussion] Static linking of HDF5 not supported?

http://www.hdfgroup.org/HDF5/release/obtain5.html

--
Jeremy

--
You received this message because you are subscribed to the Google
Groups "alembic-discussion" group.
To post to this group, send email to alembic-d...@googlegroups.com
To unsubscribe from this group, send email to
alembic-discuss...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/alembic-discussion?hl=en

For RSS or Atom feeds related to Alembic, see:

http://groups.google.com/group/alembic-dev/feeds

http://groups.google.com/group/alembic-discussion/feeds

Joe Ardent

unread,
Jun 14, 2011, 12:36:22 PM6/14/11
to alembic-d...@googlegroups.com
Jeremy Cowles wrote:
> Ah, I actually used the official HDF5 binary release from here:
>
> http://www.hdfgroup.org/HDF5/release/obtain5.html
>
> Seems like a good thing to add to the build notes in README.txt.
>

It's already there :)

"""
They may be installed in their default system locations (typically somewhere
under /usr/local), or some other centralized directory at
your discretion; it's best to not install your dependencies under the
Alembic
source root. Look in your Alembic source root's "doc" directory for
instructions on building Boost and HDF5; see next step for details.

1) Untar the Alembic source into your desired directory:

$ cd ~/ ; tar xzf Alembic_0_9_3_-xxxxxxxx.tgz

This will create a directory, ~/Alembic_0.9.3, that contains the Alembic
source code (if you're reading this, you've probably already done this).

As alluded to in Step 0, ~/Alembic_0.9.3/doc/ will contain instructional
files for building Boost and HDF5. Mostly, those packages' libraries just
need a little encouragement to build static archives and with -fPIC.
"""

Then in the doc directory, there are Boost-howtobuild.txt and
HDF5-howtobuild.txt, which contain the configure line as well as a plain
English description of what we're trying to do with it.

But, as Rob Pieke points out, if you use the standard binary distro,
all it means is you need to link in libsz too.

Anyway, thank you for looking into this!


-Joe

Jeremy Cowles

unread,
Jun 14, 2011, 2:52:49 PM6/14/11
to alembic-d...@googlegroups.com
Awesome! And I get the RTFM award :)

--
Jeremy

Reply all
Reply to author
Forward
0 new messages