Skip to content

[workflow][Nix] initial packaging & flake#5059

Merged
hugtalbot merged 14 commits intosofa-framework:masterfrom
nim65s:master
Dec 4, 2024
Merged

[workflow][Nix] initial packaging & flake#5059
hugtalbot merged 14 commits intosofa-framework:masterfrom
nim65s:master

Conversation

@nim65s
Copy link
Contributor

@nim65s nim65s commented Oct 12, 2024

Hi,

As discussed at Journées HPC INRIA in Lille, here is an initial nix package for sofa.

It also include a flake (and its lock), which is not mandatory, but ease the use of the package, with commands like

  • nix build, to compile the package in a sandbox
  • nix develop, to provide a shell with an environment containing all required dependencies to build the project in the usual CMake way
  • nix run, to start the software.

All these commands take an optional path argument, defaulting to the current working directory, but we could also build / develop / run any commit / tag / branch / fork of the project with eg. nix build github:sofa-framework/sofa(for master) or nix run github:nim65s/sofa/58ae0644d117aea880ed284f6cc0beb7e9802f96

While here, this also setup some CI for this packaging, mostly to detect early:

  • if anything new in the repo would break the nix packaging
  • if any update from a dependency in upstream nixpkgs would break sofa

But also, a nix binary cache can be set up with eg. https://www.cachix.org/, so that once a commit is build in CI, users & developers can directly use that cache instead of compiling themselves.
(it is also true in the other way: developers with write access to the cache can send their build result to it so that the CI will be instantaneous cache hit)

Here is an example of CI build log: https://github.com/nim65s/sofa/actions/runs/11306279152/job/31446709649

PS: I did not test on macos yet, so this is probably a bit early to expect it work. It at least require darwin signatures I guess, I'll try to test that this week, when I can use an apple system.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@hugtalbot hugtalbot added pr: status to review To notify reviewers to review this pull-request pr: new feature Implement a new feature pr: highlighted in next release Highlight this contribution in the notes of the upcoming release labels Oct 14, 2024
@hugtalbot
Copy link
Contributor

Thanks a lot @nim65s for your PR, that's awesome 🙌
We'll review it this week 👓

@damienmarchal
Copy link
Contributor

Nice.

@hugtalbot hugtalbot changed the title Nix: initial packaging & flake [workflow][Nix] initial packaging & flake Oct 14, 2024
@nim65s
Copy link
Contributor Author

nim65s commented Oct 16, 2024

Updated to Qt6, and fixed on macos.

This required some fixes in upstream nixpkgs: NixOS/nixpkgs#348549, so until this is merged we have to use its source.

message("${PROJECT_NAME}: will use Qt6")
sofa_find_package(Qt6 COMPONENTS Gui GuiTools Widgets WidgetsTools OpenGLWidgets REQUIRED)
set(SOFA_GUI_QT_TARETS ${SOFA_GUI_QT_TARGETS} Qt::Core Qt::Gui Qt::Widgets Qt::OpenGLWidgets )
find_package(Qt6 COMPONENTS Gui GuiTools Widgets WidgetsTools OpenGLWidgets REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with Qt components. Can you give more details on the changes here? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with those neither, but as a matter of fact, the Qt6GuiToolsConfig.cmake file does not define a Qt6::GuiTools CMake target. Therefore we can not rely on the presence of a Qt6::GuiTools CMake target to know how should we define SOFA_GUI_QT_HAVE_QT6.

But I don't know why we are looking for those CMake targets to define if SOFA_GUI_QT_HAVE_QT6 or not. My guess is that Qt6_FOUND should be enough.

@alxbilger
Copy link
Contributor

@nim65s The command nix build gives me this error: error: experimental Nix feature 'nix-command' is disabled; add '--extra-experimental-features nix-command' to enable it. I am not familiar enough with nix to understand what Google explains to me. What is going on? Thanks

@nim65s
Copy link
Contributor Author

nim65s commented Oct 16, 2024

flakes and the nix command are not mandatory and not perfect enough yet, so for now you can either:

  • run those commands with the extra flag: nix --extra-experimental-features "nix-command flakes" build
  • or add the line experimental-features = nix-command flakes in your ~/.config/nix/nix.conf
  • or add the line experimental-features = nix-command flakes in your /etc/nix/nix.conf and restart nix-daemon

@alxbilger
Copy link
Contributor

After a successful build, I have the following trace when running:

[INFO]    [runSofa] PluginRepository paths = /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/plugins:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/collections:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib
[INFO]    [runSofa] DataRepository paths = /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa/examples:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa/examples
[INFO]    [runSofa] GuiDataRepository paths = /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa/gui/runSofa:/nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/share/sofa/gui/qt
[ERROR]   [FileSystem::createdirectory()] /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/config: Permission denied
[INFO]    [BaseGUI] Created directory: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/config
[ERROR]   [FileSystem::createdirectory()] /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/screenshots: Permission denied
[INFO]    [BaseGUI] Created directory: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/screenshots
[INFO]    [GUIManager] Registered batch as a GUI.
[INFO]    [runSofa] Loading automatically plugin list in /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/plugin_list.conf.default
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.ODESolver.Forward.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.ODESolver.Backward.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.ODESolver.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.IO.Mesh.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.IO.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Playback.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SceneUtility.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Container.Constant.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Container.Dynamic.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Container.Grid.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Container.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Mapping.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.Utility.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Topology.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Visual.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSystem.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSolver.Iterative.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSolver.Ordering.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSolver.Direct.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSolver.Preconditioner.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.LinearSolver.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Mass.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Diffusion.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Mapping.Linear.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Mapping.NonLinear.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Mapping.MappedMatrix.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Mapping.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.StateContainer.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.Spring.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.FEM.Elastic.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.FEM.HyperElastic.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.FEM.NonUniform.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.FEM.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.TensorMass.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.SolidMechanics.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.Lagrangian.Model.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.Lagrangian.Correction.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.Lagrangian.Solver.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.Lagrangian.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.Projective.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Constraint.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.AnimationLoop.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.MechanicalLoad.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Geometry.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Detection.Algorithm.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Detection.Intersection.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Detection.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Response.Mapper.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Response.Contact.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.Response.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Collision.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Setting.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Controller.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Engine.Analyze.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Engine.Generate.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Engine.Select.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Engine.Transform.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Engine.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.Haptics.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.Component.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GL.Component.Rendering2D.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GL.Component.Rendering3D.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GL.Component.Engine.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GL.Component.Shader.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GL.Component.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GUI.Component.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GUI.Batch.so
[INFO]    [GUIManager] Registered qglviewer as a GUI.
[INFO]    [GUIManager] Registered qt as a GUI.
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/libSofa.GUI.Qt.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/plugins/SceneCreator/lib/libSceneCreator.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/plugins/ArticulatedSystemPlugin/lib/libArticulatedSystemPlugin.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/plugins/MultiThreading/lib/libMultiThreading.so
[INFO]    [PluginManager] Loaded plugin: /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/plugins/SofaMatrix/lib/libSofaMatrix.so
[INFO]    [PluginManager] 72 plugins have been loaded from /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/lib/plugin_list.conf.default
[INFO]    [GUIManager] lastUsedGUI.ini not found; using default GUI.
[WARNING] [Qt] Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
[WARNING] [Qt] Could not find the Qt platform plugin "wayland" in ""

(process:29694): Gtk-WARNING **: 22:14:09.328: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: 22:14:09.408: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:14:09.409: Failed to load module "canberra-gtk-module"
[INFO]    [SofaPluginManager] Loading automatically plugin list in /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/config/loadedPlugins.ini
[INFO]    [PluginManager] 0 plugins have been loaded from /nix/store/mn6bilp3k5c238bk5g1hs67nn9cc2m27-sofa-24.06.00/config/loadedPlugins.ini
[WARNING] [Qt] qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 0, colorSpace QColorSpace(), profile  QSurfaceFormat::CompatibilityProfile)
[WARNING] [Qt] qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 0, colorSpace QColorSpace(), profile  QSurfaceFormat::CompatibilityProfile)
[WARNING] [Qt] qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 0, colorSpace QColorSpace(), profile  QSurfaceFormat::CompatibilityProfile)
[FATAL]   [Qt] Could not initialize GLX

########## SIG 6 - SIGABRT: usually caused by an abort() or assert() ##########
  sofa::helper::BackTrace::sig(int)
  gsignal
  abort
  _Z13qErrnoWarningPKcz+0
  QOpenGLContext::create()
  QRhiGles2InitParams::newFallbackSurface(QSurfaceFormat const&)
  QBackingStoreRhiSupport::create()
  QWidgetPrivate::create()
  QWidget::create(unsigned long long, bool, bool)
  QWidgetPrivate::setVisible(bool)
  sofa::gui::qt::RealGUI::InitApplication(sofa::gui::qt::RealGUI*)
  sofa::gui::qt::RealGUI::CreateGUI(char const*, boost::intrusive_ptr<sofa::simulation::Node>, char const*)
  sofa::gui::common::GUIManager::createGUI(boost::intrusive_ptr<sofa::simulation::Node>, char const*)
  __libc_start_main
Aborted (core dumped)

@nim65s
Copy link
Contributor Author

nim65s commented Oct 17, 2024

Hum, yes, I only tested that on NixOS, sorry. I'll try on ubuntu, with x11 and wayland. I guess this is only a matter of selecting the correct QT_QPA_PLATFORM or something.

@hugtalbot
Copy link
Contributor

Hi @nim65s

Sorry for the delay in our reply, a mixture of things, including a vacation, have kept us away from the code for several days! Here we are again!
Once again thanks a lot for you very nice contribution. Have you taken another look regarding the Ubuntu issue?
During our weekly dev meeting, we discussed it and it might not be related to Nix but possibly to Wayland now by default in Ubuntu 24.04. We could therefore test with Ubuntu 22.04

Cheers

@nim65s
Copy link
Contributor Author

nim65s commented Nov 6, 2024

Hi,
I have also been away for the last 2 weeks, so couldn't test more. Yes, I suspect this is an issue with Wayland, I can probably test that on Friday. It should not matter whether ubuntu is 22.04 or 24.04.

Btw, I'll be in Lille from 25/11 to 30/11: https://wiki.2rm.cnrs.fr/AnfRust2024, same as sofa week, so we may find another discussions place there :)

@hugtalbot
Copy link
Contributor

Hi @nim65s
that would be cool to meet at this occasion, the big day for us is the Symposium on Nov 26 at Euratechnologie! If by chance you are around 🙌
Else we will have drinks and restaurant planned along the week

@nim65s
Copy link
Contributor Author

nim65s commented Nov 19, 2024

I finally got some time to spawn a 24.04 with wayland, and I could reproduce your issue.
This is caused by a discrepancy between OpenGL versions available on Nix and provided by ubuntu drivers.
This can be solved by NixGL, so I added that: nix run --impure .#nixgl is now working for me on ubuntu.

(that --impure flag is required, because the package will look at the current system to determine what OpenGL is available, and wrap things accordingly)

we use `#include <QGLViewer/qglviewer.h>`, so `QGLViewer_INCLUDE_DIR`
must not include `QGLViewer` component.

Also, on darwin, headers are installed in Headers dir, not include, ref:
https://github.com/GillesDebunne/libQGLViewer/blob/ba9a875784afbb7ee73088fe0e8701c31bc7277d/QGLViewer/QGLViewer.pro#L138
This require fixes in upstream nixpkgs:
NixOS/nixpkgs#348549

So we can use the source of that PR for now
without this, `lib/cmake/Sofa.GUI.Qt/Sofa.GUI.QtConfig.cmake` has:
> `set(SOFA_GUI_QT_HAVE_QT6 0)`

and therefore, in SofaPython3, `find_package(QGLViewer QUIET REQUIRED)`
is not called, and build ends up with:
> [ 98%] Linking CXX shared library ../../lib/python3/site-packages/Sofa/Gui.cpython-312-x86_64-linux-gnu.so
> […]/ld: cannot find -lQGLViewer: No such file or directory
TODO: This should be fixed in CMake instead, but I have no clue.

error was:
> dyld[61665]: Library not loaded: /nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib
>   Referenced from: <8B75C775-7FE5-3755-A190-B11A3F4F6666> /nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/bin/.runSofa-24.12.99-wrapped
>   Reason: tried: '/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/usr/local/lib/libSceneChecking.24.12.99.dylib' (no such file), '/usr/lib/libSceneChecking.24.12.99.dylib' (no such file, not in dyld cache)
> zsh: abort      ./result/bin/runSofa
@hugtalbot
Copy link
Contributor

Just updated the description of SOFA, else it's 👍 for me!

@hugtalbot hugtalbot added this to the v24.12 milestone Dec 4, 2024
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Dec 4, 2024
@hugtalbot hugtalbot merged commit ae42c7e into sofa-framework:master Dec 4, 2024
@hugtalbot
Copy link
Contributor

Hey @nim65s
I just run the full pipeline (to write the associated doc) and I face the error mentioned by Alex on Ubuntu v24.04 :

[FATAL]   [Qt] Could not initialize GLX

Did I forget to add any option?

@nim65s
Copy link
Contributor Author

nim65s commented Jan 13, 2025

I guess you need that :

This can be solved by NixGL, so I added that: nix run --impure .#nixgl is now working for me on ubuntu.

Another better solution is to setup https://github.com/soupglasses/nix-system-graphics beforehand, but maybe this is a bit less easy to quickly test / document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: highlighted in next release Highlight this contribution in the notes of the upcoming release pr: new feature Implement a new feature pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants