modelica-3rdparty / ExternalMedia

The ExternalMedia library provides a framework for interfacing external codes computing fluid properties to Modelica.Media-compatible component models.
53 stars 36 forks source link

support for older gcc versions #85

Open thorade opened 1 year ago

thorade commented 1 year ago

Modelica Language Specification about Resources/Library directory and subdirectories: https://specification.modelica.org/master/functions.html#annotations-for-external-libraries-and-include-files https://github.com/modelica/ModelicaSpecification/issues/1316

Sub-directories per platform:

Different versions of one object library can be provided (e.g., for Windows and for Linux) by 
providing a platform directory below the LibraryDirectory. 
If no platform directory is present, the object library must be present in the LibraryDirectory. 
The following platform names are standardized:
– "win32" (Microsoft Windows 32 bit)
– "win64" (Microsoft Windows 64 bit)
– "linux32" (Linux Intel 32 bit)
– "linux64" (Linux Intel 64 bit)

Sub-sub-directories per compiler and version:

The win32 or win64 directories may contain gcc47, vs2010, vs2012 for specific versions of these compilers 
and these are used instead of the general win32 or win64 directories, and similarly for other platforms.

The library on Windows may refer to a lib-file (static library), both a lib- and dll-file (in this case the lib-file is an import-library), 
or just a dll-file. It shall not refer to an obj-file.

If the directory for the specific compiler version is missing the platform specific directory is used.

[A tool may give a diagnostic if the directory corresponding to the selected compiler version is missing. 
The directories may use symbolic links or use a text-file as described below: 
e.g., a text-file vs2008 containing the text ../win32/vs2005 (or vs2005) suggesting that it is compatible with vs2005.]

It seems sub-sub-directories per gcc version are supported by Dymola 2020 and newer, I am somewhat unsure about other tools. Would it be possible to pre-compile for multiple gcc versions (one new like gcc81, one old, like gcc48) and put them in the corresponding directories?

If gcc 4.8.5 is too old to compile CoolProp, clang can be used, it produces binaries compatible with gcc 4.8.5

casella commented 1 year ago

It seems sub-sub-directories per gcc version are supported by Dymola 2020 and newer, I am somewhat unsure about other tools. Would it be possible to pre-compile for multiple gcc versions (one new like gcc81, one old, like gcc48) and put them in the corresponding directories?

I guess so. I'm afraid we'll have time to do that from September onwards. If you know how to handle Github's CI scripts, you may try this on a branch and then test the binary artefacts yourself, it if works we can merge it into master in 1 second.

jowr commented 1 year ago

Hi, I have now made a few changes and I need some feedback:

thorade commented 1 year ago

I think we use gcc 4.8.5 currently, and might upgrade to 8.x later this year, but I am not entirely sure. I tested with clang 7.x and it does produce binaries that are compatible with gcc 4.8. Let me test whether clang 10 to 14 also produces binaries that work with gcc 4.8 and/or gcc 8.x, but that might take me a while.

jowr commented 1 year ago

Hi - I have tried addressing this, but the combination of CMake 3.8 and GCC 4.8 is not very common and I have problems getting the docker images to compile the sources. GCC 8 works well by the way.