FreeCAD / FreeCAD-snap

The official Snap package of the FreeCAD project
https://snapcraft.io/freecad
10 stars 10 forks source link

OpenCamLib missing in the snap package. #116

Closed leho-l closed 1 month ago

leho-l commented 2 months ago

Is there an existing issue for this?

Problem description

Gives install opencamlib error on opening 3d surface operation in existing older file made with 0.21. Allso in a new file 3d surface operation doesnt seem to work.

Full version info

OS: Ubuntu Core 22 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 1.0.0RC1.38644 (Git) Snap 1129
Build type: Release
Branch: main
Hash: 7ed1e9380acccd686a0e3573f883ac793aec3299
Python 3.10.12, Qt 5.15.10, Coin 4.0.0, Vtk 7.1.1, OCC 7.7.1
Locale: Estonian/Estonia (et_EE)
Installed mods: 
  * PieMenu 1.8.0 (Disabled)
  * Curves 0.6.46
  * Ondsel-Lens 2024.7.5.02
  * btl 0.9.9 (Disabled)
  * Freecad-Built-in-themes-beta 1.2.2
  * OpenTheme 2024.9.1

Subproject(s) affected?

CAM

Anything else?

No response

Code of Conduct

luzpaz commented 2 months ago

Moved to FreeCAD Snap repo

luzpaz commented 2 months ago

Per https://packages.ubuntu.com/source/oracular/opencamlib looks like package name is https://packages.ubuntu.com/oracular/libopencamlib-2023.01

Where should I add it?

https://github.com/FreeCAD/FreeCAD-snap/blob/f03356c6b8c402188cf47987dc152b5b7d43cc0f/snap/snapcraft.yaml#L172-L253

In build-packages orstage-packages section ?

CC @chennes

luzpaz commented 2 months ago

CC @adrianinsaval any idea?

furgo16 commented 2 months ago

Per https://packages.ubuntu.com/source/oracular/opencamlib looks like package name is https://packages.ubuntu.com/oracular/libopencamlib-2023.01

@luzpaz indeed, the binary package name is libopencamlib-2023.01. The In build-packages section is for packages required to build the snap, whereas the stage-packages section is for packages required to run the snap.

I'm not familiar enough with CAM, and also the bug report stating "Gives install opencamlib error" is quite vague. There are no steps to reproduce in it. But my guess is that libopencamlib-2023.01 should be added to stage-packages.

furgo16 commented 2 months ago

Also one thing to notice is that libopencamlib-2023.01 seems to be available only on Ubuntu 24.04 (noble) and Ubuntu 24.10 (oracular). One would need to see which distro's archive the snap is pulling packages from. If it's not one of those, the build will probably not find the package.

It might be useful to see what the freecad-daily PPA does in this regard. Does OpenCamLib work there? And if so, which package does it pull as an install dependency? Update: at a quick glance, it does not seem to install it as a dependency. If it relies on users manually installing the package, does installing libopencamlib-2023.01 on Ubuntu 24.04 work for the PPA users?

furgo16 commented 1 month ago

One would need to see which distro's archive the snap is pulling packages from

It looks like snapcraft is pulling packages from the jammy (Ubuntu 22.04) archive. Interestingly, and if I understand it correctly, these are not the packages from the main Ubuntu archive, but from the KDE Neon archive.

https://github.com/FreeCAD/FreeCAD-snap/blob/5c8ccc1d6a5cdd87e57758107881121d06539a1e/snap/snapcraft.yaml#L125-L135

In any case, given that libopencamlib-2023.01 is only available in Ubuntu 24.04, and that the snap pulls packages from Ubuntu 22.04, it is not possible to currently ship OpenCamLib as part of the snap. It would be only possible if the apt repository definition in snapcraft.yaml is updated to noble (Ubuntu 24.04).

luzpaz commented 1 month ago

Maybe we can contact the opencamlib Ubuntu package maintainers to coordinate with them ?

adrianinsaval commented 1 month ago

can you use pip packages in snap?

adrianinsaval commented 1 month ago

Maybe we can contact the opencamlib Ubuntu package maintainers to coordinate with them ?

I don't think they can add it to older ubuntu versions at this stage. What could be doable is to add opencamlib to our ppa and then use that in the snap

furgo16 commented 1 month ago

can you use pip packages in snap?

@adrianinsaval, yes. That's how we install ifcopenshell from PyPI in the snap. If opencamlib is there, it can easily be added to the snap.

What could be doable is to add opencamlib to our ppa and then use that in the snap

If there is no other way, that would be one option. But then that introduces another dependency between the snap and upstream. I believe OCCT in the snap used to be pulled this way (via the PPA), but then it was changed to pull directly from the upstream git repository (or a mirror of). That would not work, as the apt archive the snap pulls .deb packages from is 22.04, whereas the PPA would have a 24.04 package. If the archive would be updated to be 24.04, then we'd just pull it from there instead of the PPA.

furgo16 commented 1 month ago

And it seems it's available: https://pypi.org/project/opencamlib/

@leho-l , could you try if running this command on a terminal addresses your issue in the meantime, while a conclusion is reached on how to best include it in the package?

freecad.pip install opencamlib
adrianinsaval commented 1 month ago

That would not work, as the apt archive the snap pulls .deb packages from is 22.04, whereas the PPA would have a 24.04 package. If the archive would be updated to be 24.04, then we'd just pull it from there instead of the PPA.

the ppa has freecad packages for 20.04, 22.04 and 24.04, but the occt incompatibility is a valid point.

furgo16 commented 1 month ago

Indeed, I'm using the 22.04 PPA on my laptop and the 24.04 one on my desktop. Thanks!

What I meant was that the libopencamlib-2023.01 .deb package is only available for Ubuntu 24.04. Another option would be to rebuild it and backport it to the 22.04 PPA to make it available there. Which might or might not be trivial depending on the packaging and on how opencamlib is built.

In any case, I think using the pip package is the simplest, least effort and most robust approach. I guess something like this would do:

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 37115ef..7890198 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -290,6 +290,7 @@ parts:
       - libsuitesparseconfig5 # scikit-sparse
     python-packages:
       - ifcopenshell # BIM
+      - opencamlib # CAM
       - pip
       - scikit-sparse
     stage: