Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Compiling ExternalMedia with CoolProp in Linux #21

Open
JaviBonilla opened this issue Jul 6, 2016 · 11 comments
Open

Compiling ExternalMedia with CoolProp in Linux #21

JaviBonilla opened this issue Jul 6, 2016 · 11 comments

Comments

@JaviBonilla
Copy link

JaviBonilla commented Jul 6, 2016

Hello,

I tried to compile CoolProp and ExternalMedia in Linux using the script "BuildLib-CMake.sh" in the Project directory. First, I set the environment for using the 32-bit compiler in a 64-bit Linux distribution by including the following line in the "ExternalMedia/Projects/CMakeLists.txt" file:

SET(FORCE_BITNESS_32 ON CACHE BOOL "Force a 32bit build regardless of the host")

And changing also the "ExternalMedia/Projects/makefile" file as:

CPPC = g++ -m32

However, the compilation gives the following error, where the "comutil.h" file cannot be found, I think this is an only Windows header and it should not be considered in the Linux version, but I am not sure about that.

**.................
.................
[ 77%] Building CXX object CoolProp/CMakeFiles/CoolProp.dir/src/SpeedTest.cpp.o
[ 79%] Building CXX object CoolProp/CMakeFiles/CoolProp.dir/src/Tests/TestObjects.cpp.o
[ 79%] Built target CoolProp
Scanning dependencies of target ExternalMediaLib
[ 81%] Building CXX object CMakeFiles/ExternalMediaLib.dir/Sources/FluidProp_IF.cpp.o
In file included from /home/javi/Documents/SFERAII/ExternalMedia/Projects/Sources/FluidProp_IF.h:29:0,
from /home/javi/Documents/SFERAII/ExternalMedia/Projects/Sources/FluidProp_IF.cpp:21:
/home/javi/Documents/SFERAII/ExternalMedia/Projects/Sources/FluidProp_COM.h:22:21: fatal error: comutil.h: No such file or directory
#include < comutil.h >
^
compilation terminated.
CMakeFiles/ExternalMediaLib.dir/build.make:62: recipe for target 'CMakeFiles/ExternalMediaLib.dir/Sources/FluidProp_IF.cpp.o' failed
gmake[2]: *** [CMakeFiles/ExternalMediaLib.dir/Sources/FluidProp_IF.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ExternalMediaLib.dir/all' failed
gmake[1]: *** [CMakeFiles/ExternalMediaLib.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
gmake: * [all] Error 2
~/Documents/SFERAII/ExternalMedia/Projects

Am I missing something in the compilation process?.

Regards,
Javier.

@JonWel
Copy link
Contributor

JonWel commented Jul 6, 2016

Do you have FluidProp on that machine?
If not, setting a 0 to this line may help.

@JaviBonilla
Copy link
Author

JaviBonilla commented Jul 6, 2016

I already set it to 0. First, I tried setting it in "ExternalMedia/Projects/Sources/include.h", but it has no effect, still appearing:

********* Detecting supported property libraries ***********
FluidProp support set to: 1
CoolProp support set to: 1

And then set it in the file you mentioned and then:

********* Detecting supported property libraries ***********
FluidProp support set to: 0
CoolProp support set to: 1

But still the same error:

/home/javi/Documents/SFERAII/ExternalMedia/Projects/Sources/FluidProp_COM.h:22:21: fatal error: comutil.h: No such file or directory
#include < comutil.h >
^
compilation terminated.

@JonWel
Copy link
Contributor

JonWel commented Jul 12, 2016

I also have a similar problem:

[ 70%] Building CXX object CMakeFiles/ExternalMediaLib.dir/Sources/FluidProp_IF.cpp.o
In file included from /ExternalMedia/Projects/Sources/FluidProp_IF.h:29:0,
                 from /ExternalMedia/Projects/Sources/FluidProp_IF.cpp:21:
/ExternalMedia/Projects/Sources/FluidProp_COM.h:22:21: fatal error: comutil.h: No such file or directory
 #include <comutil.h>
                     ^
compilation terminated.

On a Linux 64bit, changing only the FLUIDP = 0 and #define FLUIDPROP 0.
With gcc 5.4.0 and Cmake 3.5.1.
The error is similar but with an other FluidProp related file.

However, the makefile has the option to check in the include.h, but the next line overwrite with 0, and the include.h should also overwrite it with 0 for all non windows OS.
I don't know why it still try to compile these files.

@JonWel
Copy link
Contributor

JonWel commented Jul 14, 2016

@jowr do you have an idea?

These two files are included in:

Sources/fluidpropsolver.h: *   - FluidProp_COM.h
Sources/FluidProp_IF.h:#include "FluidProp_COM.h"
Sources/FluidProp_COM.h:#ifndef FluidProp_COM_h
Sources/FluidProp_COM.h:#define FluidProp_COM_h
Sources/FluidProp_COM.h:#endif // FluidProp_COM_h
Sources/FluidProp_IF.cpp:#include "FluidProp_IF.h"
Sources/fluidpropsolver.h: *   - FluidProp_IF.h
Sources/fluidpropsolver.h:#include "FluidProp_IF.h"
Sources/FluidProp_IF.h:#ifndef FluidProp_IF_h
Sources/FluidProp_IF.h:#define FluidProp_IF_h
Sources/FluidProp_IF.h:#endif // FluidProp_IF_h

So they both depend of each other and on the fluidpropsolver.h, which is called by:

Sources/solvermap.cpp:#include "fluidpropsolver.h"
Sources/fluidpropsolver.cpp:#include "fluidpropsolver.h"

So it depends on solvermap.cpp:

#if (FLUIDPROP == 1)
#include "fluidpropsolver.h"
#endif // FLUIDPROP == 1

Thus it should only be included if FLUIDPROP == 1.
And under Linux, this should always be 0 as written in include.h:

#if defined(__ISLINUX__)
#  undef FLUIDPROP
# define FLUIDPROP 0

So I don't understand why it tries to compile these files (I don't know much about Cmake yet)

@jowr
Copy link
Member

jowr commented Jul 15, 2016

Thank you for the interest in this library. It should be enough to set #define FLUIDPROP 0 in include.h, in theory. I added BuildLib-CMake.sh to make things easier for @JonWel and the script does not read include.h yet.

For now, you have to edit both BuildLib-CMake.sh and include.h to disable FluidProp. However, the integration with CMake is not finished and the CMakeLists.txt has not functions to remove the FluidProp headers yet.

@JaviBonilla and @JonWel I will have a look as soon as I can, but for now it does not work and it never did. I would be happy to get some help fixing up the CMake stuff.

@JonWel
Copy link
Contributor

JonWel commented Jul 15, 2016

@jowr Ok, now the issue is more clear for me: we need to add some code in the CMakeLists.txt to exclude the FluidProp when set to 0.
I see now that all ExternalMedia sources are added around line 83.

@JaviBonilla
Copy link
Author

Thank you for taking care of this issue!. I would like to help but the thing is that I am not familiar with coding makefiles.

@jowr
Copy link
Member

jowr commented Jul 15, 2016

Exactly. I have a little more time tonight and I can try to compile the code on my Linux box, but I cannot promise anything.

@JonWel
Copy link
Contributor

JonWel commented Jul 15, 2016

I think I have a quick workaround to take at least the BuildLib-CMake.sh variable into account.
After that it would only be required to update the later to take the value from include.h

JonWel added a commit that referenced this issue Jul 15, 2016
Still relies on manual modification of the BuildLib-CMake.sh
@JonWel
Copy link
Contributor

JonWel commented Jul 15, 2016

be9b7a5 seems to help pass the FluidProp Issue, but there was still a problematic include in the test file (crtdbg.h and conio.h).
I hope a simple pragma to only use them on Windows will be enough (I'm not sure if these includes are even needed, they where present in the initial file I received and I just didn't touch them). Would be better to clean a bit this file.

After that, it's something about REFPROP in CoolProp's side that complains: undefined reference to 'dlsym' undefined reference to 'dlopen' undefined reference to 'dlclose'

@TaylanT
Copy link

TaylanT commented Dec 12, 2016

I'm still having problems to get ExternalMedia / CoolProp working on Linux (Debian). After running ./BuildLib-CMake.sh it complained about the cmake policiy (CMAKE_POLICY(SET CMP0053 OLD)). Couldnt fix that, so I commented out. Then it compiled but at the end it gave me:

CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function getFunctionPointer(char const*, DLLNameManglingStyle)': REFPROPMixtureBackend.cpp:(.text+0x16e): undefined reference to dlsym'
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function load_REFPROP(std::string&, std::string const&)': REFPROPMixtureBackend.cpp:(.text+0xcf6): undefined reference to dlopen'
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function CoolProp::REFPROPMixtureBackend::~REFPROPMixtureBackend()': REFPROPMixtureBackend.cpp:(.text+0x1a27): undefined reference to dlclose'
collect2: error: ld returned 1 exit status
CMakeFiles/main.dir/build.make:346: recipe for target 'main' failed
make[2]: *** [main] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/main.dir/all' failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants