1

I am currently trying to compile the netCDF-DataReader in JModelica but it appears the package has been developed in Dymola. The process fails at the compilation stage:

netCD = compile_fmu('NcDataReader2.Examples.Simple',r'H:\Modelica\Modelica Libraries\NcDataReader2',compiler_log_level= 'w,i:log.txt')

CcodeCompilationError: Compilation of generated C code failed.

The log file created contains 326 lines. Midway it says

====== Model compiled successfully =======

But there are many errors after. Some of the errors include:

Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized collect2.exe: error: ld returned 1 exit status mingw32-make1: *** [ceval_] Error 1 Cannot export ??_C@_01LFCBOECM@?4?$AA@: symbol not found Cannot export ??_C@_01NOFIACDB@w?$AA@: symbol not found C:\JModelica.org-2.1\install\Makefiles\MakeFile:190: recipe for target 'fmume10' failed

I don't have much experience with compilers and debugging C-code and would prefer to spend my time focused on creating models; therefore this leads to a number of questions:

  1. Are there patterns in this errror log that could be addressed in such a way to make Dymola libraries useable in other Modelica based programs, such as JModelica?
  2. Are then any other compilers that may be more suited to cross-compatible models?
  3. Am I wasting my time trying to make Dymola models run in JModelica? Would it be more sensible to recreate the model separately in JModelica? The lack of a front-end interface makes this tricky.
alkey
  • 986
  • 4
  • 16
  • 33

1 Answers1

2

The problem is that the external libraries available in netCDF-DataReader needs to be compiled using the GCC compiler available in the JModelica distribution. Try to recompile the libraries using GCC and put the libraries in NcDataReader2\Resources\Library\win32 (or even better put them in NcDataReader2\Resources\Library\win32\gcc472)

Christian Winther
  • 1,113
  • 1
  • 9
  • 17
  • 1
    GCC compiled binaries for the netCDF-Reader should be available on Linux (because OpenModelica also uses GCC, and I have successfully used the netCDF library with OpenModelica on Linux). @alkey would it be possible to run the netCDF examples with JModelica on Linux? – matth Mar 12 '18 at 07:59
  • @matth very useful :) I will install a Linux virtual machine on my computer and will let you know how I get on – alkey Mar 12 '18 at 11:15
  • @Christian_Winther I will try your suggestion on Windows – alkey Mar 12 '18 at 11:18