Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 584118 - dev-libs/vc performs automagic CXXFLAG detection
Summary: dev-libs/vc performs automagic CXXFLAG detection
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Guilherme Amadio
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-25 18:31 UTC by Alec Ari
Modified: 2016-12-08 14:16 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge_info.txt,5.52 KB, text/plain)
2016-05-25 19:07 UTC, Alec Ari
Details
build.log (trimmed down) (build_trimmed.log,62.78 KB, text/x-log)
2016-05-25 19:08 UTC, Alec Ari
Details
calligra-2.9.1-no-arch-detection.patch (file_584118.txt,435 bytes, patch)
2016-12-07 19:31 UTC, Guilherme Amadio
Details | Diff
calligra-2.9.1-r1.patch (file_584118.txt,435 bytes, patch)
2016-12-07 19:32 UTC, Guilherme Amadio
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Ari 2016-05-25 18:31:52 UTC
Hello,

I'm building Calligra on my fastest system available to copy to slower systems but Calligra automatically enables -march=bdver2 -msse4.2 -mxop -mavx and several other extensions but I'm only building it on a bdver2 system to speed up the build time for an old sub-2 GHz low-power Intel dual-core laptop that would take days to compile. In my make.conf I have no march option set so it shouldn't be doing this. Specifying -march=nocona -mtune=generic in make.conf gets added to the package's CXXFLAGS along with -march=bdver2 -m<insert 20 extensions that aren't supported on the target system.>

The whole reason I like Gentoo is to customize the system to my liking, forcing options like this isn't helpful and ruins the purpose of running Gentoo. I know what CPU I have, if I don't have it set, it's probably for a good reason. Don't think for me please.

Thank you.

Alec Ari
Comment 1 Michael Palimaka (kensington) gentoo-dev 2016-05-25 18:35:57 UTC
Please attach emerge --info and the build log. This is definitely a bug.
Comment 2 Alec Ari 2016-05-25 19:07:49 UTC
Created attachment 435368 [details]
emerge --info
Comment 3 Alec Ari 2016-05-25 19:08:19 UTC
Created attachment 435370 [details]
build.log (trimmed down)
Comment 4 Michael Palimaka (kensington) gentoo-dev 2016-05-25 19:23:02 UTC
Which version of dev-libs/vc is installed?

VcConfig.cmake includes VcMacros.cmake which includes OptimizeForArchitecture.cmake which then uses AddCompilerFlag.cmake to mangle the *FLAGS.
Comment 5 Guilherme Amadio gentoo-dev 2016-05-25 20:05:28 UTC
Yes, this is definitely a bug. I filed a bug upstream:

https://github.com/VcDevel/Vc/issues/129

I'm afraid all versions of Vc do this, unfortunately.
Try commenting the line

include("${Vc_CMAKE_MODULES_DIR}/VcMacros.cmake")

and all lines after it in VcConfig.cmake as a temporary workaround.
I will work on a fix for this in the ebuild for Vc and watch the upstream bug.
Comment 6 Guilherme Amadio gentoo-dev 2016-05-31 18:35:48 UTC
I noticed that calligra depends on <dev-libs/vc-1.0.0. It is actually the only package that depends on dev-libs/vc.

Unless someone asks for a different solution, I will apply a fix to versions 0.7.4 and 1.2.0, and drop versions 0.7.3 and 1.1.0 from the tree.
Comment 7 Alec Ari 2016-06-01 01:09:33 UTC
I believe Calligra only depends on vc if the vc USE flag is enabled.
Comment 8 Guilherme Amadio gentoo-dev 2016-06-07 17:55:32 UTC
After further investigation, the problem is not in dev-libs/vc, but in app-office/calligra. Beginning at line 445 of CMakeLists.txt is this:

    if (NOT PACKAGERS_BUILD)
      # Optimize the whole Calligra for current architecture
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}")
    endif ()

Can I just fix this, or should I reassign to kde?
Comment 9 Michael Palimaka (kensington) gentoo-dev 2016-06-08 14:33:42 UTC
Does Vc_DEFINITIONS provide anything that might be wanted otherwise?
Comment 10 Guilherme Amadio gentoo-dev 2016-06-08 14:41:53 UTC
(In reply to Michael Palimaka (kensington) from comment #9)
> Does Vc_DEFINITIONS provide anything that might be wanted otherwise?

No, it contains only optimization and arch flags, as far as I know.
Comment 11 Michael Palimaka (kensington) gentoo-dev 2016-06-08 14:51:07 UTC
Enabling PACKAGERS_BUILD also causes stuff like this to happen:

        if(PACKAGERS_BUILD)
            vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC ONLY SSE2 SSSE3 SSE4_1 AVX AVX2)
        else()
            set(${_objs} ${_src})
        endif()

so maybe it's better if we just leave it switched off and remove Vc_DEFINITIONS reference instead?
Comment 12 Guilherme Amadio gentoo-dev 2016-06-08 16:07:01 UTC
(In reply to Michael Palimaka (kensington) from comment #11)
> Enabling PACKAGERS_BUILD also causes stuff like this to happen:
> 
>         if(PACKAGERS_BUILD)
>             vc_compile_for_all_implementations(${_objs} ${_src} FLAGS -fPIC
> ONLY SSE2 SSSE3 SSE4_1 AVX AVX2)
>         else()
>             set(${_objs} ${_src})
>         endif()
> 
> so maybe it's better if we just leave it switched off and remove
> Vc_DEFINITIONS reference instead?

Yes, that is what I thought, let's just remove Vc_DEFINITIONS. The PACKAGERS_BUILD is probably for them to create generic binary tarballs for distributions, not for us.
Comment 13 Guilherme Amadio gentoo-dev 2016-12-07 19:31:46 UTC
Created attachment 455448 [details, diff]
calligra-2.9.1-no-arch-detection.patch
Comment 14 Guilherme Amadio gentoo-dev 2016-12-07 19:32:47 UTC
Created attachment 455450 [details, diff]
calligra-2.9.1-r1.patch

New ebuild revision with solution to this bug.
Comment 15 Guilherme Amadio gentoo-dev 2016-12-07 19:34:10 UTC
@kde: Please have a look at the changes. If there are no objections, I will apply them.