Tuesday, January 28, 2014

Fixing Cura broken linux packages (slicing fails silently)

How to build Cura's slicer "SteamEngine" from scratch

Cura releases for Linux are often broken, probably because the author better implements features than packages (which is a good thing!) and because supporting Windows and MacOS is already painful enough ;)

One of the last issues kept happening due to the linux package made only for 64 bit architectures, which is stated nowhere and not checked during installation. So slicing cannot run when your PC is running a 32 bit linux OS. The easiest fix is to rebuild the slicer, which is a piece of cake compared to 3D printing!

Update (jan, 2014): full instructions on how to build Cura from scratch (see the last chapter).



Cura compiled at home for Linux (no more version in the title bar?)

Note that the remaining interactive part of the application is fully functional though, because it is written in portable and machine-agnostic Python. The slicer needs C++, which also explains why it is much faster than the old and terrific skeinforge slicer. Skip to the last chapter of this post if you want to compile the whole Cura latest project instead.

Still, it is relatively easy to fix the issue, by downloading and installing the "deb" package as usual, then compiling the slicing engine on your platform and for your platform, and use the resulting executable instead of the provided one.

Default installation


Install the default package (mostly python Cura GUI). You probably have done it, else you can check the lastest build from Ultimaker website (the kind sponsor behind opensource Cura). If you would better also go with the latest Cura GUI, check the last chapter below!
cd /tmp 
wget http://software.ultimaker.com/old/Cura-13.12-debian.debsudo 
dpkg -i Cura-13.12-debian.deb

Getting and building the 3D slicing engine


Now we will rebuild SteamEngine, which is Cura's very capable and fast slicer. Building may complain about missing development libraries, in which case you will have to install them with apt-get (eg. build-essential and some other *-dev libraries, look for them using google). If you do not have git on your system, you can get a zip file of the project by using the button in the right margin on github.
cd /tmpgit 
clone https://github.com/Ultimaker/CuraEngine 
cd CuraEngine/ 
make

Installing your own build of the slicer


When OK, you should see a fresh new homemade SteamEngine executable file in the folder. Now check where your Cura is installed, eg. with:
find $(which cura) -name CuraEngine
And overwrite your engine (my existing 64 bit version was /usr/share/cura/CuraEngine):
sudo cp CuraEngine /usr/share/cura/CuraEngine
You should now be OK to run Cura entirely.

By the way, the source code of SteamEngine is quite neat, and it justs makes me feel I want to hack it all everywhere :p

Or build Cura from the whole source code, Luke

Only if you really want the latest versions of Cura and the slicer, e.g. when the prepackaged Cura gets "too" old for the new features you really need to try, then you can download the zipped source directly from the developer github account. Note that this now comes bundled with SteamEngine (aka CuraEngine), so you won't need to compile it specifically, as described above.

Be well aware though that the latest build may be unstable !

Still, I would recommend to use git instead, so it can easily keep up with subsequent development. Just use the following (and then, git pull for the updates):
git clone https://github.com/daid/Cura.git
Now you need a few debian/ubuntu packages to be able to build. I recorded only those that were missing on my machine, there are probably a few others (tell me!)
sudo apt-get install python-opengl python-wxgtk2.8
Some more annoying dependencies (check also the provided file requirements.txt)
pushd /tmp
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python
wget https://github.com/GreatFruitOmsk/Power/archive/master.zip 
unzip master.zip 
cd Power-master/ 
sudo python setup.py install
popd 
Back into Cura git folder. Compile the engine: I got some errors but they were not blocking for now. If or when they get critical, I would compile CuraEngine separately like in the previous chapter. On its side, the Cura GUI is pure Python so it may run straight out of the box.
./package.sh
Update: the above script may ask you for your architecture... and may fail. In this case, better build SteamEngine manually:
cd CuraEngine
make clean; make

Finally, probably due to security measures, Cura needs to run the binary engine from a regular system folder. I solved it with a dumb symlink:
sudo ln -s $(pwd)/CuraEngine/CuraEngine /usr/bin/
And finally I run it like this, still from the same folder:
python -m Cura.cura
Now, whenever you want to update your build, just go to Cura folder, do a git pull then ./package.sh and you should be ok (as for Jan, 2014).

Finally: the official developer documentation is here: https://github.com/daid/Cura

No comments:

Post a Comment