FreeCAD and Raspberry Pi 4

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
User avatar
-alex-
Posts: 246
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Postby -alex- » Mon Oct 07, 2019 4:03 pm

wmayer wrote:
Mon Oct 07, 2019 4:00 pm
- try to compile Freecad 0.19 with Py2/Qt4?
The current master branch still supports Py2 and Qt4.
Ok, let's go .

Edit: haaa, I'm stuck again sorry....

I have done:

Code: Select all

pi@raspberrypi:~/freecad-build $ cmake -DCMAKE_BUILD_TYPE=Debug ../freecad-source
But:

Code: Select all

pi@raspberrypi:~/freecad-build $ cmake ../freecad-source/
-- Compiler: GNU, version: 8.3.0
-- prefix: /usr/local
-- bindir: bin
-- datadir: data
-- docdir: doc
-- includedir: include
-- libdir: lib
-- cmake: 3.13.4
-- Could NOT find PythonLibs: Found unsuitable version "3.7.3", but required is exact version "2.7.16" (found /usr/lib/arm-linux-gnueabihf/libpython3.7m.so)
CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:131 (message):
  =================================

  Python not found, install Python!

  =================================

Call Stack (most recent call first):
  CMakeLists.txt:50 (SetupPython)


-- Configuring incomplete, errors occurred!
See also "/home/pi/freecad-build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/freecad-build/CMakeFiles/CMakeError.log".
However Python2.7 is already installed:

Code: Select all

pi@raspberrypi:/ $ python2 -V
Python 2.7.16
So, I had tried with some flags:

Code: Select all

pi@raspberrypi:~/freecad-build $ cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \ -DPYTHON_INCLUDE_DIR=/usr/include/python2.7m \ -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7m.so \ -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/  ../freecad-source
But same result.
It seems that something like usr/lib/arm-linux-gnueabihf/libpython2.7m.so is missing:

Code: Select all

pi@raspberrypi:/ $ sudo find . -name  'libpython2.7*.so*'
./usr/lib/python2.7/config-arm-linux-gnueabihf/libpython2.7.so
./usr/lib/arm-linux-gnueabihf/libpython2.7.so.1
./usr/lib/arm-linux-gnueabihf/libpython2.7.so
./usr/lib/arm-linux-gnueabihf/libpython2.7.so.1.0
find: ‘./run/user/1000/gvfs’: Permission denied
pi@raspberrypi:/ $ 
Now I remember I already faced with this trouble the first time I tried to compile Freecad. That's why I had looking for workarrounds and I had abused of sudo command and used some python3 flags.

Any idea about this kind of trouble and how to compile with py2/Qt4?
Maybe should I start again from scratch with a fresh install of Raspbian?
vocx
Posts: 1867
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Postby vocx » Tue Oct 08, 2019 1:05 am

-alex- wrote:
Mon Oct 07, 2019 4:03 pm
...
Any idea about this kind of trouble and how to compile with py2/Qt4?
...
You should have the development files of Python 2 and Qt4 if you intend to compile with these. Up to now it seems you have been using Python 3, so you have these development files only. And then in your build directory you may have old cache files, so starting with a new build directory may be better, or just deleting the CMakeCache files that you find.
User avatar
-alex-
Posts: 246
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Postby -alex- » Wed Oct 09, 2019 10:34 pm

vocx wrote:
Tue Oct 08, 2019 1:05 am
You should have the development files of Python 2 and Qt4 if you intend to compile with these. Up to now it seems you have been using Python 3, so you have these development files only. And then in your build directory you may have old cache files, so starting with a new build directory may be better, or just deleting the CMakeCache files that you find.
You were perfectly right, Qt4 and some other libs were missing ;)
So I have installed missing libs folowing documentation https://www.freecadweb.org/wiki/CompileOnUnix, Debian Py2 and Qt4 chapter.
Then I started with a new build directory as you said, cmake, then make -J4 to compile Freecad Py2-Qt4, then guess what...

FreeCAD works like a charme on RPI4!! :D

Now it's time to investigate what's the mater with Py3 and/or Qt5...
It's late here, I'll give more details if it can help to investigate next days.

Below a picture, just for fun:

2019-10-10-003129_1920x1080_scrot.png
2019-10-10-003129_1920x1080_scrot.png (184.1 KiB) Viewed 575 times


Thanks a lot guys for your help!

OS: Raspbian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.19.18504 (Git)
Build type: Unknown
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 2.7.16
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
User avatar
kkremitzki
Posts: 1795
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: FreeCAD and Raspberry Pi 4

Postby kkremitzki » Wed Oct 09, 2019 10:37 pm

Great news, glad you stuck with it for the troubleshooting there.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
vocx
Posts: 1867
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Postby vocx » Wed Oct 09, 2019 10:59 pm

-alex- wrote:
Wed Oct 09, 2019 10:34 pm
...
You were perfectly right, Qt4 and some other libs were missing
...
FreeCAD works like a charme on RPI4!! :D
...
Awesome! I'm a genius!

Unfortunately, Python 2 is going to become unsupported very soon https://pythonclock.org, so trying to make it work with Python 3/Qt5 should be a priority. So, the problems are due to Coin3D and Qt5 libraries, I think. Maybe Quarter?

Internally here in FreeCAD we most probably won't be supporting Python 2 past 1st January 2020. See Python2 in FreeCAD 0.19 is being abandoned, Travis build failure.
User avatar
papy
Posts: 129
Joined: Sun Sep 09, 2018 10:00 am
Location: Moselle

Re: FreeCAD and Raspberry Pi 4

Postby papy » Thu Oct 10, 2019 6:11 am

Hi,
-alex- wrote:
Wed Oct 09, 2019 10:34 pm
FreeCAD works like a charme on RPI4!! :D
Well done Alex.
I am impressed by your success and disappointed not to be able to do so much.
See you soon
MartijnD
Posts: 2
Joined: Fri Oct 11, 2019 4:38 am

Re: FreeCAD and Raspberry Pi 4

Postby MartijnD » Fri Oct 11, 2019 4:49 am

Hello All,

Hereby I can confirm a successful build on the Pi4. I used the source of 0.18.3. As far as I can see everything is working.

Here is my short list used for installing:

Code: Select all

sudo apt install cmake build-essential libtool lsb-release 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-signals-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libopencv-dev libproj-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev qt4-dev-tools libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libpyside-dev pyside-tools python-dev python-matplotlib python-pivy python-ply python-pyside libocct*-dev occt-draw libsimage-dev doxygen libcoin-doc dh-exec libspnav-dev

wget https://github.com/FreeCAD/FreeCAD/archive/0.18.3.zip

unzip 0.18.3.zip

mkdir freecad-build

cd freecad-build

cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \ -DPYTHON_INCLUDE_DIR=/usr/include/python2.7m \ -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7m.so \ -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/  ../freecad-source
make -j4
Hope it helps someone.

Best regards and keep up the good work!
Martijn
wmayer
Site Admin
Posts: 14992
Joined: Thu Feb 19, 2009 10:32 am

Re: FreeCAD and Raspberry Pi 4

Postby wmayer » Fri Oct 11, 2019 8:16 am

Congratulations!
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD and Raspberry Pi 4

Postby Kunda1 » Fri Oct 11, 2019 2:48 pm

Awesome!
Is there anyone working on a py3 port as well ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
kkremitzki
Posts: 1795
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: FreeCAD and Raspberry Pi 4

Postby kkremitzki » Fri Oct 11, 2019 3:16 pm

I will get in touch with the Raspberry Pi people since they mentioned they can help get the package fixed in their repos. I can provide a diff of the debian directory which would be enough for them to switch the packaging to Py2/Qt4 which would at least get things working for now.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.