OpenModelica / OpenModelicaBuildScripts

Scripts to build OpenModelica packages on miscellaneous platforms
3 stars 9 forks source link

OpenModelica 1.16.5 FTBS on debian/Bookworm #23

Closed Trophime closed 2 years ago

Trophime commented 2 years ago

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:

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);
change to Build_static
CMake Error: Unknown argument --build
CMake Error: Run 'cmake --help' for all supported options.
make[5]: Entering directory '/build/openmodelica-1.16.5/OMCompiler/SimulationRuntime/OMSI/Build_static'
make[5]: *** No rule to make target 'install'.  Stop.

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?

sjoelund commented 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.

Trophime commented 2 years ago

The build is done an "clean" environment with pdebuild so I doubt there is old cmake stuff...

Trophime commented 2 years ago

But I will investigate

Trophime commented 2 years ago

Do you have plans to add install feature in cmake?

sjoelund commented 2 years ago

You'll need to check with @mahge . I have no such plans as I dislike cmake

mahge commented 2 years ago

You can try removing the $(CMAKE) --build . part from the end of this line

https://github.com/OpenModelica/OpenModelica/blob/e9883a7ddf6a17efaaa334f89766c9063491f8d7/OMCompiler/Makefile.omsi.common#L9

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.

mahge commented 2 years ago

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

mahge commented 2 years ago

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?

Trophime commented 2 years ago
--- 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

mahge commented 2 years ago
-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.