On 2013-04-04 10:19, Markus Blatt wrote:
Usually I assume that a package is compiled with "-O2 -g"
if I do not adjust anything.

On 2013-04-04 12:19, Arne Morten Kvarving wrote:
cmake defaults to no optimizations *without* symbols unless
the CMakeLists.txt has hackery to set a default profile if
none is given.

On 2013-04-04 12:42, Roland Kaufmann wrote:
But in this case there *is* hackery :-) to set the default
profile,

It turns out that CMake writes its default options to the "cache"
(unless given by the user) making it impossible to distinguish between
options set by default or by the user. Thus, it is hard for a project to
change these defaults while still abiding the user's wish. However, it
is still possible -- with another layer of hackery. :-/

it is rather a matter of policy.

I checked with the master branch of opm-core, as well as the DUNE
modules. It seems that they all build release builds as default, so I
guess we should do it here too. The pull-request OPM/opm-core#226
implement this change. (And documents it in the README).

Note that there are symbols available also for the release build, so it
should still be possible to some degree to pinpoint crashes.

On 2013-04-04 14:37, Markus Blatt wrote:
What is the preferred way to override this with custom flags?

On 2013-04-04 15:07, Roland Kaufmann wrote:
There is no option at the moment to customize the optimization

As of pull request OPM/opm-core#225 you should now be able to specify
optimization flags through the environment variable CXXFLAGS, or the
CMake "cache" variable CMAKE_CXX_FLAGS_RELEASE (or _DEBUG).

Suspects are these options: -mtune and -flto .

I rather suspect that it is -flto.
>> If you have a version of GCC < 4.7

> No I use the one that comes with Debian wheezy

Try comment out line 23 in cmake/Modules/UseOptimization.cmake

Indeed, this fixed the linking problem

I am currently on Ubuntu Precise, which is (sort of) a derivative of Wheezy, but I cannot reproduce this problem in neither GCC 4.6, 4.7 nor 4.8, all of them with -flto. binutils is 2.22 and Boost is 1.53.

However, you can now disable lto altogether with --disable-lto, or -DWHOLE_PROG_OPTIM=OFF.

--
        Roland.

_______________________________________________
Opm mailing list
[email protected]
http://www.opm-project.org/mailman/listinfo/opm

Reply via email to