Opened 7 years ago

Closed 7 years ago

#4523 closed defect (fixed)

NcDataReader2 examples fail on Linux

Reported by: m.thorade@… Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: *unknown* Version:
Keywords: netCDF Cc:

Description

This issue has already been mentioned in the comments of #4356 and #4520 but it really is a separate issue on its own:

Using the nightly builds on Ubuntu 16.04, all examples from the NcDataReader2 library (for reading netCDF files, delivered with OpenModelica as a system library) fail with error message

cannot find -lnetcdf

The same examples used to work some time ago, I think with 1.11 it was working (on Linux at least).

Change History (9)

comment:1 by tbc@…, 7 years ago

Do you have libnetcdf-dev installed?

comment:2 by m.thorade@…, 7 years ago

That was it, thanks. After installing libnetcdf-dev it works.

So, it would be great if that package could be installed on the testing server as well, that will fix compilation of e.g. this model (tested locally) and probably many more:
https://libraries.openmodelica.org/branches/master/BuildingSystems/files/BuildingSystems_BuildingSystems.Technologies.SolarThermal.Examples.SingleCollectorTest.err

Also, could that package be defined as a dependency of either OMC or the library (is that even possible)? Otherwise, we will just mention it in our documentation.

comment:3 by tbc@…, 7 years ago

Well, it is defined as dependency in the library, otherwise you would not get the linker error about the missing library.

comment:4 by m.thorade@…, 7 years ago

OK, so what I meant was define the dependency such that sudo apt-get install omc will also install libnetcdf-dev or something similar. But then again, not all OMC users need this package, only the users of this library.
OpenModelica also distributes a couple of libraries from a package repository, including the netCDF library, so you can install it like apt-get install omlib-ncdatareader* or get info like apt-cache show omlib-ncdatareader* and maybe THAT package could have libnetcdf-dev as a dependency??

comment:5 by Adrian Pop, 7 years ago

Owner: changed from somebody to Martin Sjölund
Status: newassigned

Martin, can you add the libnetcdf-dev as a dependency to the ncdatareader library?

comment:6 by m.thorade@…, 7 years ago

One more comment: After installing libnetcdf-dev the examples work and I can plot some results, but OMedit still displays the warning

[1] 12:45:51 Translation Warning
[NcDataReader2.Functions.ncEasyGet1D: 3:1-10:16]: Could not find library netcdf in either of:
  /usr/lib/x86_64-linux-gnu/omc/libnetcdf.a
  /usr/lib/x86_64-linux-gnu/omc/libnetcdf.so
  /usr/lib//libnetcdf.a
  /usr/lib//libnetcdf.so
  ....

in reply to:  6 comment:7 by Martin Sjölund, 7 years ago

Replying to m.thorade@…:

One more comment: After installing libnetcdf-dev the examples work and I can plot some results, but OMedit still displays the warning

That should be fixed by https://github.com/OpenModelica/OMCompiler/pull/2095

Adding the libnetcdf-dev as dependency on the ncdatareader library is not as simple though; we generate RPMs, DEBs and macports files based on the same repository and our code doesn't really support external dependencies it seems.

comment:8 by anonymous, 7 years ago

Thanks for the fix, I guess this issue can be closed.
It should be sufficient to just add a hint to the documentation of netCDF-DataReader, e.g. in the Readme.

comment:9 by m.thorade@…, 7 years ago

Resolution: fixed
Status: assignedclosed

Works for me. Thanks!

Note: See TracTickets for help on using tickets.