Closed Trophime closed 2 years ago
Are you sure that cmake is 3.22.1 and that you don't have some old cmake lying around that might have been used? cmake 3.22.1 works fine for me.
PS: I've seen that OpenModelica source now contains CMakeLists.txt file. Is the cmake build functional?
It won't install everything. It also skips one stage of bootstrapping so the omc executable might not be quite as fast either.
The build is done an "clean" environment with pdebuild so I doubt there is old cmake stuff...
But I will investigate
Do you have plans to add install feature in cmake?
You'll need to check with @mahge . I have no such plans as I dislike cmake
You can try removing the $(CMAKE) --build .
part from the end of this line
It is redundant here since the next command is make install
anyway.
The Makefile (linked above) tries to automate the building of both static and dynamic versions of the libraries using a shell loop (line:35). I am not sure what is happening here but I am suspecting some shell expansion issues.
PS: I've seen that OpenModelica source now contains CMakeLists.txt file. Is the cmake build functional?
It is functional but it is not 100% complete yet compared to the default Makefiles. OMSI is one of the things missing for example.
You can try it for "normal" usage. It should be fine. However, make sure to
Pick a build directory different than just "build" (e.g. use build_cmake
) so that you can switch between the two build systems in case you see something missing. They should function just fine side by side.
Do not forget to install your build. omc
is not usable from the build directory because it refuses to run if it is not in a directory named bin
. Just run make install
and use omc from the install dir. The default install directory is a folder named install_cmake
inside your build dir.
This is what the loop seems to have expanded to
cd SimulationRuntime/OMSI; \
mkdir -p Build_static;
(cd ./Build_static;
echo "change to Build_static";
cmake -G "Unix Makefiles" --build . -DPLATFORM=static -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX:PATH="/build/openmodelica-1.16.5/build" -DLIB_OMC=lib/x86_64-linux-gnu/omc ..;
/usr/bin/make install);
mkdir -p Build_dynamic;
(cd ./Build_dynamic;
echo "change to Build_dynamic";
cmake -G "Unix Makefiles" --build . -DPLATFORM=dynamic -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX:PATH="/build/openmodelica-1.16.5/build" -DLIB_OMC=lib/x86_64-linux-gnu/omc ..;
/usr/bin/make install);
The commands on the fifth and tenth line are clearly wrong. For one, --build
is being passed to a CMake configure (-G) command.
Are you by any chance passing arguments to configure
? Or can you think of anything that might cause this?
--- openmodelica-1.16.5.orig/OMCompiler/Makefile.omsi.common
+++ openmodelica-1.16.5/OMCompiler/Makefile.omsi.common
@@ -6,7 +6,7 @@ PLATFORMS=static dynamic
CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=$(BUILDTYPE)
-CMAKE_CALL=cmake -G $(CMAKE_TARGET) --build . -DPLATFORM=$(PLATFORM) $(CMAKE_FLAGS) $(IS_MINGW32) $(IS_MINGW64) -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIB_OMC=$(LIB_OMC) ..
+CMAKE_CALL=cmake -G $(CMAKE_TARGET) -DPLATFORM=$(PLATFORM) $(CMAKE_FLAGS) $(IS_MINGW32) $(IS_MINGW64) -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIB_OMC=$(LIB_OMC) ..
.PHONY: OMSIBaseClean OMSICClean OMSIBaseMSVC OMSI OMSIBaseInstall OMSICInstall OMSI-clean OMSICClean OMSICPP OMSICPPinstall
with this patch, it works smoothly
-CMAKE_CALL=cmake -G $(CMAKE_TARGET) --build . -DPLATFORM=$(PLATFORM) $(CMAKE_FLAGS) $(IS_MINGW32) $(IS_MINGW64) -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIB_OMC=$(LIB_OMC) ..
I see. You are using an old revision of OpenModelica. This was updated eight months ago. It all makes sense now.
Hi, I'm trying to rebuild pacakges for OpenModelica 1.16.5 on debian Testing wtih cmake 3.22.1 The package FTBS with an error:
This error does not show up on Debian/Bullseye nor on Ubuntu/Focal.
PS: I've seen that OpenModelica source now contains CMakeLists.txt file. Is the cmake build functional?