You are not logged in.

#1 2008-10-11 12:24:12

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

How should the build script help hdf4 find libm?

I am updating my AUR package for a new version of hdf4, and the build fails with this error:

gcc  -march=i686 -mtune=generic -O2 -pipe -O3 -fomit-frame-pointer  
 -o hdiff hdiff.o hdiff_array.o hdiff_gr.o hdiff_list.o hdiff_main.o hdiff_mattbl.o 
hdiff_gattr.o hdiff_misc.o hdiff_sds.o hdiff_table.o hdiff_vs.o hdiff_dim.o 
../libsrc/libmfhdf.a ../../hdf/src/libdf.a -ljpeg -lz  -ljpeg -lz 
hdiff_array.o: In function `array_diff':
hdiff_array.c:(.text+0x1ef7): undefined reference to `sqrt'
collect2: ld returned 1 exit status
make[2]: *** [hdiff] Error 1

I found the same error message on the hdf4 FAQ for an earlier version of
hdf4 and gcc 3.4, and the workaround they provided was to set LDFLAGS so that
libm would be linked in. When I do this, the package builds without error.

Here is the working PKGBUILD:

# Contributor: David Scholl <djscholl@gmail.com>
pkgname=hdf4
pkgver=2r3
pkgrel=1
pkgdesc="General purpose library and file format for storing scientific data."
arch=('i686')
url="http://www.hdfgroup.org/hdf4.html"
license=('custom')
depends=('zlib' 'libjpeg')
makedepends=('gcc-libs')
conflicts=('netcdf')
source=(ftp://ftp.hdfgroup.org/HDF/HDF_Current/src/HDF4.$pkgver.tar.gz)
md5sums=('767382a31470e795f4c4217e33a689e8')

build() {
  cp ./configure $startdir/src/HDF4.$pkgver
  cd $startdir/src/HDF4.$pkgver
  export LDFLAGS='-lm'
  ./configure --prefix=/usr F77=gfortran
  make || return 1
  make prefix=$startdir/pkg/usr install || return 1
  mkdir -p $startdir/pkg/usr/share/licenses/$pkgname
  cp $startdir/src/HDF4.$pkgver/COPYING $startdir/pkg/usr/share/licenses/$pkgname
}

I'm uncertain about this because of the recent changes to the fortran
compiler/libs, and I'm not sure that this is the Arch way to add libm. Is it
good practice to step on LDFLAGS like this? Would

export LDFLAGS=$LDFLAGS' -lm'

be better, or would this cause other problems? I'm hoping someone who knows
more about building these scientific fortran packages can advise me.

Offline

Board footer

Powered by FluxBB