Closed justxi closed 1 year ago
FMIL is a 3rdParty library which has some unusual approaches. I am guessing it is picking up some system library and trying to merge it into its own static library (either expat
or minizip
)
Can you change the line:
message(FATAL_ERROR "Merge_static_libs can only process static libraries")
to
message(FATAL_ERROR "Merge_static_libs can only process static libraries: ${lib}")
in OpenModelica/OMCompiler/3rdParty/FMIL/Config.cmake/mergestaticlibs.cmake
at line 35 and reconfigure. It should tell us which library is the issue.
Now I get
CMake Error at OMCompiler/3rdParty/FMIL/Config.cmake/mergestaticlibs.cmake:35 (message):
Merge_static_libs can only process static libraries: c99snprintf
Call Stack (most recent call first):
OMCompiler/3rdParty/FMIL/CMakeLists.txt:275 (merge_static_libs)
That library is created in OMCompiler/3rdParty/FMIL/ThirdParty/c99_snprintf/CMakeLists.txt
at line 122. The directive does not specify STATIC
and it is defaulting to SHARED
. (_Maybe the gentoo packaging system sets BUILD_SHAREDLIBS to ON).
You can change it to the following
add_library(c99snprintf STATIC c99-snprintf_1.1/snprintf.c)
There are more places in there where the library type is not specified. If you see similar errors adjust them in a similar way. I will create a proper fix tomorrow.
Adding "STATIC" to the suggested CMakeLists.txt works and lets the configuration process successfully pass.
Now a new error occurs:
>>> Compiling source in /var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3 ...
* Source directory (CMAKE_USE_DIR): "/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3"
* Build directory (BUILD_DIR): "/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3_build"
ninja -v -j9 -l0
ninja: error: 'OMSimulator/lib/libOMSimulator.so', needed by 'OMEdit/OMEditLIB/CMakeFiles/OMEditLib_autogen_timestamp_deps', missing and no known rule to make it
I think there might be another error printed before this one. Probably some error/notification from ninja telling you something about the OMSimulator
submodule.
In any case, unfortunately, you cannot build OMSimulator
using Ninja only. You have to start with GNU Make. We assumed (wrongly) everyone would use GNU Make to build OpenModelica. So we passed that make executable to OMSimulator as well.
Which is wrong because CMake will happily set CMAKE_MAKE_PROGRAM
as ninja
if the generator is Ninja.
You can try changing all CMAKE_MAKE_PROGRAM
s in that file to just plain make
. If this works, we can use it. If not, we will see what more we can do.
I can prevent using "ninja" and use "make" instead.
I had to apply this patch:
--- a/OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/ioapi.h 2022-11-01 19:05:52.336696806 +0100
+++ b/OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/ioapi.h 2022-11-01 19:07:01.541699071 +0100
@@ -45,6 +45,10 @@
#include <stdlib.h>
#include "zlib.h"
+#ifndef OF
+ #define OF(args) args
+#endif
+
#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell
Now it stops with a sandbox violation "/usr/local/lib/libfmilib.a"... I have to find the point where it happens...
EDIT: FMIL tries to install to the local filesystem instead into the folder which is used for later installation:
gmake[5]: Leaving directory '/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3/OMSimulator/3rdParty/FMIL/build/li
nux'
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: ""
-- Installing: /usr/local/lib/libfmilib.a
* ACCESS DENIED: unlink: /usr/local/lib/libfmilib.a
* ACCESS DENIED: open_wr: /usr/local/lib/libfmilib.a
* ACCESS DENIED: unlink: /usr/local/lib/libfmilib.a
* ACCESS DENIED: fopen_wr: /usr/local/lib/libfmilib.a
CMake Error at cmake_install.cmake:46 (file):
file INSTALL cannot copy file
"/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3/OMSimulator/3rdParty/FMIL/build/linux/libfmilib.a"
to "/usr/local/lib/libfmilib.a": Permission denied.
In case you continued on a previous build, I recommend starting on a clean repo. Or, if you have done git clean, do not forget to clean submodules recursively.
git clean -ffxd
git submodule foreach --recursive git clean -ffxd
If that is not the case, please rerun the configure and build, redirect them to a file and attach them here so I can take a look:
cmake ..... |& tee config_trace.txt
make ..... |& tee build_trace.txt
Can you also tell me what the exact configuration command you are using is.
When building openmodelica the ebuild always checks out the source code again. So everytime it is a clean build.
I see
patching file OMCompiler/3rdParty/FMIL/Config.cmake/mergestaticlibs.cmake
patching file OMCompiler/3rdParty/FMIL/ThirdParty/c99_snprintf/CMakeLists.txt
patching file OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/ioapi.h
Source directory (CMAKE_USE_DIR): "/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3"
Build directory (BUILD_DIR): "/var/tmp/portage/sci-physics/openmodelica-1.19.3-r100/work/openmodelica-1.19.3_build"
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSI/base/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSI/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSI/solver/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSICpp/omcWrapper/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSICpp/omsi/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSICpp/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSIC/src/omsu/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/OMSIC/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/SimulationRuntime/cpp/CMakeLists.txt:
SET(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMCompiler/3rdParty/tbb/CMakeLists.txt:
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE
Hardcoded definition(s) removed in OMCompiler/3rdParty/FMIL/ThirdParty/CMakeModules/UseDoxygen/CMakeLists.txt:
set(CMAKE_INSTALL_PREFIX ${CMAKE_ROOT})
Hardcoded definition(s) removed in OMCompiler/3rdParty/FMIL/CMakeLists.txt:
SET(CMAKE_BUILD_TYPE ${FMILIB_DEFAULT_BUILD_TYPE})
Hardcoded definition(s) removed in OMSimulator/src/OMSimulatorLib/CMakeLists.txt:
set(CMAKE_BUILD_TYPE Debug)
Hardcoded definition(s) removed in OMSimulator/CMakeLists.txt:
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/install/${PLATFORM_STRING} C
set(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in OMSimulator/3rdParty/FMIL/ThirdParty/CMakeModules/UseDoxygen/CMakeLists.txt:
set(CMAKE_INSTALL_PREFIX ${CMAKE_ROOT})
Hardcoded definition(s) removed in OMSimulator/3rdParty/FMIL/CMakeLists.txt:
SET(CMAKE_BUILD_TYPE ${FMILIB_DEFAULT_BUILD_TYPE})
SET(CMAKE_INSTALL_PREFIX ${FMILIB_INSTALL_PREFIX} CACHE INTERNAL "Prefix prep
Hardcoded definition(s) removed in CMakeLists.txt:
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/install_cmake CACHE PATH "
Hardcoded definition(s) removed in doc/SimulationRuntime/OMSI/CMakeLists.txt:
set(CMAKE_VERBOSE_MAKEFILE ON)
Hardcoded definition(s) removed in doc/SimulationRuntime/cpp/CMakeLists.txt:
set(CMAKE_VERBOSE_MAKEFILE ON)
I guess these is the ebuild fixing up wrong things and it might give a hint to what is wrong.
If you comment out line 87 in OpenModelica/OMSimulator/3rdParty/FMIL/CMakeLists.txt
# SET(CMAKE_INSTALL_PREFIX ${FMILIB_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories" FORCE)
does it change anything?
I am trying to compile OpenModelica on a gentoo docker but I am unable to install qtwidgets so I am kind of stuck.
What is the problem with qtwidgets?
$ docker run --name gentoo_build_check -it gentoo/stage3
$ emerge --sync
# Finishes successfully.
$ emerge dev-qt/qtcore
# This fails
$ emerge dev-qt/qtwidgets
gives me
...
The following USE changes are necessary to proceed:
(see "package.use" in the portage(5) man page for more details)
# required by dev-qt/qtgui-5.15.5-r2::gentoo[-gles2-only]
# required by dev-qt/qtwidgets-5.15.5-r1::gentoo
# required by dev-qt/qtwidgets (argument)
>=media-libs/libglvnd-1.4.0 X
# required by dev-qt/qtgui-5.15.5-r2::gentoo[X]
# required by dev-qt/qtwidgets-5.15.5-r1::gentoo
# required by dev-qt/qtwidgets (argument)
>=x11-libs/libxkbcommon-1.4.1 X
Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.
The I tried
$ emerge dev-qt/qtwidgets --autounmask-write
The following USE changes are necessary to proceed:
(see "package.use" in the portage(5) man page for more details)
# required by dev-qt/qtgui-5.15.5-r2::gentoo[-gles2-only]
# required by dev-qt/qtwidgets-5.15.5-r1::gentoo
# required by dev-qt/qtwidgets (argument)
>=media-libs/libglvnd-1.4.0 X
# required by dev-qt/qtgui-5.15.5-r2::gentoo[X]
# required by dev-qt/qtwidgets-5.15.5-r1::gentoo
# required by dev-qt/qtwidgets (argument)
>=x11-libs/libxkbcommon-1.4.1 X
Autounmask changes successfully written.
* IMPORTANT: config file '/etc/portage/package.use/zz-autounmask' needs updating.
* See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
* sections of the emerge man page to learn how to update config files.
Google suggested running etc-update
So I run etc-update
and selected -3
$ etc-update
Scanning Configuration files...
The following is the list of files which need updating, each
configuration file is followed by a list of possible replacement files.
1) /etc/portage/package.use/zz-autounmask (1)
Please select a file to edit by entering the corresponding number.
(don't use -3, -5, -7 or -9 if you're unsure what to do)
(-1 to exit) (-3 to auto merge all files)
(-5 to auto-merge AND not use 'mv -i')
(-7 to discard all updates)
(-9 to discard all updates AND not use 'rm -i'): -3
Replacing /etc/portage/package.use/zz-autounmask with /etc/portage/package.use/._cfg0000_zz-autounmask
mv: overwrite '/etc/portage/package.use/zz-autounmask'? y
Exiting: Nothing left to do; exiting. :)
After that tried to install qtwidgets
again. This time it starts compiling. Unfortunately, it fails to complete (after quite some time compiling other things) due to this (note that these are selected parts. So much is printed so maybe I missed something relevant):
...
#
....
* /var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29/libsandbox/trace.c:do_peekstr():134: failure (Operation not permitted):
* ISE:do_peekstr:process_vm_readv(23759, 0x00007ffc28b16bd0{0x00007f1b731eb010, 0x5e0}, 1, 0x00007ffc28b16be0{0x00000000f7f6fa20, 0x5e0}, 1, 0) failed: Operation not permitted
* /var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29/libsandbox/trace.c:do_peekstr():134: failure (Operation not permitted):
* ISE:do_peekstr:process_vm_readv(23761, 0x00007ffc28b16bd0{0x00007f1b731eb010, 0xd60}, 1, 0x00007ffc28b16be0{0x00007f355e0e02a0, 0xd60}, 1, 0) failed: Operation not permitted
FAILED: gir/GLib-2.0.gir
....
....
Traceback (most recent call last):
File "/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/tools/g-ir-scanner", line 99, in <module>
sys.exit(scanner_main(sys.argv))
File "/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/giscanner/scannermain.py", line 609, in scanner_main
shlibs = create_binary(transformer, options, args)
File "/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/giscanner/scannermain.py", line 434, in create_binary
shlibs = resolve_shlibs(options, binary, options.libraries)
File "/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/giscanner/shlibs.py", line 170, in resolve_shlibs
_resolve_non_libtool(options, binary, non_libtool))
File "/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/giscanner/shlibs.py", line 106, in _resolve_non_libtool
output = subprocess.check_output(args)
File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ldd', '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0-build/tmp-introspect8jx14jap/GLib-2.0']' returned non-zero exit status 1.
ninja: build stopped: subcommand failed.
* ERROR: dev-libs/gobject-introspection-1.72.0::gentoo failed (compile phase):
* compile failed
*
* Call stack:
* ebuild.sh, line 122: Called src_compile
* environment, line 2526: Called meson_src_compile
* environment, line 1786: Called die
* The specific snippet of code:
* "$@" || die "compile failed"
*
* If you need support, post the output of `emerge --info '=dev-libs/gobject-introspection-1.72.0::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-libs/gobject-introspection-1.72.0::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/temp/environment'.
* Working directory: '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0'
* S: '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0'
>>> Failed to emerge dev-libs/gobject-introspection-1.72.0, Log file:
>>> '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/temp/build.log'
* Messages for package media-fonts/liberation-fonts-2.1.5:
* The following fontconfig configuration files have been installed:
*
* 60-liberation.conf
*
* Use `eselect fontconfig` to enable/disable them.
* Messages for package media-libs/fontconfig-2.14.0-r1:
* Please make fontconfig configuration changes using `eselect
* fontconfig`. Any changes made to /etc/fonts/fonts.conf will be
* overwritten. If you need to reset your configuration to upstream
* defaults, delete the directory /etc/fonts/conf.d/ and re-emerge
* fontconfig.
*
* (Note: Above message is only printed the first time package is
* installed. Please look at /usr/share/doc/fontconfig-2.14.0-r1/README.gentoo*
* for future reference)
* Messages for package dev-libs/gobject-introspection-1.72.0:
* ERROR: dev-libs/gobject-introspection-1.72.0::gentoo failed (compile phase):
* compile failed
*
* Call stack:
* ebuild.sh, line 122: Called src_compile
* environment, line 2526: Called meson_src_compile
* environment, line 1786: Called die
* The specific snippet of code:
* "$@" || die "compile failed"
*
* If you need support, post the output of `emerge --info '=dev-libs/gobject-introspection-1.72.0::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-libs/gobject-introspection-1.72.0::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/temp/environment'.
* Working directory: '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0'
* S: '/var/tmp/portage/dev-libs/gobject-introspection-1.72.0/work/gobject-introspection-1.72.0'
....
The first few lines of the above error message make me think that this might be a docker related issue. However, I have honestly no idea which messages are relevant it is just too much going on and too much information at once thrown at users. Maybe there are ways to hide all the irrelevant info printed on screen but it is should have been the default behavior.
Hopefully you can see something in it that I do not.
After getting the same error (using your docker environment) I found, the following solution: In "/etc/portage/make.conf" set FEATURES="-usersandbox" .
I think you should try to compile OpenModelica directly on your gentoo machine. Otherwise, it is turning out to be a wild goose chase of fixing unrelated problems.
I installed qtwidegets
successfully. Unfortunately, I cannot install qtwebkit
since there is no package for it. I am assuming that you have managed to install it successfully for the ebuild due to tha fact that you have gotten to the compilation stage. Therefore, I am guessing it is due to the version of qt (I think 5.15.5) that qtwebkit
is no longer available (it has been deprecated).
I instead tried to switch to qtwebengine
using the work in progress in #9620. Unfortunatelly I cannot install qtwebengine as well because emerge says I need 32 GiB of RAM. I do have 32 GiB of RAM so I think this might be a side-effect of the usersandbox
option.
You should just try the suggestion here and if that does not work, we can similarly adjust all the issues reported in that message.
I think you should try to compile OpenModelica directly on your gentoo machine. Otherwise, it is turning out to be a wild goose chase of fixing unrelated problems.
I agree.
I installed
qtwidegets
successfully. Unfortunately, I cannot installqtwebkit
since there is no package for it. I am assuming that you have managed to install it successfully for the ebuild due to tha fact that you have gotten to the compilation stage. Therefore, I am guessing it is due to the version of qt (I think 5.15.5) thatqtwebkit
is no longer available (it has been deprecated).
If you interested I can upload my ebuild, which is based on a version which I found in the internet.
I instead tried to switch to
qtwebengine
using the work in progress in #9620. Unfortunatelly I cannot install qtwebengine as well because emerge says I need 32 GiB of RAM. I do have 32 GiB of RAM so I think this might be a side-effect of theusersandbox
option.
I didn´t tried that.
You should just try the suggestion here and if that does not work, we can similarly adjust all the issues reported in that message.
Yes, that's my thought too.
The line in https://github.com/OpenModelica/OpenModelica/issues/9629#issuecomment-1301106923 is already commented out by the Gentoo build system.
Okay. We can try one more thing
In the file OpenModelica/OMSimulator/3rdParty/FMIL/CMakeLists.txt
at line 304, you will find these lines
install(TARGETS ${FMILIB_TARGETS}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
)
Replace them with just this line
install(TARGETS ${FMILIB_TARGETS} DESTINATION ${CMAKE_INSTALL_LIBDIR})
I think this might be it 🤞.
I think this might be it 🤞.
Now that I checked even more, this might indeed not be 'it'.
However, in the file OpenModelica/OMSimulator/Makefile
at line 215, you will find this line, adjust it to what is shown in the diff.
-cd 3rdParty/FMIL/$(BUILD_DIR) && $(CMAKE) $(CMAKE_TARGET) ../.. -DFMILIB_INSTALL_PREFIX=../../$(INSTALL_DIR)
+cd 3rdParty/FMIL/$(BUILD_DIR) && $(CMAKE) $(CMAKE_TARGET) ../.. -DCMAKE_INSTALL_PREFIX=../../$(INSTALL_DIR)
That is, change -DFMILIB_INSTALL_PREFIX
to -DCMAKE_INSTALL_PREFIX
.
I have fixed this and a couple of other issues already. However, it will take about one hour (assuming nothing else goes wrong) before the changes make it here (3 levels of submodules requiring two CI checks).
With these patches applied OpenModelica builds on Gentoo with CMake.
Hi, even this issue is closed, I have managed to build QtWebKit on my Gentoo. It may be useful to someone, sometime. The tutorial is available here.
Seeya.
Description
Using CMake OpenModelica 1.19.3 fails to build with:
Steps to Reproduce
Copied from Gentoo build:
Expected Behavior
Successful build of OpenModelica.
Version and OS