bugMyPaint - Bugs: bug #20754, brushlib: cannot set optimization...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #20754: brushlib: cannot set optimization level during build - command line option ordering problems

Submitted by:  Andrew Chadwick <achadwick>
Submitted on:  Sun 21 Apr 2013 08:30:26 PM UTC  
 
Severity: 2 - MinorPriority: 5 - Normal
Status: In ProgressPrivacy: Public
Assigned to: NoneOpen/Closed: Open
Release: 1.1.0+git 8ae515aPlanned Release: None
Operating System: Linux unstable/Sid @now

Sun 01 Dec 2013 08:36:44 AM UTC, comment #3:

It all was because python:2.7 was built with the debug information, so `python-config --cflags` returned -O0 among the other flags.

The following patch fixed that for me.

--- mypaint-1.1.0.orig/lib/SConscript 2013-01-01 00:03:38.000000000 +0700
+++ mypaint-1.1.0/lib/SConscript 2013-12-01 15:32:16.570748951 +0700
@@ -101,6 +100,9 @@
# make sure assertions are enabled
env['CPPDEFINES'].remove('NDEBUG')

+env['CCFLAGS'] = ([o for o in env['CCFLAGS'] if not o.startswith('-O')] +
+ [o for o in env['CCFLAGS'] if o.startswith('-O')][:1])
+
# python extension module
src = 'mypaintlib_wrap.cpp'
module = build_py_module(env, '../_mypaintlib', Split(src), SHLIBPREFIX="")

unknown <unknown>
Sat 12 Oct 2013 03:32:12 PM UTC, comment #2:

I cannot build mypaint-1.1.0 or mypaint-git for months now. No matter which CFLAGS and CXXFLAGS I use (-O2, -O1 or -O0), the application does not start, saying:

ImportError: /home/unknown/tmp/mypaint/mypaint-1.1.0/_mypaintlib.so: undefined symbol: _ZN10BufferCompIL20BufferCompOutputType1ELj16384E15DarkenBlendModeE9blendfuncE

I execute the following command before running scons:
export CFLAGS=-ON CXXFLAGS=-ON
where N = 0, 1, 2
The log of -O2 build: http://bpaste.net/show/139911/
The log of -O0 build: http://bpaste.net/show/139912/
(Here I used a patch to make scons respect the environment, but vanilla builds are all the same.)

Note that despite the specified -O2 flags, there is -O0 in the first log, and it is the latest -O option, supplied to gcc. I don't know how it got there, there seem to be no -O0 options (short of debug build) in the sources.

I'm totally desperate now.

unknown <unknown>
Mon 22 Apr 2013 12:34:43 AM UTC, comment #1:

Correction: hilarity (and linker failures at runtime) ensues with -O0. -O1 is fine.

Hopefully partly addressed in https://gitorious.org/mypaint/mypaint/commit/c006e4e35d1354b4de4c9bed8f742d00468c4ef4 , which at least allows similar inconsistencies relating to Debian build hardening to be fixed: http://bugs.debian.org/704927

This bug is still In Progress rather than Fixed because simply throwing more options at it doesn't allow a -O0 build:

since it gets overridden by (json-c's?) later config options for pretty much everything in brushlib/.

Retitling this bug.

Andrew Chadwick <achadwick>
Project Administrator
Sun 21 Apr 2013 08:30:26 PM UTC, original submission:

If MyPaint is compiled and run with CFLAGS=-O1, hilarity ensues:

(Not sure if my over-clever templating stuff for genericizing blend modes is at fault here. If somebody with better C++ chops than me could have a look at it, I'd be much obliged.)

This was in essence reported in Debian bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704935 , and I'm working on a fix for stable 1.1.0 downstream. Presumably it's due to inconsistent use of optimization flags.

Chasing the cause of the error reveals a few facts:

1. the bulk of brushlib, and its tests, do not respect CFLAGS, and just uses the default -O3 for that type of build
2. CFLAGS are respected when building mypaint's _mypaintlib.so (and that's it).

This is inconsistent and breaks some downstream builds, albeit not in a way that can't be worked around downstream too.

(As an aside, should we go the route of

http://www.freebsd.org/doc/en/books/porters-handbook/book.html#using-scons

, i.e. using Environment(**ARGUMENTS) - trailing command-line options to scons - instead of os.environ? If we're calling third part apps like scons, presumably we have no option.)

Andrew Chadwick <achadwick>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by unknown (Posted a comment)
  • -unavailable- added by unknown (Voted in favor of this item)
  • -unavailable- added by achadwick (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 12 Oct 2013 03:32:12 PM UTCunknownCarbon-Copy-=>Added unknown
    Mon 22 Apr 2013 12:34:43 AM UTCachadwickStatusNone=>In Progress
      Summarybrushlib: CFLAGS not respected (more generally, we need a consistent way of passing CFLAGS, LDFLAGS etc.)=>brushlib: cannot set optimization level during build - command line option ordering problems
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup