Compile problems with HDF5 1.8.1 and gcc's -D_FORTIFY_SOURCE=2

Hello all,

On Mac OS X 10.5.4 using gcc 4.2.1 (from Xcode 3.1), I have tried to
build HDF5 1.8.1 like so:

export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk
export CFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch i386"
export CXXFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch i386"
./configure --disable-shared --prefix=/my/path/to/folder
make check

It gives the errors below. If I remove the -D_FORTIFY_SOURCE=2 then all
is well.

Is this a known problem? Can anyone repro?

D_FORTIFY_SOURCE is nicely explained here:
<http://www.redhat.com/magazine/009jul05/features/execshield/#checks>

Errors:

H5detect.c: In function 'detect_C99_floats':
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'memset'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'malloc'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'memcpy'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'fprintf'
./H5detect.c:1380: error: 'stderr' undeclared (first use in this
function)
/usr/bin/gcc-4.2 -isysroot /Developer/SDKs/MacOSX10.5.sdk -O0 -fstack-
protector -D_FORTIFY_SOURCE=2 -arch i386 -ansi -O -fomit-frame-pointer
-finline-functions -I. -I. -UH5_DEBUG_API -DNDEBUG -c H5.c -o H5.o
H5Fprivate.h:475: error: expected declaration specifiers or '...'
before 'FILE'

Thanks,

···

--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Sean,

Hello all,

On Mac OS X 10.5.4 using gcc 4.2.1 (from Xcode 3.1), I have tried to
build HDF5 1.8.1 like so:

export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk
export CFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch i386"
export CXXFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch i386"
./configure --disable-shared --prefix=/my/path/to/folder
make check

It gives the errors below. If I remove the -D_FORTIFY_SOURCE=2 then all
is well.

Is this a known problem? Can anyone repro?

  I've not tried to reproduce this, but the sole purpose of the H5detect file is to produce the H5Tinit.c source file. If you took a copy of H5Tinit.c from a build without the "-D_FORTIFY_SOURCE=2" flag and put it into the src directory where you are building with the "-D_FORTIFY_SOURCE=2" flag, things should be fine.

  Quincey

···

On Jul 15, 2008, at 5:31 PM, Sean McBride wrote:

D_FORTIFY_SOURCE is nicely explained here:
<http://www.redhat.com/magazine/009jul05/features/execshield/#checks>

Errors:

H5detect.c: In function 'detect_C99_floats':
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'memset'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'malloc'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'memcpy'
./H5detect.c:1380: warning: incompatible implicit declaration of built-
in function 'fprintf'
./H5detect.c:1380: error: 'stderr' undeclared (first use in this
function)
/usr/bin/gcc-4.2 -isysroot /Developer/SDKs/MacOSX10.5.sdk -O0 -fstack-
protector -D_FORTIFY_SOURCE=2 -arch i386 -ansi -O -fomit-frame-pointer
-finline-functions -I. -I. -UH5_DEBUG_API -DNDEBUG -c H5.c -o H5.o
H5Fprivate.h:475: error: expected declaration specifiers or '...'
before 'FILE'

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

That may work, but what I should have mentioned was that the errors I
pasted were just the first ones, there were many more.

If you get a chance, give -D_FORTIFY_SOURCE=2 a try, it's a great & easy
way to catch bugs.

···

On 7/15/08 5:40 PM, Quincey Koziol said:

On Mac OS X 10.5.4 using gcc 4.2.1 (from Xcode 3.1), I have tried to
build HDF5 1.8.1 like so:

export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk
export CFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch
i386"
export CXXFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch
i386"
./configure --disable-shared --prefix=/my/path/to/folder
make check

It gives the errors below. If I remove the -D_FORTIFY_SOURCE=2 then
all
is well.

Is this a known problem? Can anyone repro?

I've not tried to reproduce this, but the sole purpose of the
H5detect file is to produce the H5Tinit.c source file. If you took a
copy of H5Tinit.c from a build without the "-D_FORTIFY_SOURCE=2" flag
and put it into the src directory where you are building with the "-
D_FORTIFY_SOURCE=2" flag, things should be fine.

--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Sean,

On Mac OS X 10.5.4 using gcc 4.2.1 (from Xcode 3.1), I have tried to
build HDF5 1.8.1 like so:

export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk
export CFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch
i386"
export CXXFLAGS="-isysroot ${SDKROOT} -O0 -D_FORTIFY_SOURCE=2 -arch
i386"
./configure --disable-shared --prefix=/my/path/to/folder
make check

It gives the errors below. If I remove the -D_FORTIFY_SOURCE=2 then
all
is well.

Is this a known problem? Can anyone repro?

  I've not tried to reproduce this, but the sole purpose of the
H5detect file is to produce the H5Tinit.c source file. If you took a
copy of H5Tinit.c from a build without the "-D_FORTIFY_SOURCE=2" flag
and put it into the src directory where you are building with the "-
D_FORTIFY_SOURCE=2" flag, things should be fine.

That may work, but what I should have mentioned was that the errors I
pasted were just the first ones, there were many more.

  Hmm, I just tried this on my MacbookPro, running OSX 10.5.4 and using the Xcode 3.1 release and these settings/commands worked for me:

export CC=/usr/bin/gcc-4.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export SDKROOT=/Developer/SDKs/MacOSX10.5.sdk
export CFLAGS="-D_FORTIFY_SOURCE=2"
../hdf5/configure --disable-shared
make && make check

  You might also want to add "--disable-production --enable-debug" to the configure line, along with possibly "--enable-using-memchecker".

  Quincey

···

On Jul 16, 2008, at 2:32 PM, Sean McBride wrote:

On 7/15/08 5:40 PM, Quincey Koziol said:

If you get a chance, give -D_FORTIFY_SOURCE=2 a try, it's a great & easy
way to catch bugs.

--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.