Notes on creating a debug build of R/HDF5

In general, the goal of creating a debug build is to enable debug flag (-g) and remove all optimization flags such as: -O, -O2, -O3, -s, -fomit-frame-pointer, -fstack-check, etc.

If you ever run into situations where you need to build a debug build of R/HDF5, here are my notes for Solaris. For Linux or other operating systems, use appropriate platform specific configuration files in SZIP and NCSA HDF5 build trees.

1. Remove -O -s options in [SZIP_SRC]/config/solaris2.x file.
2. Remove -O2 option in [SZIP_SRC]/configure file.
3. Remove -O -s options in [NCSA_HDF5_SRC]/config/solaris2.x file.
4. Remove -O2 option in [NCSA_HDF5_SRC]/configure file.
5. Remove -O2 option in [R_SRC]/configure file.
6. Remove -O, -O2, -O3, or -s option from your environment variables, specifically CC, CXX, F77, CFLAGS,CXXFLAGS, FFLAGS, etc.
7. Add -g to CC, CXX, and F77 so they looks like this:

CC="/opt/SUNWpro/bin/cc -g"

You can certainly add it to CFLAGS instead. Just don’t include it in both.
8. Add -D H5_USING_PURIFY to CFLAGS env variable.
9. When running configure script for NCSA HDF5, add --enable-debug=all option.

If you have any better way to do this, let me know. Special thanks to Greg N. for informing me about all the optimization flags, and Barbara J. for H5_USING_PURIFY flag.

Advertisements

One thought on “Notes on creating a debug build of R/HDF5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s