I am sure you are both quite tired of this by now, and if you don't answer I will totally understand. I have re-installed Ubuntu 14.04, then installed octave 4.0.0 from ppa. Then I have
sudo apt-get install libhdf5-dev
with the result for instance
locate libhdf5
/usr/lib/x86_64-linux-gnu/libhdf5.a
etc..
I untarred the netcdf, and configured it with
./configure --prefix=/usr/local/netcdf --with-fPIC
The config.log file is atteched, showing the option fPIC was included
I moved nc-config to /usr/bin then:
address@hidden:~$ nc-config --all
This netCDF 4.3.3.1 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/netcdf/include
--libs -> -L/usr/local/netcdf/lib -lnetcdf
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--fc ->
--fflags ->
--flibs ->
--has-f90 -> no
--has-dap -> no
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-pnetcdf-> no
--prefix -> /usr/local/netcdf
--includedir-> /usr/local/netcdf/include
--version -> netCDF 4.3.3.1
Finally, I run octave:
pkg install -verbose -forge -auto netcdf
mkdir (/tmp/oct-Fc4AvG)
untar (/home/cdw/netcdf-1.0.7.tar.gz, /tmp/oct-Fc4AvG)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for mkoctfile... /usr/bin/mkoctfile --verbose
checking for octave-config... /usr/bin/octave-config
g++ -c -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.0.0/octave/.. -I/usr/include/octave-4.0.0/octave -I/usr/include/mpi -pthread -fopenmp -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security conftest.cc -o conftest.o
g++ -shared -Wl,-Bsymbolic -o conftest.oct conftest.o -L/usr/lib/x86_64-linux-gnu/octave/4.0.0 -L/usr/lib/x86_64-linux-gnu -loctinterp -loctave -Wl,-Bsymbolic-functions -Wl,-z,relro
checking for F77_FUNC... g++ -c -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.0.0/octave/.. -I/usr/include/octave-4.0.0/octave -I/usr/include/mpi -pthread -fopenmp -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security conftest.cc -o conftest.o
yes
checking for octave... /usr/bin/octave
checking for VERSION in octave-config... 4.0.0
checking for CANONICAL_HOST_TYPE in octave-config... x86_64-pc-linux-gnu
checking for SHLEXT in octave-config... so
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for strip... strip
checking for nc-config... nc-config
configure: creating ./config.status
config.status: creating Makeconf
"$prefix" is /home/cdw/octave/netcdf-1.0.7
"$exec_prefix" is ${prefix}
octave commands will install into the following directories:
m-files: /usr/share/octave/4.0.0/site/m/octave-forge
oct-files: /usr/lib/x86_64-linux-gnu/octave/4.0.0/site/oct/x86_64-pc-linux-gnu/octave-forge
binaries: /usr/lib/x86_64-linux-gnu/octave/4.0.0/site/exec/x86_64-pc-linux-gnu
alternatives:
m-files: /usr/share/octave/4.0.0/site/octave-forge-alternatives/m
oct-files: /usr/lib/x86_64-linux-gnu/octave/4.0.0/site/octave-forge-alternatives/oct/x86_64-pc-linux-gnu
shell commands will install into the following directories:
binaries: ${exec_prefix}/bin
man pages: ${datarootdir}/man
libraries: ${exec_prefix}/lib
headers: ${prefix}/include
octave-forge is configured with
octave: /usr/bin/octave (version 4.0.0)
mkoctfile: /usr/bin/mkoctfile --verbose for Octave 0
octave-config: /usr/bin/octave-config for Octave 0
netCDF compiler flags: -I/usr/local/netcdf/include
netCDF libraries: -L/usr/local/netcdf/lib -lnetcdf
make: Entering directory `/tmp/oct-Fc4AvG/netcdf/src'
/usr/bin/mkoctfile --verbose -DHAVE_OCTAVE_ -v -I/usr/local/netcdf/include __netcdf__.cc -L/usr/local/netcdf/lib -lnetcdf
g++ -c -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.0.0/octave/.. -I/usr/include/octave-4.0.0/octave -I/usr/include/mpi -pthread -fopenmp -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/local/netcdf/include -DHAVE_OCTAVE_ __netcdf__.cc -o __netcdf__.o
g++ -shared -Wl,-Bsymbolic -o __netcdf__.oct __netcdf__.o -L/usr/local/netcdf/lib -lnetcdf -L/usr/lib/x86_64-linux-gnu/octave/4.0.0 -L/usr/lib/x86_64-linux-gnu -loctinterp -loctave -Wl,-Bsymbolic-functions -Wl,-z,relro
/usr/bin/ld: /usr/local/netcdf/lib/libnetcdf.a(libdispatch_la-dcopy.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/netcdf/lib/libnetcdf.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [__netcdf__.oct] Error 1
make: Leaving directory `/tmp/oct-Fc4AvG/netcdf/src'
pkg: error running `make' for the netcdf package.
error: called from 'configure_make' in file /usr/share/octave/4.0.0/m/pkg/private/configure_make.m near line 96, column 9