Compilng on Archlinux

Hello everyboby.
I have found a solution to install Pencil2D with a PKGBUILD

from the AUR.

I looked into the PKGBUILD and noticed it applies a patch to the code. Looking at the patch in details it changes very few lines.

From 41202444c1b1a5769143430066b248ce3e9b536a Mon Sep 17 00:00:00 2001
From: Benjamin Robin <***@gmail.com>
Date: Sun, 15 Sep 2013 15:42:02 +0200
Subject: [PATCH] Fix build for Archlinux

---
 src/external/linux/linux.cpp | 1 +
 src/structure/layersound.cpp | 2 --
 src/structure/layersound.h   | 3 ++-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/external/linux/linux.cpp b/src/external/linux/linux.cpp
index 5c8da7b..47012eb 100644
--- a/src/external/linux/linux.cpp
+++ b/src/external/linux/linux.cpp
@@ -18,6 +18,7 @@ GNU General Public License for more details.
 #include <QProcess>
 #include <QDir>
 #include <QString>
+#include <phonon/BackendCapabilities>
 #include "object.h"
 #include "editor.h"
 #include "mainwindow2.h"
diff --git a/src/structure/layersound.cpp b/src/structure/layersound.cpp
index ee8b95b..4db2c98 100644
--- a/src/structure/layersound.cpp
+++ b/src/structure/layersound.cpp
@@ -16,8 +16,6 @@ GNU General Public License for more details.
 #include <QtDebug>
 #include "layersound.h"
 #include "object.h"
-#include <phonon>
-//#include "unistd.h"
 
 LayerSound::LayerSound(Object* object) : LayerImage(object)
 {
diff --git a/src/structure/layersound.h b/src/structure/layersound.h
index e839518..474b200 100644
--- a/src/structure/layersound.h
+++ b/src/structure/layersound.h
@@ -21,7 +21,8 @@ GNU General Public License for more details.
 #include <QList>
 #include <QString>
 #include <QPainter>
-#include <phonon>
+#include <phonon/MediaObject>
+#include <phonon/AudioOutput>
 #include "layerimage.h"
 
 class LayerSound : public LayerImage
-- 
1.8.4


Its all about Phonon right. So it’s solving my problems.
Do you think this could bee applied to the source code or would it stop Pencil2D compiling on any other OS?

Thank you, @martin_luke

I have applied this patch to the source code.

OK cool!
Does this really work for other distributions?

Anyway, glad i could help my beloved Pencil2D and thank you all for bringing it back to life!
Hopefully i can now contribute a bit more since i can compile the code localy!

IS this the one:

https://aur.archlinux.org/packages/pencil2d-git/

??

Building it with yaourt with it still gives me the same old crappy phonon error:

In file included from src/structure/layersound.cpp:17:0:
src/structure/layersound.h:24:18: fatal error: phonon: No such file or directory
#include ^
compilation terminated.
make: *** [.obj/layersound.o] Error 1

 

Using Manjaro Linux. I do yaourt pencil2d-git:

1 aur/evolus-pencil-svn 352-1 (94)
Sketching and GUI prototyping tool
2 aur/pencil 2.0.5-1 (58)
Sketching and GUI prototyping tool
3 aur/pencil-svn 382-2 (104)
Animation/drawing software, that lets you create traditional hand-drawn
animation using both bitmap and vector graphics
4 aur/pencil2d-git 883.2d08386-2 (0)
Animation/drawing software, that lets you create traditional hand-drawn
animation using both bitmap and vector graphics
5 aur/pencilanimation 0.9.7-2 (4)
Animation/drawing software, that lets you create traditional hand-drawn
animation using both bitmap and vector graphics. This is the clash-version
which implements flash & AVI/OGG export.
==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)
==> -------------------------------------------------------
==> 4

==> Downloading pencil2d-git PKGBUILD from AUR...
x pencil2d-build.patch
x pencil.desktop
x PKGBUILD
x pencil2d-help.patch
x pencil2d.install
pencil2d-git 883.2d08386-2 (Sun Sep 15 14:29:29 UTC 2013)
( Unsupported package: Potentially dangerous ! )
==> Edit PKGBUILD ? [Y/n] ("A" to abort)
==> ------------------------------------
==> n

==> pencil2d-git dependencies:
- qt4 (already installed)
- ming (already installed)
- phonon (already installed)
- ffmpeg (already installed)
- git (already installed)

==> Edit pencil2d.install ? [Y/n] ("A" to abort)
==> --------------------------------------------
==> n

==> Continue building pencil2d-git ? [Y/n]
==> --------------------------------------
==>
==> Building and installing package
==> Making package: pencil2d-git 883.2d08386-2 (Tue Oct 22 13:27:32 UTC 2013)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Cloning pencil2d git repo...
Cloning into bare repository '/tmp/yaourt-tmp-fox/aur-pencil2d-git/pencil2d'...
remote: Counting objects: 6015, done.
remote: Compressing objects: 100% (1867/1867), done.
remote: Total 6015 (delta 4265), reused 5845 (delta 4105)
Receiving objects: 100% (6015/6015), 20.55 MiB | 384.00 KiB/s, done.
Resolving deltas: 100% (4265/4265), done.
Checking connectivity... done
-> Found pencil2d-build.patch
-> Found pencil2d-help.patch
-> Found pencil.desktop
==> Validating source files with md5sums...
pencil2d ... Skipped
pencil2d-build.patch ... Passed
pencil2d-help.patch ... Passed
pencil.desktop ... Passed
==> Extracting sources...
-> Creating working copy of pencil git repo...
Cloning into 'pencil2d'...
done.
==> Starting pkgver()...
==> Updated version: pencil2d-git 959.0e56cf4-1
==> Starting prepare()...
patching file src/external/linux/linux.cpp
Reversed (or previously applied) patch detected! Assume -R? [n] y
patching file src/structure/layersound.cpp
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #1 succeeded at 16 with fuzz 2.
patching file src/structure/layersound.h
Reversed (or previously applied) patch detected! Assume -R? [n] y
patching file src/interface/mainwindow2.cpp
Hunk #1 succeeded at 1125 (offset 92 lines).
==> Starting build()...
==> Starting qmake...
==> Starting make...
Makefile:796: warning: overriding recipe for target 
ui_mainwindow2.h'
Makefile:786: warning: ignoring old recipe for target ui_mainwindow2.h'
Makefile:800: warning: overriding recipe for target ui_shortcutspage.h'
Makefile:790: warning: ignoring old recipe for target ui_shortcutspage.h'
Makefile:803: warning: overriding recipe for target ui_colorinspector.h'
Makefile:793: warning: ignoring old recipe for target ui_colorinspector.h'
/usr/lib/qt4/bin/uic src/interface/mainwindow2.ui -o ui_mainwindow2.h
/usr/lib/qt4/bin/uic src/interface/shortcutspage.ui -o ui_shortcutspage.h
/usr/lib/qt4/bin/uic src/interface/colorinspector.ui -o ui_colorinspector.h

Selecting “n” on the patching step makes it fail to build before it even begins.

I am sorry but someone needs to update the script or fix the damn compiler errors. Otherwise most of us cant get it working on most distros.

 

Ok so apparently removing the patches from the PKGBUILD script sorts out the problem with phonon. Please update your script at AUR, as the patches are now in pencil git anyway (linux.cpp).

https://github.com/pencil2d/pencil/blob/master/src/external/linux/linux.cpp

Done!

Sorry for the late answer.

I’m experiencing issues compiling again. I can install with yaourt but compiling fails.
Did something change about the phonon files again??? I get the errors i used to have… Any clue?

This is what i get. Yaourt works fine. But i cant build from source. Freaky!

[otto@tuxrider pencil]$ qmake
Project ERROR: Unknown module(s) in QT: phonon
[otto@tuxrider pencil]$ qmake-qt4
WARNING: OBJECTS_DIR: Cannot access directory '.obj'
WARNING: PRECOMPILED_DIR: Cannot access directory '.obj'
WARNING: moc_header: Cannot access directory '.moc'
WARNING: moc_header: Cannot access directory '.moc'
WARNING: moc_header: Cannot access directory '.moc'
WARNING: moc_header: Cannot access directory '.moc'
WARNING: moc_header: Cannot access directory '.moc'
...
WARNING: moc_source: Cannot access directory '.moc'
WARNING: moc_source: Cannot access directory '.moc'

WARNING: moc_source: Cannot access directory '.moc'
WARNING: moc_source: Cannot access directory '.moc'
WARNING: moc_source: Cannot access directory '.moc'
WARNING: moc_source: Cannot access directory '.moc'
WARNING: moc_source: Cannot access directory '.moc'
Failure to open file: /home/otto/myGits/pencil/Makefile
Unable to generate makefile for: /home/otto/myGits/pencil/pencil.pro
[otto@tuxrider pencil]$

Here is the same with a sudo in case it could of helped.

[otto@tuxrider pencil]$ sudo qmake-qt4
[otto@tuxrider pencil]$ sudo make
g++ -c -pipe -g -D_REENTRANT -Wall -W -DQT_PHONON_LIB -DQT_SVG_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4/QtSvg -I/usr/include/qt4/phonon -I/usr/include/qt4 -I. -Isrc -Isrc/external/flash -Isrc/graphics -Isrc/graphics/bitmap -Isrc/graphics/vector -Isrc/interface -Isrc/structure -Isrc/tool -Isrc/util -Isrc/ui -I. -Iliblinux -Isrc/external/linux -I/usr/include/qt4/phonon_compat -I.moc -I. -o .obj/layersound.o src/structure/layersound.cpp
In file included from src/structure/layersound.cpp:17:0:
src/structure/layersound.h:24:18: erreur fatale: phonon : Aucun fichier ou dossier de ce type
#include ^
compilation terminée.
Makefile:836: recipe for target '.obj/layersound.o' failed
make: *** [.obj/layersound.o] Error 1
[otto@tuxrider pencil]$ 

I don’t understand why yaourt can compile and i can’t?
Isn’t that strange?
Or maybe am i missing something really basic?
Please help me. As long as i can’t compile on my machine i can’t contribute… NOT FUN !!!

See Ya :slight_smile:

Well it all works again.
I guess updating my code did the best! Noob with git, but still I can’t believe I didn’t manage to update my code with the main repo…
Anyway ! Ready for duty now!

@martin_luke… glad for you
Now you can help with your feedback!

Feedback is : Oh my god i didn’t understand git at all!!! I fetched upstream on my local repo but never pushed it to my github repo. Then i would sync with github again and more or less cancel what i just did. LAME!
So my fork being just a little older than the fix in the code for archlinux and phonon issues i just compiled the same old buggy code again and again… NOOB!!!
Git is a brilliant software but not very easy to work out at first, IMHO. Need some developers skills before you even code IMVHO.
Anyway got it working!

The thing is that you can’t update directly your remote repo with the master branch off a project. You download newest version to your locale repo and push that back to your remote repo.
Just got to get to understand that and your go!

Oh and another thing is that the archlinux community is very very patient! XD