help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: install netcdf package


From: Alexander Barth
Subject: Re: install netcdf package
Date: Wed, 2 Dec 2015 09:46:55 +0100

Hi Clinton,

Thank you for the very detailed information that you sent!

On Wed, Dec 2, 2015 at 2:05 AM, Clinton Winant <address@hidden> wrote:
Hi Alex, Dmitri

I began by removing + autoremoving ncview, since I did not want that to throw out false positives.

I also moved all netcdf folders on /usr/local

then:

./configure --prefix=/usr/local/netcdf --disable-netcdf-4 --disable-dap --enable-static=yes --enable-shared=no

I think that the option --disable-netcdf4 is the issue. New netCDF functions like nc_set_chunk_cache are then not defined in the netCDF library and octave-netcdf requires these functions. I will document this and make the configure step of octave-netcdf check the presence of this function.
Can you do the following:
* install HDF5 (which is required by netcdf4), under ubuntu for example:

sudo apt-get install libhdf5-dev

* reinstall netcdf without the --disable-netcdf4 option and with the option --with-pic (if you disable shared libraries; see also
http://modb.oce.ulg.ac.be/mediawiki/index.php/Octave-netcdf#recompile_with_-fPIC). Otherwise you will get again the error "relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC"


* rerun "make check" (as you did before)

I hope this helps!
Alex


make check  everything pass
sudo make install  followed by

address@hidden:/HOME/cdw/Software/netcdf/C$ ls -la /usr/local/netcdf
total 24
drwxr-xr-x  6 root root 4096 Dec  1 16:29 .
drwxr-xr-x 12 root root 4096 Dec  1 16:29 ..
drwxr-xr-x  2 root root 4096 Dec  1 16:29 bin
drwxr-xr-x  2 root root 4096 Dec  1 16:29 include
drwxr-xr-x  3 root root 4096 Dec  1 16:29 lib
drwxr-xr-x  3 root root 4096 Dec  1 16:29 share

export PATH=/usr/local/netcdf/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/netcdf/lib:$LD_LIBRARY_PATH

then

address@hidden:~$ !oct
octave --no-gui
GNU Octave, version 4.0.0
Copyright (C) 2015 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

warning: function /HOME/cdw/Software/Octave/cdw/clabel.m shadows a core library function
warning: called from
    /home/cdw/.octaverc at line 1 column 1
warning: function /HOME/cdw/Software/Octave/DAT/demo.m shadows a core library function
>> pkg list
no packages installed.
>> pkg install -verbose -forge -auto netcdf

..............................lots of checkings..


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 -lm

make: Entering directory '/tmp/oct-zyFucm/netcdf/src'
/usr/bin/mkoctfile --verbose -DHAVE_OCTAVE_ -v -I/usr/local/netcdf/include __netcdf__.cc -L/usr/local/netcdf/lib -lnetcdf -lm
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/hdf5/serial -I/usr/include/mpi -pthread -fopenmp -g -O2 -fstack-protector-strong -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 -lm -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
Makefile:24: recipe for target '__netcdf__.oct' failed
make: *** [__netcdf__.oct] Error 1
make: Leaving directory '/tmp/oct-zyFucm/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
>>quit

then

address@hidden:~$ locate libnetcdf.a
/HOME/cdw/Roms/netcdf/lib/libnetcdf.a
/HOME/cdw/Software/netcdf/C/liblib/.libs/libnetcdf.a
/usr/local/netcdf/lib/libnetcdf.a
address@hidden:~$ nm /HOME/cdw/Roms/netcdf/lib/libnetcdf.a | grep nc_set_chunk_cache
address@hidden:~$ nm /HOME/cdw/Software/netcdf/C/liblib/.libs/libnetcdf.a | grep nc_set_chunk_cache
address@hidden:~$ nm /usr/local/netcdf/lib/libnetcdf.a | grep address@hidden:~$      NO OUTPUT ON ANY OF THESE 3

then

address@hidden:~$ locate libnetcdf.so
/HOME/cdw/Roms/netcdf/lib/libnetcdf.so
/HOME/cdw/Roms/netcdf/lib/libnetcdf.so.7
/HOME/cdw/Roms/netcdf/lib/libnetcdf.so.7.2.0
/HOME/cdw/Software/netcdf/C/liblib/.libs/libnetcdf.so
/HOME/cdw/Software/netcdf/C/liblib/.libs/libnetcdf.so.7
/HOME/cdw/Software/netcdf/C/liblib/.libs/libnetcdf.so.7.2.0
/usr/local/netcdf/lib/libnetcdf.so
/usr/local/netcdf/lib/libnetcdf.so.7
/usr/local/netcdf/lib/libnetcdf.so.7.2.0
address@hidden:~$ nm -D /HOME/cdw/Roms/netcdf/lib/libnetcdf.so | grep nc_set_chunk_cache
address@hidden:~$  nm -D /HOME/cdw/Roms/netcdf/lib/libnetcdf.so | grep nc_set_chunk_cache
address@hidden:~$ nm -D /HOME/cdw/Roms/netcdf/lib/libnetcdf.so.7 | grep nc_set_chunk_cache
address@hidden:~$ nm -D /HOME/cdw/Roms/netcdf/lib/libnetcdf.so.7.2.0 | grep nc_set_chunk_cache
address@hidden:~$ same for next 3 on /HOME/   then
address@hidden:~$ nm -D /usr/local/netcdf/lib/libnetcdf.so | grep nc_set_chunk_cache
nm: '/usr/local/netcdf/lib/libnetcdf.so': No such file
address@hidden:~$ nm -D /usr/local/netcdf/lib/libnetcdf.so.7 | grep nc_set_chunk_cache
nm: '/usr/local/netcdf/lib/libnetcdf.so.7': No such file
address@hidden:~$ nm -D /usr/local/netcdf/lib/libnetcdf.so.7.2.0 | grep nc_set_chunk_cache
nm: '/usr/local/netcdf/lib/libnetcdf.so.7.2.0': No such file


So obviously there is a big problem here, since the results are so very different from yours.  I regret that I don't know enough to undestand what I have done wrong!

On Tue, Dec 1, 2015 at 1:10 PM, Alexander Barth <address@hidden> wrote:
Hi Clinton,

On Sat, Nov 28, 2015 at 12:30 AM, Clinton Winant <address@hidden> wrote:
Hi Alexander, Dmitri and all the others.

Yes I did install netcdf manually because I need it to run with a 4 dimensional hydrodynamics model (ROMS).  That program runs with MPI, and users are instructed to compile netcdf with static libraries.  Since octave wants (requires?) netcdf with shared libraries, I have two sets of libraries.  Those in /usr/local/netcdf are the shared version:
address@hidden:~$ ls /usr/local/netcdf/lib
libnetcdf.a   libnetcdf.settings  libnetcdf.so.7      pkgconfig
libnetcdf.la  libnetcdf.so        libnetcdf.so.7.2.0
Can you confirm that to be compatible with octave netcdf must be installed as shared libraries?

I don't know why the octave-netcdf package would need netcdf as a shared library. Did you obtain an error message when you compile it against a static netCDF library?  Just be aware of these two potential issues:

http://modb.oce.ulg.ac.be/mediawiki/index.php/Octave-netcdf#recompile_with_-fPIC
http://modb.oce.ulg.ac.be/mediawiki/index.php/Octave-netcdf#HDF5_library_version_mismatched_error

 

Might this suggest that those who built the octave package for ubuntu 15.10 forgot something that is supplied in the ncview package???????????
By installing ncview, you installed the netcdf libraries (at its default location) which was then found by the build process.
 


After uninstalling the netcdf package from octave, I tried setting paths as Alexander suggested, octave would not rebuild the package, but the error is different this time:

address@hidden:~$ export PATH=/usr/local/netcdf/bin:$PATH
address@hidden:~$ export LD_LIBRARY_PATH=/usr/local/netcdf/lib:$LD_LIBRARY_PATH
address@hidden:~$ octave --no-gui
GNU Octave, version 4.0.0
[...]
copyfile /tmp/oct-IOav7L/netcdf/src/__netcdf__.oct /tmp/oct-IOav7L/netcdf/inst/x86_64-pc-linux-gnu-api-v50+
/home/cdw/octave/netcdf-1.0.7/x86_64-pc-linux-gnu-api-v50+/__netcdf__.oct: failed to load: /home/cdw/octave/netcdf-1.0.7/x86_64-pc-linux-gnu-api-v50+/__netcdf__.oct: undefined symbol: nc_set_chunk_cache
error: called from 'doc_cache_create>create_cache' in file /usr/share/octave/4.0.0/m/help/doc_cache_create.m near line 106, column 18
>>

This is very strange. The function nc_set_chunk_cache should be defined in the netcdf library. Can you give me the output of:

locate libnetcdf.a
locate libnetcdf.so

(or use find / -name libnetcdf.a if locate is not set-up)
and for every libnetcdf.a give the result of ;

nm /path/to/libnetcdf.a | grep nc_set_chunk_cache

and for every shared library, the result of:
 
nm -D /path/to/libnetcdf.so | grep nc_set_chunk_cache

On my system these commands return the following which shows that nc_set_chunk_cache is well defined in the netCDF library.
00000000000913d0 T nc_set_chunk_cache
0000000000091460 T nc_set_chunk_cache_ints

Can you also tell me how you configured netcdf when you compiled it from source by providing all options of the ./configure script and the file config.log?
 

If you actually get this far, please know that I am very, very grateful for your efforts, and those of the octave devellopers.  My work would not bepossible without this
Thank you for your kind words!

Regards,
Alex
 

On Fri, Nov 27, 2015 at 12:55 PM, Alexander Barth <address@hidden> wrote:
Dear Clinton,


It seems that you have installed netcdf manually by setting the option --prefix to /usr/local/netcdf, can you confirm?
Otherwise (i.e. without the prefix option) libnetcdf.so.7 would go to /usr/local/lib (and not /usr/local/netcdf/lib as in your case), as far as I know.

The linker knows about the libraries in /usr/local/lib, but not about /usr/local/netcdf/lib therefore the library is not found.

Does it work when you set in a shell these variables before starting octave?
export PATH=/usr/local/netcdf/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/netcdf/lib:$LD_LIBRARY_PATH

Regards,
Alex

On Thu, Nov 26, 2015 at 9:41 PM, Dmitri A. Sergatskov <address@hidden> wrote:
On Thu, Nov 26, 2015 at 12:27 PM, Clinton Winant <address@hidden> wrote:


machine:  hp z210, OS Ubuntu 15.10 Octave 4.4.4 



​It appears to me that you have stuff installed in ​some non-standard places.
Did you compile/installed Octave from source yourself?

​I do not know Ubuntu well, but expect it to provide those package pre-compiled.​

 
​Dmitri.
--


_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave







reply via email to

[Prev in Thread] Current Thread [Next in Thread]