HDF 4.2.7 build fix for compilers with a dash in the path (intel) (patch)

Dear HDF community,

When building HDF4 with icc 12.0.5 I experienced linker errors.

I was able to track them down to configure.ac: If the compiler path in
$CC contained a dash (-) and $CC contained no flags, the full compiler
path was added to the front of the CFLAGS. As a consequence, icc could
not link anymore.

The following patch should fix that (works for me):

- - --- configure.ac 2012-03-01 15:00:28.000000000 +0100
+++ configure.ac 2012-03-01 15:00:40.000000000 +0100
@@ -815,7 +815,7 @@
dnl Report anything stripped as a flag in CFLAGS and
dnl only the compiler in CC_VERSION.
CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
- - -CFLAGS_TO_ADD=`echo $CC | grep - | sed 's/.* -/-/'`
+CFLAGS_TO_ADD=`echo $CC | grep \ - | sed 's/.* -/-/'`
if test -n $CFLAGS_TO_ADD; then
   CFLAGS="$CFLAGS_TO_ADD$CFLAGS"
fi

I hope it proves useful!

Best wishes,
Arne Babenhauserheide

PS: Sorry for only jumping in here without introduction. I just
thought it better to send the patch to you instead of letting it rot
on my disk, and hdf-forum was the most fitting address I could find.

Arne,

Thank you for report and the patch!

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 2, 2012, at 5:10 AM, Arne Babenhauserheide (IMK) wrote:

Dear HDF community,

When building HDF4 with icc 12.0.5 I experienced linker errors.

I was able to track them down to configure.ac: If the compiler path in
$CC contained a dash (-) and $CC contained no flags, the full compiler
path was added to the front of the CFLAGS. As a consequence, icc could
not link anymore.

The following patch should fix that (works for me):

- - --- configure.ac 2012-03-01 15:00:28.000000000 +0100
+++ configure.ac 2012-03-01 15:00:40.000000000 +0100
@@ -815,7 +815,7 @@
dnl Report anything stripped as a flag in CFLAGS and
dnl only the compiler in CC_VERSION.
CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
- - -CFLAGS_TO_ADD=`echo $CC | grep - | sed 's/.* -/-/'`
+CFLAGS_TO_ADD=`echo $CC | grep \ - | sed 's/.* -/-/'`
if test -n $CFLAGS_TO_ADD; then
  CFLAGS="$CFLAGS_TO_ADD$CFLAGS"
fi

I hope it proves useful!

Best wishes,
Arne Babenhauserheide

PS: Sorry for only jumping in here without introduction. I just
thought it better to send the patch to you instead of letting it rot
on my disk, and hdf-forum was the most fitting address I could find.

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

Dear HDF community,

When building HDF4 with icc 12.0.5 I experienced linker errors.

I was able to track them down to configure.ac: If the compiler path in
$CC contained a dash (-) and $CC contained no flags, the full compiler
path was added to the front of the CFLAGS. As a consequence, icc could
not link anymore.

You are not the only one to encounter this problem, On MacOSX using
macports, the compilers have names like gcc-mp-4.6,and can produce
invalid $CFLAGS as you describe. A workaround is to provide
"wrapper" scripts. e.g. gccmp46 contains "exec gcc-mp-4.6 "$@""

The following patch should fix that (works for me):

- - --- configure.ac 2012-03-01 15:00:28.000000000 +0100
+++ configure.ac 2012-03-01 15:00:40.000000000 +0100
@@ -815,7 +815,7 @@
dnl Report anything stripped as a flag in CFLAGS and
dnl only the compiler in CC_VERSION.
CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
- - -CFLAGS_TO_ADD=`echo $CC | grep - | sed 's/.* -/-/'`
+CFLAGS_TO_ADD=`echo $CC | grep \ - | sed 's/.* -/-/'`
if test -n $CFLAGS_TO_ADD; then
   CFLAGS="$CFLAGS_TO_ADD$CFLAGS"
fi

I hope it proves useful!

I looked at hdf-4.2.6 and the same problem applies to F77 there, so
probably in hdf-4.2.7 as well.

Best wishes,
Arne Babenhauserheide

PS: Sorry for only jumping in here without introduction. I just
thought it better to send the patch to you instead of letting it rot
on my disk, and hdf-forum was the most fitting address I could find.

I have been meaning to look into this problem but since there is a
workaround it was low priority. Open source projects need efforts of
people like you who make the effort to understand problems and suggest
fixes. Thanks.

···

On 3/2/12, Arne Babenhauserheide (IMK) <arne.babenhauserheide@kit.edu> wrote:

--
George N. White III <aa056@chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia

Hello George, Hello Elena,

I was able to track them down to configure.ac: If the compiler
path in $CC contained a dash (-) and $CC contained no flags, the
full compiler path was added to the front of the CFLAGS. As a
consequence, icc could not link anymore.

You are not the only one to encounter this problem, On MacOSX
using macports, the compilers have names like gcc-mp-4.6,and can
produce invalid $CFLAGS as you describe. A workaround is to
provide "wrapper" scripts. e.g. gccmp46 contains "exec gcc-mp-4.6
"$@""

Good to know. I did not think of that way to get it to work :slight_smile:

I looked at hdf-4.2.6 and the same problem applies to F77 there,
so probably in hdf-4.2.7 as well.

F77 worked for me (ifort), but that could just be blind luck�

PS: Sorry for only jumping in here without introduction. I just
thought it better to send the patch to you instead of letting it
rot on my disk, and hdf-forum was the most fitting address I
could find.

I have been meaning to look into this problem but since there is a
workaround it was low priority. Open source projects need efforts
of people like you who make the effort to understand problems and
suggest fixes. Thanks.

Well, actually I started with rewriting the Makefiles. When I realized
that that would become a bit tedious, I remembered the autotools
lessons I learned to compile stuff for the Hurd :slight_smile:

I�m glad my patch helps!

Also this is one of the big advantages of free software: I spent over
2 months wading through various compiler problems on the cluster, so I
learned bit by bit how to trace down problems appearing on this
machine. I would not expect primary developers to actually do that
work (which includes finding the right compiler-flags for all the
different libraries and such - forgetting -fPIC really hurts :slight_smile: ).

Best wishes and thanks for the warm welcome!
Arne

···

Am 04.03.2012 22:48, schrieb George N. White III:

On 3/2/12, Arne Babenhauserheide (IMK) > <arne.babenhauserheide@kit.edu> wrote:

All,

We will be coming with a patch release to address the issue (should be before March 31, 2012). Stay tune.

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 5, 2012, at 8:47 AM, Arne Babenhauserheide (IMK) wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello George, Hello Elena,

Am 04.03.2012 22:48, schrieb George N. White III:

On 3/2/12, Arne Babenhauserheide (IMK) >> <arne.babenhauserheide@kit.edu> wrote:

I was able to track them down to configure.ac: If the compiler
path in $CC contained a dash (-) and $CC contained no flags, the
full compiler path was added to the front of the CFLAGS. As a
consequence, icc could not link anymore.

You are not the only one to encounter this problem, On MacOSX
using macports, the compilers have names like gcc-mp-4.6,and can
produce invalid $CFLAGS as you describe. A workaround is to
provide "wrapper" scripts. e.g. gccmp46 contains "exec gcc-mp-4.6
"$@""

Good to know. I did not think of that way to get it to work :slight_smile:

I looked at hdf-4.2.6 and the same problem applies to F77 there,
so probably in hdf-4.2.7 as well.

F77 worked for me (ifort), but that could just be blind luck…

PS: Sorry for only jumping in here without introduction. I just
thought it better to send the patch to you instead of letting it
rot on my disk, and hdf-forum was the most fitting address I
could find.

I have been meaning to look into this problem but since there is a
workaround it was low priority. Open source projects need efforts
of people like you who make the effort to understand problems and
suggest fixes. Thanks.

Well, actually I started with rewriting the Makefiles. When I realized
that that would become a bit tedious, I remembered the autotools
lessons I learned to compile stuff for the Hurd :slight_smile:

I’m glad my patch helps!

Also this is one of the big advantages of free software: I spent over
2 months wading through various compiler problems on the cluster, so I
learned bit by bit how to trace down problems appearing on this
machine. I would not expect primary developers to actually do that
work (which includes finding the right compiler-flags for all the
different libraries and such - forgetting -fPIC really hurts :slight_smile: ).

Best wishes and thanks for the warm welcome!
Arne
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPVNHrAAoJEFyD82SnDaCeoVcH/jLdhc3qpSK1FIDtx0EJpV2Q
71mj1lT3QxVcDGukUxr10g9nFbOWnBP9AwTqupsdBaaUr27EltTAcRrSAHI9EX+l
7OJMi+nMdRWv7a7n/YuIn+4KIMUSgiWq5zeKnw3D5G5QuNNdiPyzkLVe/2gwgun6
F3VbVblsZofI9xCH0MY/ZsekLJWr+S6YUjmGIcHwdgrxTMYdZXLzjaspbv+aRjdw
nKwpQMQKw/RZvH5y21ATNnyeWXMZ0eTLrzYHTicLu6H5H9jWPz64diqU5kPaOSgD
loOvt1+HfM6FbA9zDflJLeRPrjepbEgcmScSoOolCHzg0q6iOm4b8uuEWSAoaVE=
=5J/x
-----END PGP SIGNATURE-----