inspire9 / heroku-buildpack-netcdf

Buildpack for NetCDF support on Heroku
0 stars 2 forks source link

script to build binaries? #1

Open jefflab opened 9 years ago

jefflab commented 9 years ago

Would it be possible to share the commands you used to build http://pat-public.s3.amazonaws.com/hdf.tgz and http://pat-public.s3.amazonaws.com/netcdf.tgz?

I've tried to build netcdf on Heroku using the following commands:

curl -o /tmp/zlib-1.2.8.tar.gz http://zlib.net/zlib-1.2.8.tar.gz
curl -o /tmp/hdf5-1.8.13.tar.gz ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/hdf5-1.8.13.tar.gz
curl -L -o /tmp/netcdf-4.3.2.tar.gz https://github.com/Unidata/netcdf-c/archive/v4.3.2.tar.gz

mkdir -p /app/vendor/netcdf

cd /tmp
tar -xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/app/vendor/netcdf
make check install

cd /tmp
tar -xzvf hdf5-1.8.13.tar.gz
cd hdf5-1.8.13
./configure --with-zlib=/app/vendor/netcdf --prefix=/app/vendor/netcdf
make
make check
make install

cd /tmp
tar -xzvf netcdf-4.3.2.tar.gz
cd netcdf-c-4.3.2
export CPPFLAGS=-I/app/vendor/netcdf/include
export LDFLAGS=-L/app/vendor/netcdf/lib
./configure --prefix=/app/vendor/netcdf --enable-shared --disable-netcdf-4
make check install

That all seems to work, but then I try to load the ncdf R package and get the error:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/app/vendor/R/lib64/R/library/ncdf/libs/ncdf.so':
  libnetcdf.so.7: cannot open shared object file: No such file or directory

Googling for a solution to the above error hasn't yielded any results. Some people suggest using netcdf 3.6.2 instead, but others say that isn't a good idea because netcdf3 is deprecated.

Having the script that worked for you would be really helpful.

Thanks

pat commented 9 years ago

Hi Jeff

I'm afraid it's been good while since I got this working, and I don't have the compile scripts on hand. However, as you'll note in the bin/compile file I'm setting CPATH, CPPATH and LIBRARY_PATH - have you done the same? Not sure if R expects other environment variables to be used, though.

jefflab commented 9 years ago

Thanks for the reply!

I've tried setting the CPATH, CPPATH, and LIBRARY_PATH variables as you suggest. I've also tried to set the LDFLAGS, NETCDF_INCLUDE, NETCDF_LIB, and NC_CONFIG variables as described in the R ncdf install instructions. Unfortunately, I haven't gotten it working.

I don't think the error above is related to setting environment variables though because I can't find the ncdf.so anywhere on the file system. I suspect I am building the netcdf binary wrong, and therefore it isn't producing that file.

I'll keep digging. Thanks for your thoughts.

pat commented 9 years ago

Wonder if it's a difference between building for dynamic linking and building for static linking? Keep in mind: you probably understand compiling better than I do - could very well be that netcdf compiles for both as it is (or libraries are fine for both normally?)