Bug 381827 - DCMAKE_BUILD_TYPE=Release creates debug version
Summary: DCMAKE_BUILD_TYPE=Release creates debug version
Status: RESOLVED FIXED
Alias: None
Product: kaffeine
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Mauro Carvalho Chehab
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-30 13:32 UTC by Tuxo
Modified: 2017-07-31 00:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
cmake log (51.66 KB, text/plain)
2017-06-30 13:32 UTC, Tuxo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tuxo 2017-06-30 13:32:37 UTC
Created attachment 106391 [details]
cmake log

Hello,

I build kaffeine 2.0.10 from git and choose DCMAKE_BUILD_TYPE=Release instead of Debug. I still end up with tons of log output labeled as "timestamp [Debug   ]" when I start kaffeine without options from a terminal. Attached is the CMakeOutput.log, it doesn't really mention debug besides "--enable-libstdcxx-debug" How can I avoid flooding my .xsession-errors log? Starting kaffeine with 2>/dev/null is possible but cumbersome. It would be nice to have a silent starting option instead, so I can continue using the debug version and switch on with "--debug" whenever I need it.
Comment 1 Mauro Carvalho Chehab 2017-06-30 14:07:44 UTC
Kaffeine log is now controlled by QT_LOGGING_RULES.

As explained at:
   https://doc.qt.io/qt-5/qloggingcategory.html

The logging rules are also "automatically loaded from the [Rules] section of a logging configuration file. Such configuration files are looked up in the QtProject configuration directory, or explicitly set in a QT_LOGGING_CONF environment variable".

Perhaps you either have such environment var set, or some Qt configuration log file somewhere on your filesystem.
Comment 2 Mauro Carvalho Chehab 2017-07-09 22:43:03 UTC
(In reply to Mauro Carvalho Chehab from comment #1)
> Kaffeine log is now controlled by QT_LOGGING_RULES.
> 
> As explained at:
>    https://doc.qt.io/qt-5/qloggingcategory.html
> 
> The logging rules are also "automatically loaded from the [Rules] section of
> a logging configuration file. Such configuration files are looked up in the
> QtProject configuration directory, or explicitly set in a QT_LOGGING_CONF
> environment variable".
> 
> Perhaps you either have such environment var set, or some Qt configuration
> log file somewhere on your filesystem.

There was indeed a bug there. Apparently, some patches I wrote a long time ago addressing it weren't merged. I just fixed upstream. It should default to only show debug logs if either --debug or QT_LOGGING_RULES is used.
Comment 3 Tuxo 2017-07-26 12:39:29 UTC
Ahh, thanks Mauro, will test this ASAP - the last couple of weeks I added QT_LOGGING_RULES="*.debug=false" to my /etc/environment, but it was still weirding me out, how the debian/stable sources I built using the same method were not affected. If I build their source "the debian way" I end up with a deb package and an additional package with the debug symbols.

Any plans on adding a debian build structure to your git three?
Comment 4 Tuxo 2017-07-26 13:49:10 UTC
Confirmed, this works nicely in v2.0.12 with the Release build type: there is no debug without debug option specified, plus debug category filtering works fine (tested with QT_LOGGING_RULES=kaffeine.dvb.debug=true), thank you!

How do I add these environment options into a kaffeine.desktop file?
Comment 5 Mauro Carvalho Chehab 2017-07-26 13:59:44 UTC
(In reply to Tuxo from comment #3)

> Any plans on adding a debian build structure to your git three?

I actually use Fedora here on my main machines ;) My test machine is using Ubuntu, currently, but I don't generate .deb packages there.

I don't have any plans to add .deb or .rpm build infra there, but if you send patches for it, I may consider applying, as this could be useful for the others.


(In reply to Tuxo from comment #4)
> Confirmed, this works nicely in v2.0.12 with the Release build type: there
> is no debug without debug option specified, plus debug category filtering
> works fine (tested with QT_LOGGING_RULES=kaffeine.dvb.debug=true), thank you!

Anytime!

> How do I add these environment options into a kaffeine.desktop file?

Not sure what you want to do. I mean, by default, debug should be disabled, as this is useful only if someone wants to report a bug. Kaffeine has already a "--debug" option that enables everything, even if built as Release. The main difference is that building Kaffeine in debug node will keep Kaffeine's symbols at its exec file, so debug messages can show the line of the code where each mention was produced, with helps on more critical errors.
Comment 6 Tuxo 2017-07-26 19:22:25 UTC
Maybe I'm not understanding the --desktopfile option: I thought it was possible to use this to pass additional options or a different environment setup to a second kaffeine starter like (kaffeine-debug.desktop) and write the debug output to a logfile?

Anyway, the issue is fixed for me, you can close this ticket.
Comment 7 Tuxo 2017-07-27 10:52:27 UTC
(In reply to Mauro Carvalho Chehab from comment #5)

> 
> I don't have any plans to add .deb or .rpm build infra there, but if you
> send patches for it, I may consider applying, as this could be useful for
> the others.
> 

The Debian build structure for kaffeine is maintained here: [1]

[1] https://anonscm.debian.org/git/pkg-kde/kde-extras/kaffeine.git/

As you can see there are no patches applied to your source code, it's just the necessary debian folder to mention package description plus build & runtime dependencies.

You should adjust the debian/control file in case your build dependencies change in the future.

If you grab the v2.0.5 debian/ folder and add your latest Changelog entry for v2.0.12 to the debian/changelog, it should build your current git correctly under Ubuntu as well (* fingers crossed , can't test it right now * I only used Debian/Stretch to test this)

If you modify your Changelog file, debian/changelog should always be bumped up with an entry as well. The top entry decides what version is being used as deb package.

Build instructions for Debian/Ubuntu, maybe put this into Readme.md:

cd kaffeine.git (in pristine state)
debian/rules build (for test-building just the source)
fakeroot debian/rules binary (for building the source and deb-packaging)
fakeroot debian/clean (for cleaning up)
dpkg -i ../kaffeine_<version>.deb (will install the package)
apt-get remove --purge kaffeine (will remove the package and cleanup config files)
Comment 8 Tuxo 2017-07-27 11:04:05 UTC
sed 's|debian/clean|debian/rules clean|' -- copy-paste stupidity, sorry for that!
Comment 9 Mauro Carvalho Chehab 2017-07-27 13:54:01 UTC
(In reply to Tuxo from comment #7)
> (In reply to Mauro Carvalho Chehab from comment #5)

> Build instructions for Debian/Ubuntu, maybe put this into Readme.md:
> 
> cd kaffeine.git (in pristine state)
> debian/rules build (for test-building just the source)
> fakeroot debian/rules binary (for building the source and deb-packaging)
> fakeroot debian/clean (for cleaning up)
> dpkg -i ../kaffeine_<version>.deb (will install the package)
> apt-get remove --purge kaffeine (will remove the package and cleanup config
> files)

Well, it doesn't hurt to add debian install instructions, e. g. something like:

### Debian Packaging

If you want to create a Debian packaging, you need to install the
needed tools:

    apt-get install fakeroot dpkg-dev pkg-kde-tools

And clone the Debian packaging system with:

    git clone git://anonscm.debian.org/pkg-kde/kde-extras/kaffeine.git deb-build
    cd deb-build
    rsync -ua --exclude '.git*' --exclude deb-build .. .
    rm CMakeCache.txt
    cat Changelog |grep Version|head -1|perl -ne 'if (m/Version\s*(\S+)/) { print "kaffeine ($1-1) unstable; urgency=medium\n\n  * New upstream release.\n" }' >debian/changelog
    echo " -- root <root@localhost>  $(date -R)" >>debian/changelog
    fakeroot debian/rules binary


I tested it locally, and it almost works: I'm actually using vlc from git tree due to MPEG4 support, with doesn't work fine with vlc 2.x. So, I'm getting this error here:

dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libvlc.so.5 (used by debian/kaffeine/usr/bin/kaffeine)
Hint: check if the library actually comes from a package.

But I suspect that, it shouldn't be a problem if I hadn't installed my own libvlc package.

Anyway, I'll be committing the above to README.md.
Comment 10 Tuxo 2017-07-27 14:31:26 UTC
Looks okay, except: *please* replace root <root@localhost> with your credentials, since this is your sourcecode we are building:

"Mauro Carvalho Chehab <mchehab@osg.samsung.com>"

It should work as long as your build dependencies from -git stay in sync with the current debian/control file (also in respect to the dependency version). Usually any future change of build dependencies should be mentioned in debian/changelog as well not just "new upstream release".

I compared the current debian/ folder of ubuntu-kaffeine with debian-kaffeine and they are both from v. 2.0.5 and are exactly the same. I see no reason why it should not work on ubuntu then, as soon as you revert the vlc version to the ubuntu version.
Comment 11 Tuxo 2017-07-27 15:10:49 UTC
Just noticed that pkg-kde-tools only *suggests* dephelper [1], but kaffeine actually *needs* it [2]

So please add dephelper to your list of "needed tools" in Readme.md as well.

One debian command could actually do-it-all for you:

apt-get build-dep kaffeine

It will install all known *downstream* build-dependencies from [2] , but it obviously can't know about them, if you one day decide to change them in -git aka upstream, right? That's why it might be a better idea to host and "maintain" an up-to- date debian folder with your own control file in your own git, just saying :-)

[1] https://packages.debian.org/stretch/pkg-kde-tools
[2] https://packages.debian.org/source/stretch/kaffeine
Comment 12 Mauro Carvalho Chehab 2017-07-31 00:56:22 UTC
(In reply to Tuxo from comment #11)
> Just noticed that pkg-kde-tools only *suggests* dephelper [1], but kaffeine
> actually *needs* it [2]
> 
> So please add dephelper to your list of "needed tools" in Readme.md as well.

Added.

> It will install all known *downstream* build-dependencies from [2] , but it
> obviously can't know about them, if you one day decide to change them in
> -git aka upstream, right? That's why it might be a better idea to host and
> "maintain" an up-to- date debian folder with your own control file in your
> own git, just saying :-)

I'm pretty sure that, if I add it there, I won't be maintaining it, as I won't retest their dependencies, specially since I need vlc 3 on my machines in order for Kaffeine to work with the Digital TVs channels I receive here. So, let's just add the build instructions at README.md.