Botspot / pi-apps

Raspberry Pi App Store for Open Source Projects
GNU General Public License v3.0
2.01k stars 205 forks source link

Potentially adding FreeCAD back #2299

Open Botspot opened 1 year ago

Botspot commented 1 year ago

What is the name of the app?

FreeCAD

(Optional) Where is the app hosted?

No response

About the app

User @ryanfortner shared with me some working compile commands to get the latest FreeCAD working on Bullseye arm64.

wget https://github.com/FreeCAD/FreeCAD/archive/refs/tags/0.20.2.tar.gz
tar -xvf 0.20.2.tar.gz 
rm 0.20.2.tar.gz

mv FreeCAD-0.20.2 FreeCAD-0.20.2-source
mkdir FreeCAD-0.20.2-build && cd FreeCAD-0.20.2-build

sudo apt-get install cmake build-essential libtool lsb-release python3 swig libboost-dev libboost-date-time-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libopencv-dev libproj-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev qtbase5-dev qttools5-dev libqt5opengl5-dev libqt5svg5-dev qtwebengine5-dev libqt5xmlpatterns5-dev libqt5x11extras5-dev libpyside2-dev libshiboken2-dev pyside2-tools pyqt5-dev-tools python3-dev python3-matplotlib python3-packaging python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2.qtnetwork python3-pyside2.qtwebengine python3-pyside2.qtwebenginecore python3-pyside2.qtwebenginewidgets python3-pyside2.qtwebchannel liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-ocaf-lite-dev liboce-visualization-dev oce-draw libsimage-dev doxygen libcoin-doc libspnav-dev python3-markdown python3-git libocct*-dev

sudo apt-get install pyqt5-dev
sudo apt-get install pyqt5-dev-tools
cd /usr/bin/
ln -s pyrcc5 pyside2-rcc
ln -s pyuic5 pyside2-uic

cmake ../FreeCAD-0.20.2-source -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DUSE_PYBIND11=ON
make -j4

I have not had the time to test them yet, so anyone who sees this issues is welcome to try it and report back how it went.

Confirmations

Rak1ta commented 1 year ago

@Botspot Clean install of Bullseye

Building a dependency tree... Done
Reading status information… Done
Note that "libocct-data-exchange-dev" is selected for the template "libocct*-dev"
Note that "libocct-ocaf-dev" is selected for the template "libocct*-dev"
Note that "libocct-draw-dev" is selected for the template "libocct*-dev"
Note that "libocct-visualization-dev" for the template "libocct*-dev"
Note, "libocct-foundation-dev" is selected for the template "libocct*-dev"
Note, "libocct-modeling-algorithms-dev" is selected for the template "libocct*-dev"
Note that "libocct-modeling-data-dev" is selected for the "libocct*-dev" template
The build-essential package of the newest version (12.9) is already installed. 
The lsb-release package of the newest version (11.1.0) is already installed. 
The python3 package of the newest version (3.9.2-3) is already installed.
python3 is marked as manually installed.
The python3-dev package of the newest version (3.9.2-3) is already installed.
python3-dev is marked as manually installed.
Some packages cannot be installed. Perhaps what you are asking
is not feasible, or you are using an unstable version of the distribution, where
the packages you requested have not yet been created or have been removed from Incoming.
The following information may help you:

The following packages have unsatisfied dependencies:
libocct-data-exchange-dev : Conflicts: liboce-ocaf-dev but 0.18.3-1 must be installed
Conflicts: liboce-ocaf-lite-dev but 0.18.3-1 must be installed
libocct-foundation-dev : Conflicts: liboce-foundation-dev but 0.18.3-1 must be installed
libocct-modeling-algorithms-dev : Conflicts: liboce-modeling-dev but 0.18.3-1 must be installed
libocct-modeling-data-dev : Conflicts: liboce-modeling-dev but 0.18.3-1 should be installed
libocct-ocaf-dev : Conflicts: liboce-ocaf-dev but 0.18.3-1 should be installed
Conflicts: liboce-ocaf-lite-dev but 0.18.3-1 should be installed
libocct-visualization-dev : Conflicts: liboce-visualization-dev but 0.18.3-1 should be installed
E: It is impossible to fix errors: you have fixed broken packages.
ryanfortner commented 1 year ago

Try taking out all the liboce packages from the command (don't take out the libocct ones)

ryanfortner commented 1 year ago

If we do end up adding freecad back to pi-apps, I don't think we should configure the scripts to compile the software, because it typically takes a few hours to finish on a RPi4. With that being said, I'm working on creating the deb packaging files for version 0.20.2, so I'll let you know when I'm done with that.

Rak1ta commented 1 year ago

few hours to finish on a RPi4

It took me about ~180 minutes with SSD, and another hour to install packages and build the application. https://drive.google.com/file/d/184zpBBm2jbVOpFqVzoqQG6B3R28CkppC/view?usp=share_link

Some of the files created by the installation are inside the home directory: /home
You probably don't want them to be included in the package.

I was advised by checkinstall not to include these files in the package.

theofficialgman commented 1 year ago

I don't think a deb install of freecad makes sense. the primary reason being that it will end up depending on specific versions of system libraries making it incompatible with mulitple distros (bookworm release is fast approaching). freecad also requires that QT5 be built with DesktopGL and not GLES. GLES is still used on armhf on all debian/ubuntu distros (bionic, focal, jammy, buster, bullseye, etc). GLES is also used on some older distros on ARM64 as well (bionic)

For these reasons, I would suggest packaging as an appimage like the official releases of freecad are done so that you can build QT5 with the required options (-opengl desktop) to run freecad

theofficialgman commented 1 year ago

linking open issues for reference that currently prevent an aarch64 flatpak from being made: https://invent.kde.org/packaging/flatpak-kde-runtime/-/merge_requests/55 https://invent.kde.org/packaging/flatpak-kde-runtime/-/issues/19

ryanfortner commented 1 year ago

I have no idea how to interface with app image packages so I'm just going to leave that to someone else for now.

I did manage to create a package using the Debian maintainer tools (not checkinstall) and will upload it soon

theofficialgman commented 1 year ago

alternativly, FreeCAD is rapidly porting to bring compatibility with QT6. QT6 does not have the limitations of QT5 regarding needing to compile support for OpenGL OR OpenGLES at compile time. it can be switched at runtime.

ultimately, I think the only real maintainable solution is to just leave older distros behind

ryanfortner commented 1 year ago

https://github.com/ryanfortner/ryanfortner/releases/download/1002/freecad_0.20.2-1_arm64.zip

Here is my freecad package. I just zipped all the contents of the build, but if anyone wants to test this out on their arm64 machine, just unzip it and install freecad_0.20.2-1_arm64.deb. All dependencies are automatically installed with that package.

It works great on my system.

Botspot commented 1 year ago

https://github.com/ryanfortner/ryanfortner/releases/download/1002/freecad_0.20.2-1_arm64.zip

Here is my freecad package. I just zipped all the contents of the build, but if anyone wants to test this out on their arm64 machine, just unzip it and install freecad_0.20.2-1_arm64.deb. All dependencies are automatically installed with that package.

It works great on my system.

dpkg: error processing archive /tmp/apt-dpkg-install-JXpgiX/17-freecad_0.20.2-1_arm64.deb (--unpack):
 trying to overwrite '/usr/share/icons/hicolor/scalable/apps/freecad.svg', which is also in package freecad-common 0.19.1+dfsg1-2+deb11u1

You may want to make it conflict with freecad-common.

Botspot commented 1 year ago

Also I noticed that the menu location on your deb @ryanfortner is in a different category than the default freecad package. Yours places freecad in "Education" but the freecad from apt goes in "Graphics." And I was able to make it crash.

  1. Open FreeCAD.
  2. Click on New project.
  3. Close that project from the File menu. You can also press Ctrl+F4.
  4. Now open an example project. I chose the engine one but I would expect any of them to do this.
  5. FreeCAD crashes with the following error:
    Program received signal SIGSEGV, Segmentation fault.
    #0  linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fbd7587a8]
    #1  [0x7fb0420d60]

    This does not occur when immediately opening the example project however. I am also unsure if this crash is a problem with your build process or not, @ryanfortner. I was unable to easily reproduce this in the apt default freecad 0.19 version because it did not feature any example projects to click on.

theofficialgman commented 1 year ago

are you guys allergic to building debs the proper way or something? especially when a deb already exists for freecad 0.20.2 (bookworm) just build from the dsc

mkdir freecad
cd freecad
wget http://deb.debian.org/debian/pool/main/f/freecad/freecad_0.20.2+dfsg1-4.dsc
wget http://deb.debian.org/debian/pool/main/f/freecad/freecad_0.20.2+dfsg1.orig.tar.xz
wget http://deb.debian.org/debian/pool/main/f/freecad/freecad_0.20.2+dfsg1-4.debian.tar.xz
dpkg-source -x freecad_0.20.2+dfsg1-4.dsc
cd freecad-0.20.2+dfsg1
sudo apt build-dep .
debuild -b -uc -us

or even simpler use dget

mkdir freecad
cd freecad
dget http://deb.debian.org/debian/pool/main/f/freecad/freecad_0.20.2+dfsg1-4.dsc
cd freecad-0.20.2+dfsg1
sudo apt build-dep .
debuild -b -uc -us
ryanfortner commented 1 year ago

I had no idea it was possible to rebuild packages directly from debian repositories. No need to be rude.

theofficialgman commented 1 year ago

I wasn't trying to be rude. just messing with you. sorry because it definitly came across as rude while re-reading it.

yes you can rebuild debs directly from debian/ubuntu repositories using the posted dsc files that you can access most easily from the debian and ubuntu packages web UIs (https://www.debian.org/distrib/packages https://packages.ubuntu.com/) some packages might build out of the box on older distros without any changes, others might require patching to the source, control files, rules, etc

ryanfortner commented 1 year ago

No problem. I'll see if I can build from the dsc later tonight

ryanfortner commented 1 year ago

Here is a new build using the method gman suggested: https://github.com/ryanfortner/ryanfortner/releases/download/1002/freecad-0.20.2-repackaged.zip

From within this zip, you need to install 3 packages: freecad freecad-common freecad-python3 libfreecad-xxx-xxxx

theofficialgman commented 1 year ago

just an fyi, you can also build against the dsc files from ppas too. freecad has a few official distribution methods on linux. snap, flatpak, and the ppa are all official. so it might be worth checking the ppa on a ubuntu system to see if those builds include the examples that you want to see or not https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable same goes for checking the flatpak and the snap.

theofficialgman commented 1 year ago

ah I found the reason why the examples aren't in official debian packages it is becuase of copyright issues that debian can't comply with so they patch them out https://salsa.debian.org/science-team/freecad/-/blob/master/debian/patches/do_not_install_binary_examples.patch

the ppa does not include this patch so if you built against it you wouldn't have this issue. alterantively you could revert/drop that one patch and continue to use the debian version.

ryanfortner commented 1 year ago

Here is a new build using the method gman suggested: https://github.com/ryanfortner/ryanfortner/releases/download/1002/freecad-0.20.2-repackaged.zip

From within this zip, you need to install 3 packages: freecad freecad-common freecad-python3 libfreecad-xxx-xxxx

Was anyone able to test this build? It works for me, just need a few others to test it and then I think we're good for arm64.

theofficialgman commented 1 year ago

Was anyone able to test this build? It works for me, just need a few others to test it and then I think we're good for arm64.

if you put it in a PR then we can spawn the github CI test builder on it and see if all the intended arm64 targets (ubuntu/debian) can install it. the debian build methods are generally very good at properly creating control files so if it installs then it probably works.

I am pretty doubtful an all in a one solution works though. QT has a lot of dependencies and those generally vary depending on what distro version we are talking about.

theofficialgman commented 1 year ago

I created a PPA here a few weeks ago for ubuntu LTSs, but unfortunatly even though it builds fine they don't work once you try to create an object due to QT5 being compiled with the GLES option instead of Desktop GL on bionic. I believe that buster is also affected by this

Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.
Program received signal SIGSEGV, Segmentation fault.
#0  linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fa66766c0]
#1  /usr/lib/aarch64-linux-gnu/libX11.so.6(XDefaultScreenOfDisplay+0) [0x7fa1c162f8]

https://launchpad.net/~theofficialgman/+archive/ubuntu/freecad-stable

this is the same reason as mentioned before -> https://github.com/Botspot/pi-apps/issues/2299#issuecomment-1501875365

Joe-Lay commented 1 year ago

I hate to be the guy who asks for stuff but doesn't do anything, but if you could make freecad (any recent version) work on 32-bit Raspberry OS, that would be great. Thanks no matter what you do!

Botspot commented 12 months ago

It seems like this can be progressed now with our removal of buster/bionic support.

Joe-Lay commented 12 months ago

Freecad.org has an arrch64 appimage avaliable on the downloads page. You may wnat to check it out.