open-simulation-platform / cosim-cli

Command-line interface for libcosim
https://open-simulation-platform.github.io/cosim
Mozilla Public License 2.0
10 stars 4 forks source link

Unable to build because of apparently missing sources cosim/fs_portability.hpp #92

Closed frl000 closed 2 years ago

frl000 commented 3 years ago

After commit #91, I was unable to build from sources because of missing src/cosim/fs_portability.hpp Neither libcosim nor cosim-cli has such file. If it is my fault, can you pls tell me what to source to make it run? thanks!

Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

Checking Build System Building Custom Rule C:/Users/XXX/Documents/SystemSimulation/OSP/cosim-cli/CMakeLists.txt cache.cpp C:\Users\XXX\Documents\SystemSimulation\OSP\cosim-cli\src\cache.cpp(9,10): fatal error C1083: Cannot open include file: 'cosim/fs_portability.hpp': No such file or directory [C:\Users\XXX\Documents\SystemSimulation\OSP\cosim-cli\b uild\cosim.vcxproj] clean_cache.cpp cli_application.cpp console_utils.cpp inspect.cpp ... Generating Code...

kyllingstad commented 3 years ago

The file does exist in libcosim master, so probably you have an outdated version of libcosim in your Conan cache. You can try removing it with conan remove libcosim and then reinstalling it, or you can make sure that you're getting the latest version by adding the -u (= check for updates) switch to your conan install invocation when building cosim.

frl000 commented 3 years ago

Hi, after fixing that issue and re-installing everything with --build=libcosim --build=fmilibrary I could get some binaries. But unfortunately, more questions popped up:

kyllingstad commented 3 years ago

Could it be possible to simplify it to, let's say copy only relevant binaries to a local bin and lib folder?

You can do exactly this by building the "install" target. Depending on which build tool you're using, this can be done by adding the --target install switch to your CMake build command, by building the INSTALL project from within Visual studio, by running make install on the Linux command line, etc. The result of all these is that all necessary binaries will be copied into the dist/ subfolder inside your build folder. (This is how we build our release packages.)

even by using activate_run.bat, I end up in error messages using C:\Users...>cosim run OspSystemStructure.xml -b 0 -e 10 --log-level=trace --real-time ... info: [FMI Library: FMILIB] Loading 'win64' binary with 'default' platform types error: [FMI Library: FMICAPI] Could not load the DLL: The specified module could not be found. debug: [FMI Library: FMILIB] Releasing allocated library resources debug: [FMI Library: FMILIB] Releasing allocated library resources error: Error loading dynamic library: Releasing allocated library resources ...

At this point, cosim is actually running, meaning that it is not one of cosim's own dependencies which is missing. This error message is printed when it's trying to load the FMU, and some of the FMU DLL's dependencies are missing or the FMU DLL itself is invalid in some way.

In dependencies.exe the error appears in a missing ms-api-win-core...dll, called by system32.dll.

Those should for the most part be built into Windows, and messages about them being missing tend to be misleading. If you are trying to run on a non-development machine (i.e. one where Visual Studio is not installed), you may need to install the appropriate Visual Studio Redistributables, but otherwise it should just work.

ljamt commented 2 years ago

Suggesting to close this issue. Build challenges resolved @frl000 ?