Coder Social home page Coder Social logo

Comments (6)

jowr avatar jowr commented on July 24, 2024

Hi

Have you read this section https://github.com/modelica-3rdparty/ExternalMedia/blob/master/README_compilation.md#quick-start-guide?

In there it says that you can use cmake --build build --config Release --target install-as-default to override the compiler specifications and install the libraries to linux64 or linux.

To build a shared library, you can change line 143 in https://github.com/modelica-3rdparty/ExternalMedia/blob/master/Projects/CMakeLists.txt#L143 to 'SHARED' instead of 'STATIC', but that is untested - thank you being the lab mouse here...

from externalmedia.

sjoelund avatar sjoelund commented on July 24, 2024

It seems to be looking for a shared library .so extension and the CMAKE makes a static. Is this the reason for not finding these external functions?

Because OpenModelica can only run functions at compile-time if they are in a shared library (you cannot use dlopen on a static library), and it thinks the function must be evaluated because some structural information is returned by the function call.

from externalmedia.

jowr avatar jowr commented on July 24, 2024

Yes - this is also the reason why the roadmap says that we want to move to shared libraries as the new default. However, we are no there yet.

from externalmedia.

sjoelund avatar sjoelund commented on July 24, 2024

Yes - this is also the reason why the roadmap says that we want to move to shared libraries as the new default. However, we are no there yet.

I would compile both static (with -fPIC) and shared, so the library can be linked into an FMU without problem as well (so many issues with FMUs not finding its dependencies).

from externalmedia.

branch171 avatar branch171 commented on July 24, 2024

Hi

The change to SHARED on line 143 did not work. There is an issue with CoolProp.

/usr/bin/ld: CoolProp/CMakeFiles/CoolProp.dir/src/CoolPropTools.cpp.o: relocation R_X86_64_TPOFF32 against `_ZL10ftw_summer' can not be used when making a shared object; recompile with -fPIC

from externalmedia.

branch171 avatar branch171 commented on July 24, 2024

This can now be closed. You need to do the following

69 SET(COOLPROP_STATIC_LIBRARY OFF CACHE BOOL "Force the static library")
70 SET(COOLPROP_SHARED_LIBRARY ON CACHE BOOL "Force the shared library")
71 SET(COOLPROP_OBJECT_LIBRARY OFF CACHE BOOL "Force the object library")

143 add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES})
147 target_compile_definitions(${LIBRARY_NAME} PRIVATE EXTERNALMEDIA_MODELICA_ERRORS=0) # Use 0 for a shared library and 1 for a static library

With these changes the shared library compiles and runs the examples in OpenModelica

from externalmedia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.