Fwd: FreeCAD snap on ubuntu
Loïc Minier
loic.minier at ubuntu.com
Thu Jun 2 14:22:03 UTC 2016
Hi,
I wanted to share this testimony from Jean-Marie Verdun (vejmarie) on how
he successfully created a snap for the FreeCAD desktop app :-)
Cheers,
- Loïc
---------- Forwarded message ----------
From: Jean-Marie Verdun <jean-marie.verdun at splitted-desktop.com>
Cc: ocp-telcos at lists.opencompute.org, "
opencompute-server at lists.opencompute.org" <
opencompute-server at lists.opencompute.org>, "ocp-europe at lists.opencompute.org"
<ocp-europe at lists.opencompute.org>
Hi Loic,
Thanks for the test. I will have a look to the python issue that you face.
I soon have identified from where it comes. It is probably due to the way I
am building the package which is not the right one at the present time.
Currently the process is the following:
- I am starting a fresh new vagrant xenial VM
- I am installing on it the build environment
- The I start to build FreeCAD dependency with a build target within
/opt/local/FreeCAD-0.17 which is quite unusual
- I create deb packages based on incremental changes within this directory
( there is 3 majors libraries there, the libMED, VTK, OCCT )
- Then I compile FreeCAD and install it into /opt/local/FreeCAD-0.17
- I create the .deb
- I generate the snapcraft.yaml based on the "binary" files created within
the target and use the copy tool from snapcraft to stage the snap
- Then I kick the snapcraft command to build the snap
The usual process will be normally to add the dependencies within the snap
and let snapcraft build them, but the options used and the complexity of
them make the whole process quite complex.
I discussed all of this with the developpers on IRC, and we are trying to
improve the process.
Regarding the issues I faced here they are:
- locales
- GDK and GTK errors
- DRI error for 3D engines
- Python error
- Temporary files location error (the devmode stuff)
Hopefully all of them have been addressed using the proper application
launcher wrapper through environment variables. I have been helped for the
locale (thanks to orga)
Here is my launcher
I had to add FREECAD_USER_DATA to FreeCAD source tree to relocate the
.FreeCAD directory. This is the only modification which was needed
upstream. So the way python is installed currently is insane as it is done
by copying files by hand (while I should probably add the dependancy within
the parts area into snapcraft.yaml)
The other issue I am facing now is to insert all of this stuff within
FreeCAD CI which is using travis. travis is still providing trusty as build
environment, this is getting old stuff, and I had to switch to vagrant, but
the build is currently done in single cpu due to a kernel bugs with
Virtualbox, so it is taking a crazy amount of time.
Everything will be improved in the near futur, but I am soon quite happy to
see this stuff working (in the end we have a full 3D engine there)
vejmarie
#!/bin/bash
export I18NPATH=$SNAP/usr/share/i18n
export LOCPATH=$SNAP_USER_DATA
LANG=en_US
ENC=UTF-8
LOC="$LANG.$ENC"
# generate a locale so we get properly working charsets and graphics
if [ ! -e $SNAP_USER_DATA/$LOC ]; then
$SNAP/usr/bin/localedef --prefix=$SNAP_USER_DATA -f $ENC -i $LANG
$SNAP_USER_DATA/$LOC
fi
export LC_ALL=$LOC
export LANG=$LOC
export LANGUAGE=${LANG%_*}
env >& $SNAP_USER_DATA/env
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/x86_64-linux-gnu/dri
export GTK_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules
export
LD_LIBRARY_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules:$LD_LIBRARY_PATH
export GTK_DATA_PREFIX=$SNAP_USER_DATA
export GTK_EXE_PREFIX=$SNAP/usr
export
GDK_PIXBUF_MODULE_FILE=$SNAP/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
export PYTHONHOME="$SNAP/usr"
export PYTHONPATH="$SNAP/usr"
export XDG_DATA_DIR="$SNAP/usr/share/glib-2.0/schemas"
export GSETTINGS_SCHEMA_DIR="$SNAP/usr/share/glib-2.0/schemas"
export LANG=en_US.UTF-8
export FREECAD_USER_DATA="$SNAP_USER_DATA"
export XDG_CONFIG_HOME="$SNAP_USER_DATA"
exec "$SNAP/opt/local/FreeCAD-0.17/bin/FreeCAD" -u $SNAP_USER_DATA/user.cfg
-s $SNAP_USER_DATA/system.cfg "$@"
Le 02/06/2016 à 00:12, Loïc Minier a écrit :
Hi,
On Tue, May 31, 2016 at 11:21 PM, Jean-Marie Verdun <
<jean-marie.verdun at splitted-desktop.com>
jean-marie.verdun at splitted-desktop.com> wrote:
>
> https://myapps.developer.ubuntu.com/dev/click-apps/share/09951e1397a86ca9243bebcd715373197c702839fe5c5f9b8f1b5db81767306df0eb07698f8a6b3ac0c4/
>
Worked like a charm and without devmode! I even removed ~/.FreeCAD and some
other files to get to as clean a state as before my first install, and this
time things went flawlessly.
> You still need to configure the interfaces whatever happens FreeCAD needs
> write access to a directory and read access to get input files.
>
Yup
> The shared link is the same than before can you confirm me that it will
> download Rev 2 ?
>
I did get rev 3 actually, which I guess you uploaded in the mean time. :-)
> If it works I will propose some adaptation upstream to the FreeCAD team to
> properly support snappy.
>
Awesome :-)
If you have the time to write a bit about how you initially built FreeCAD
and how you created the snap, I'd love to share these with the snappy
community and developers (both to share your tips and to smoothen the parts
which were hard to achieve).
PS: I did get a couple of tracebacks when using the plot tool – I'm
guessing missing bits for the full feature set to be available:
===========
Running the Python command 'Plot_Axes' failed:
Traceback (most recent call last):
File "/snap/freecad/100001/opt/local/FreeCAD-0.17/Mod/Plot/PlotGui.py",
line 58, in Activated
import plotAxes
[...]
File
"/snap/freecad/100001/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py",
line 1026, in __init__
paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
File "/snap/freecad/100001/usr/lib/python2.7/posixpath.py", line 70, in
join
elif path == '' or path.endswith('/'):
'NoneType' object has no attribute 'endswith'Running the Python command
'Plot_Axes' failed:
[...]
File
"/snap/freecad/100001/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py",
line 1026, in __init__
paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
File "/snap/freecad/100001/usr/lib/python2.7/posixpath.py", line 70, in
join
elif path == '' or path.endswith('/'):
'NoneType' object has no attribute 'endswith'
===========
Cheers,
- Loïc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160602/d37f58e2/attachment.html>
More information about the Snapcraft
mailing list