Request for expert advice on ebuilds and Qt [Solved]

Anything that pertains to Portage

Moderator: Moderators

Request for expert advice on ebuilds and Qt [Solved]

Postby Fitzcarraldo » Wed Oct 10, 2007 0:01

Are you an expert in creating your own ebuilds, and/or and expert in using Qt? If so, I'd appreciate your advice.

I'm having a go at building an application that is not currently in Portage. The application is K3DSurf, which you can read about on the following Web page:

http://k3dsurf.sourceforge.net/

Now, I found an unofficial ebuild for k3dsurf-0.6.2.1 in the Gentoo Bugzilla:

Code: Select all
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit kde qt3

DESCRIPTION="k3dsurf"
HOMEPAGE="http://k3dsurf.sf.net/"

SRC_URI="mirror://sourceforge/${PN}/${P}-Unstable.zip"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~ppc ~sparc"
DEPEND="$(qt_min_version 3.3)"

S="${WORKDIR}/${P}-Unstable"

need-kde 3.3

src_compile() {
   qmake || die
   emake || die
}

src_install() {
   dobin bin/k3dsurf
   dodoc README COPYING
   insopts -o root -g root -m 644
   insinto /usr/share/pixmaps/k3dsurf
   doins icon/*
   make_desktop_entry k3dsurf "3-6D Mathematical model visualization" k3dsurf/catenoid_mini_32x32.png
}


In order to add my own ebuild, I needed to create my own overlay, so I added the following line to /etc/make.conf:

Code: Select all
PORTDIR_OVERLAY=/usr/local/portage


I then created the directory /usr/local/portage/sci-mathematics/k3dsurf/ and created the following ebuild file containing the above-mentioned source:

/usr/local/portage/sci-mathematics/k3dsurf/k3dsurf-0.6.2.1.ebuild

Before you can emerge a package you have added to your overlay, you have to create a manifest file for it. So I did the following:

Code: Select all
ebuild /usr/local/portage/sci-mathematics/k3dsurf/k3dsurf-0.6.2.1.ebuild manifest


which worked correctly.

Then I checked to see if the ebuild was detectable:

Code: Select all
localhost k3dsurf # emerge -s k3dsurf
Searching...
[ Results for search key : k3dsurf ]
[ Applications found : 1 ]

*  sci-mathematics/k3dsurf
      Latest version available: 0.6.2.1
      Latest version installed: [ Not Installed ]
      Size of files: 1,329 kB
      Homepage:      http://k3dsurf.sf.net/
      Description:   k3dsurf
      License:       GPL-2

localhost k3dsurf # emerge -pv k3dsurf

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] sci-mathematics/k3dsurf-0.6.2.1  USE="arts xinerama -debug" 0 kB [1]

Total: 1 package (1 new), Size of downloads: 0 kB
Portage tree and overlays:
 [0] /usr/portage
 [1] /usr/local/portage
localhost k3dsurf #


which looked 'good to go', so I decided to perform the emerge:

Code: Select all
localhost k3dsurf # emerge -v k3dsurf

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] sci-mathematics/k3dsurf-0.6.2.1  USE="arts xinerama -debug" 0 kB [1]

Total: 1 package (1 new), Size of downloads: 0 kB
Portage tree and overlays:
 [0] /usr/portage
 [1] /usr/local/portage

>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) sci-mathematics/k3dsurf-0.6.2.1 to /
 * k3dsurf-0.6.2.1-Unstable.zip MD5 ;-) ...                               [ ok ]
 * k3dsurf-0.6.2.1-Unstable.zip RMD160 ;-) ...                            [ ok ]
 * k3dsurf-0.6.2.1-Unstable.zip SHA1 ;-) ...                              [ ok ]
 * k3dsurf-0.6.2.1-Unstable.zip SHA256 ;-) ...                            [ ok ]
 * k3dsurf-0.6.2.1-Unstable.zip size ;-) ...                              [ ok ]
 * checking ebuild checksums ;-) ...                                      [ ok ]
 * checking auxfile checksums ;-) ...                                     [ ok ]
 * checking miscfile checksums ;-) ...                                    [ ok ]
 * checking k3dsurf-0.6.2.1-Unstable.zip ;-) ...                          [ ok ]
>>> Unpacking source...
>>> Unpacking k3dsurf-0.6.2.1-Unstable.zip to /var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/work
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/work/k3dsurf-0.6.2.1-Unstable ...
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
uic: File generated with too old version of Qt Designer
File 'newwindow2.ui' is not valid
make[1]: *** [ui_newwindow2.h] Error 1
make[1]: *** Waiting for unfinished jobs....
uic: File generated with too old version of Qt Designer
File 'IsoWindow.ui' is not valid
make[1]: *** [ui_IsoWindow.h] Error 1
uic: File generated with too old version of Qt Designer
File 'k3dsurf.ui' is not valid
make[1]: *** [ui_k3dsurf.h] Error 1
make: *** [sub-src-make_default] Error 2
 *
 * ERROR: sci-mathematics/k3dsurf-0.6.2.1 failed.
 * Call stack:
 *                ebuild.sh, line 1687:  Called dyn_compile
 *                ebuild.sh, line 1025:  Called qa_call 'src_compile'
 *                ebuild.sh, line   44:  Called src_compile
 *   k3dsurf-0.6.2.1.ebuild, line   22:  Called die
 * The specific snippet of code:
 *      emake || die
 *  The die message:
 *   (no error message)
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/temp/build.log'.
 * This ebuild is from an overlay: '/usr/local/portage/'
 *

 * Messages for package sci-mathematics/k3dsurf-0.6.2.1:

 *
 * ERROR: sci-mathematics/k3dsurf-0.6.2.1 failed.
 * Call stack:
 *                ebuild.sh, line 1687:  Called dyn_compile
 *                ebuild.sh, line 1025:  Called qa_call 'src_compile'
 *                ebuild.sh, line   44:  Called src_compile
 *   k3dsurf-0.6.2.1.ebuild, line   22:  Called die
 * The specific snippet of code:
 *      emake || die
 *  The die message:
 *   (no error message)
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/temp/build.log'.
 * This ebuild is from an overlay: '/usr/local/portage/'
 *
localhost k3dsurf #


As you can see above, the build failed due to a problem with Qt. I contacted the author of K3DSurf and he told me "Your compilation issue comes from your Qt version: K3DSurf compiles only with Qt3.x not Qt4.x. You should install qt3.6 or qt3.7 and things will be ok."

Now, I currently have qt-4.3.1-r1 and qt-3.3.8-r4 installed. There is no qt-3.6 or qt-3.7 in Portage. But the ebuild source specifies the build-time dependency DEPEND="$(qt_min_version 3.3)", and I wondered whether this is not picking up even qt-3.3.8-r4, given the following:

Code: Select all
localhost k3dsurf # DEPEND="$(qt_min_version 3.3)" && echo $DEPEND
bash: qt_min_version: command not found


Anyway, if you are an expert in ebuilds and/or Qt, I would appreciate your advice on how to proceed. Many thanks.
Last edited by Fitzcarraldo on Thu Oct 18, 2007 19:56, edited 1 time in total.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7978
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Request for expert advice on ebuilds and Qt

Postby Fitzcarraldo » Thu Oct 11, 2007 0:02

Some progress:

I modified the K3DSurf ebuild (see the source in my first post) as follows:

Code: Select all
#DEPEND="$(qt_min_version 3.3)"
DEPEND="<=x11-libs/qt-3.3.7"


and then emerge -v k3dsurf successfully builds qt-3.3.4-r8 but then fails to compile K3DSurf, with the same error message as before ("uic: File generated with too old version of Qt Designer").

I'll now have a go with:

Code: Select all
#DEPEND="$(qt_min_version 3.3)"
DEPEND="<=x11-libs/qt-3.3.8-r4"


on the off chance that K3DSurf will build with that version of Qt despite what the author said about qt3.6 or qt3.7 but, if not, it looks like I'm going to have to download the qt-3.3.6 (or qt-3.3.7) tarball from the Trolltech Web site and create an ebuild for qt-3.3.6 first. It's a pity that the ebuilds for Qt in Portage are only for versions 4.3.2, 4.3.1-r1, 4.3.1, 4.3.0-r2, 3.3.8-r4, 3.3.8-r3 and 3.3.4-r8.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7978
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Request for expert advice on ebuilds and Qt

Postby Fitzcarraldo » Tue Oct 16, 2007 23:33

I have now tried:

Code: Select all
#DEPEND="$(qt_min_version 3.3)"
DEPEND="<=x11-libs/qt-3.3.8-r4"


and the build still fails with the same error message "uic: File generated with too old version of Qt Designer".

I think I'll call it a day. I have decided I don't want to create an ebuild for qt-3.3.6 or qt-3.3.7 as I don't want to risk the possibility of messing up any existing runtime dependencies by other applications (qt-4.3.1-r1 and qt-3.3.8-r4 are both currently installed on my PC). It's a pity that the author of K3DSurf did not use a more-recent version of Qt in his source code; I hope he does in future if he updates the application. Anyway, this exercise has definitely not been a waste of time for me as it has helped me learn about local overlays and creating my own ebuilds. I have already put what I have learned to good use today, as I built a driver for a Canon Pixma MP510 printer using my local overlay and a couple of ebuilds from the Gentoo Bugzilla (the procedure I used is given in the thread viewtopic.php?f=56&t=10310).
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7978
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Request for expert advice on ebuilds and Qt

Postby DontPanic » Wed Oct 17, 2007 21:46

I can't resist a challenge.

I found some help on compiling in a mixed qt3/qt4 environment in a different project here:

http://freecycle.redsteamrecords.com/faq/

But you need to substitute the path's with Sabayon's locations for qt3 binaries: /usr/qt/3/bin

I couldn't get it to compile with emerge, I guess I'm just not good enough with passing environment variables to emerge, but I was able to dump the source into a directory and get it to successfully compile and run. I didn't install it, just ran it from the bin directory where I built it.

I did something like this:
Code: Select all
cd /usr/local/src/
unzip /usr/portage/distfiles/k3dsurf-0.6.2.1-Unstable.zip
cd k3dsurf-0.6.2.1-Unstable
PATH=/usr/qt/3/bin:$PATH
export QTDIR=/usr/qt/3/
qmake
make
./bin/k3dsurf &


Make sure and remove your Makefiles as indicated in the web link if you've already run qt4's qmake on the source.
Gigabyte GA-P35-DS3L - Intel(R) Core(TM)2 Duo CPU E6750@ 2.66GHz
nVidia GeForce 7600 GS
2 GB RAM
DontPanic
Old Dear Hen
 
Posts: 742
Joined: Mon Jul 09, 2007 20:29
Location: Mobile, AL, USA

Re: Request for expert advice on ebuilds and Qt

Postby voxiac » Wed Oct 17, 2007 22:29

I'm certainly not an expert, but if you change the ebuild like so:
Code: Select all
--- k3dsurf-0.6.2.1.ebuild.old   2007-10-17 23:12:39.000000000 +0200
+++ k3dsurf-0.6.2.1.ebuild   2007-10-17 23:08:13.000000000 +0200
@@ -18,7 +18,7 @@
 need-kde 3.3
 
 src_compile() {
-   qmake || die
+   eqmake3 || die
    emake || die
 }

it should compile. (anyways it did compile on my system)
The difference is that you use Gentoo wrapper around qmake instead of 'raw' qmake.
Also keep in mind that this
Fitzcarraldo wrote:
Code: Select all
localhost k3dsurf # DEPEND="$(qt_min_version 3.3)" && echo $DEPEND
bash: qt_min_version: command not found

is to be expected since qt_min_version is typically not defined globally in the environment of the interactive shell (at least this is how I understand it, so keep in mind that this explanation could be complete rubbish). It works in the ebuild because it explicitly imports ('inherits') qt3 eclass (/usr/portage/eclass/qt3.eclass) where that function is defined (just as 'eqmake3').
voxiac
Advanced Hen
 
Posts: 218
Joined: Sat Feb 10, 2007 17:05
Location: Denmark

Re: Request for expert advice on ebuilds and Qt

Postby DontPanic » Thu Oct 18, 2007 0:05

I gave up too easily earlier.

I was able to get the ebuild that Fitzcarraldo posted working by adding a few environment variables:

Code: Select all
# diff -u k3dsurf-0.6.2.1.ebuild.fitzcarraldo k3dsurf-0.6.2.1.ebuild
--- k3dsurf-0.6.2.1.ebuild.fitzcarraldo 2007-10-17 17:11:52.000000000 -0500
+++ k3dsurf-0.6.2.1.ebuild      2007-10-17 17:51:57.000000000 -0500
@@ -15,6 +15,9 @@

 S="${WORKDIR}/${P}-Unstable"

+PATH=/usr/qt/3/bin:$PATH
+QTDIR=/usr/qt/3
+
 need-kde 3.3

 src_compile() {
Gigabyte GA-P35-DS3L - Intel(R) Core(TM)2 Duo CPU E6750@ 2.66GHz
nVidia GeForce 7600 GS
2 GB RAM
DontPanic
Old Dear Hen
 
Posts: 742
Joined: Mon Jul 09, 2007 20:29
Location: Mobile, AL, USA

Re: Request for expert advice on ebuilds and Qt

Postby Fitzcarraldo » Thu Oct 18, 2007 15:26

:thumleft: Many thanks for your replies, guys! I had thought that no one was interested.

The voxiac Solution

First I tried voxiac's solution. The ebuild ran to completion, with only a couple of (identical) error messages, one after the other:

Code: Select all
QSettings: error creating /var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/homedir/.qt
QSettings: error creating /var/tmp/portage/sci-mathematics/k3dsurf-0.6.2.1/homedir/.qt


The application launched. Excellent! I did notice that, when I clicked on 'About' in the application's menu bar, most of the line giving the Web address of K3DSurf's forum was cut off. But otherwise everything in the application seemed to work.


The DontPanic Solution

Then I un-emerged k3dsurf and tried DontPanic's solution. The ebuild ran to completion, and the two above-mentioned error messages did not appear.

The application launched. Excellent yet again! Interestingly, when I clicked on 'About' in the application's menu bar, all of the line giving the Web address of K3DSurf's forum was visible. Everything else seemed to work too.


------------------------------------

Bravo (and thanks again) to both you guys! I shall try to post an updated ebuild on the Gentoo Bugzilla, and I'll also inform k3DSurf's author, as I had been in correspondence with him about trying to compile K3DSurf.


EDIT: I've subsequently found that K3DSurf built 'the DontPanic way' also sometimes does not exhibit all of the line giving the Web address of K3DSurf's forum when I click About in the menu bar, so there is no difference in the result between the two methods. (By the way, K3DSurf is great fun for visualising mathematical functions in 3D, and it uses OpenGL too.)
Last edited by Fitzcarraldo on Fri Oct 19, 2007 0:11, edited 2 times in total.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7978
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Request for expert advice on ebuilds and Qt

Postby DontPanic » Thu Oct 18, 2007 16:26

My solution was more of a work-around. I like voxiac's suggestion to use eqmake3 because it is more explicit, and doesn't involve specifying directories that may change in the future.

Basically, by modifying the PATH variable, I am tricking the compiler into finding the qt3 files before running across any qt4 files. I am assuming that is the function of qmake3 also, but it achieves that in a more explicit way.
Gigabyte GA-P35-DS3L - Intel(R) Core(TM)2 Duo CPU E6750@ 2.66GHz
nVidia GeForce 7600 GS
2 GB RAM
DontPanic
Old Dear Hen
 
Posts: 742
Joined: Mon Jul 09, 2007 20:29
Location: Mobile, AL, USA


Return to Portage|Emerge Package Managers

Who is online

Users browsing this forum: No registered users and 2 guests