Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 618392 - www-client/firefox-52.1, mail-client/thunderbird-52.1 : LTO error: unrecognized command line option ‘--param lto-partitions=1’
Summary: www-client/firefox-52.1, mail-client/thunderbird-52.1 : LTO error: unrecogniz...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: InVCS
: 644502 (view as bug list)
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2017-05-13 21:56 UTC by Petross404(Petros S)
Modified: 2018-01-15 15:10 UTC (History)
7 users (show)

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


Attachments
build.log (mail-client:thunderbird-52.1.0:20170513-203340.tar.gz,112.23 KB, application/gzip)
2017-05-13 21:57 UTC, Petross404(Petros S)
Details
emerge --info (emerge-info,24.91 KB, text/plain)
2017-05-13 22:01 UTC, Petross404(Petros S)
Details
moz.build patch to build with LTO (0001_fix-lto-build.patch,1.70 KB, patch)
2017-05-15 19:54 UTC, Steffen Hau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petross404(Petros S) 2017-05-13 21:56:21 UTC
As it is indicated in this thread[1] if --disable-sandbox and --disable-content-sandbox are appended at .mozconfig, FF/Thundermail can be compiled with LTO (there is a shell problem with GCC's --param).
[1] https://forums.gentoo.org/viewtopic-p-7971722.html

> Error message : x86_64-pc-linux-gnu-g++: error: unrecognized command line 
> option ‘--param lto-partitions=1’; did you mean ‘--lto-partition=1to1’?

The thing is that .mozconfig is created *after* configure -and therefore prepare - phase so a patch doesn't cut it. Rather the solution is to append :

echo "mk_add_options .. >> "${S}"/.mozconfig 

in the ebuild's configure phase, if *lto flags are found. Special care should be taken if flto is found but a -fno-lto exists later in the CFLAGS.
Comment 1 Petross404(Petros S) 2017-05-13 21:57:56 UTC
Created attachment 472514 [details]
build.log
Comment 2 Petross404(Petros S) 2017-05-13 22:01:44 UTC
Created attachment 472516 [details]
emerge --info

I forgot to mention about the shell issue, that the whole problem boils down to a missing "=".

Try : echo | g++ -c -x c++ "--param lto-partitions=1" -
then : echo | g++ -c -x c++ "--param=lto-partitions=1" -

If disabling the sandbox isn't safe or elegant solution, we should take care this issue after all.
Comment 3 Steffen Hau 2017-05-15 19:54:11 UTC
Created attachment 472684 [details, diff]
moz.build patch to build with LTO
Comment 4 Steffen Hau 2017-05-15 20:04:04 UTC
www-client/firefox is also affected. The last hunk of the attached patch (with adding "mozilla" after a/ and b) fixes this.
Comment 5 Ian Stakenvicius (RETIRED) gentoo-dev 2017-06-15 14:35:57 UTC
No solution, just updating sumary to include firefox
Comment 6 Steffen Hau 2017-06-16 09:04:40 UTC
(In reply to Ian Stakenvicius from comment #5)
> No solution, just updating sumary to include firefox

Thats wrong, see #3 and #4.
Comment 7 Ian Stakenvicius (RETIRED) gentoo-dev 2017-06-16 14:15:15 UTC
Yes you're right, that was bad wording on my part.  What I meant was, I was not providing or commenting on any solution.  :)

I'll review this next week once my testing box is ready to go.  It looks very straight-forward, so I expect after testing it'll be no problem to commit.
Comment 8 Steve Arnold archtester gentoo-dev 2017-06-17 17:31:54 UTC
Easy sed hack to "fix" it:

+	# fix lto flag, causes command line error
+	sed -i -e "s|--param lto-partitions=1|-flto-partition=one|" \
+		"${S}"/security/sandbox/linux/moz.build \
+		"${S}"/ipc/app/pie/moz.build \
+		"${S}"/ipc/app/moz.build
+
+

Put this in src_prepare after the usual patches.  Takes a while to link but it does work...
Comment 9 Ian Stakenvicius (RETIRED) gentoo-dev 2017-06-19 13:38:18 UTC
Just a heads-up to everyone on this bug -- all mozilla packages currently in the gentoo repo support building of a .mozconfig that accepts values that are specified in EXTRA_ECONF, so there's no need to try and patch or overlay ebuilds to add options to the configuration.

Now back to this bug.  Do all of the supplied solutions still require sandbox to be disabled?
Comment 10 Nick Sarnie gentoo-dev 2017-09-13 23:30:34 UTC
(In reply to Ian Stakenvicius from comment #9)
> Just a heads-up to everyone on this bug -- all mozilla packages currently in
> the gentoo repo support building of a .mozconfig that accepts values that
> are specified in EXTRA_ECONF, so there's no need to try and patch or overlay
> ebuilds to add options to the configuration.
> 
> Now back to this bug.  Do all of the supplied solutions still require
> sandbox to be disabled?

Hi Ian,

I did not need to disable to sandbox to build with LTO, but I did need that patch above. Could you explain how to use EXTRA_ECONF to apply the settings in comment 8?


Thanks.
Comment 11 Ian Stakenvicius (RETIRED) gentoo-dev 2017-09-14 14:30:42 UTC
(In reply to Nick Sarnie from comment #10)
> (In reply to Ian Stakenvicius from comment #9)
> > Just a heads-up to everyone on this bug -- all mozilla packages currently in
> > the gentoo repo support building of a .mozconfig that accepts values that
> > are specified in EXTRA_ECONF, so there's no need to try and patch or overlay
> > ebuilds to add options to the configuration.
> > 
> > Now back to this bug.  Do all of the supplied solutions still require
> > sandbox to be disabled?
> 
> Hi Ian,
> 
> I did not need to disable to sandbox to build with LTO, but I did need that
> patch above. Could you explain how to use EXTRA_ECONF to apply the settings
> in comment 8?
> 
> 
> Thanks.

Interestingly, my google-fu has failed me in finding documentation on this.  Anyhow, EXTRA_ECONF is an environment variable you can use to set any extra arguments you want a package's ./configure to take.  You can set it on the commandline when you emerge a package or you can set it in /etc/portage/package.env.  See the following for a few more details:

https://wiki.gentoo.org/wiki/etc/portage/package.env
http://gentoo.linuxhowtos.org/TipsTricks/configoptions.htm



EXTRA_ECONF is an environment variable that you can set on the command line when you emerge something, or in /etc/portage/package.env
Comment 12 Petross404(Petros S) 2017-09-14 14:55:12 UTC
Why not make the ebuild work out of the box with cflags detection and drop the tips and the workarounds?
Comment 13 Nick Sarnie gentoo-dev 2017-09-16 22:21:27 UTC
(In reply to Ian Stakenvicius from comment #11)
> (In reply to Nick Sarnie from comment #10)
> > (In reply to Ian Stakenvicius from comment #9)
> > > Just a heads-up to everyone on this bug -- all mozilla packages currently in
> > > the gentoo repo support building of a .mozconfig that accepts values that
> > > are specified in EXTRA_ECONF, so there's no need to try and patch or overlay
> > > ebuilds to add options to the configuration.
> > > 
> > > Now back to this bug.  Do all of the supplied solutions still require
> > > sandbox to be disabled?
> > 
> > Hi Ian,
> > 
> > I did not need to disable to sandbox to build with LTO, but I did need that
> > patch above. Could you explain how to use EXTRA_ECONF to apply the settings
> > in comment 8?
> > 
> > 
> > Thanks.
> 
> Interestingly, my google-fu has failed me in finding documentation on this. 
> Anyhow, EXTRA_ECONF is an environment variable you can use to set any extra
> arguments you want a package's ./configure to take.  You can set it on the
> commandline when you emerge a package or you can set it in
> /etc/portage/package.env.  See the following for a few more details:
> 
> https://wiki.gentoo.org/wiki/etc/portage/package.env
> http://gentoo.linuxhowtos.org/TipsTricks/configoptions.htm
> 
> 
> 
> EXTRA_ECONF is an environment variable that you can set on the command line
> when you emerge something, or in /etc/portage/package.env

Thanks, but for this issue in particular, the compile fails because an incorrect parameter is in the mozconfig. EXTRA_CONF is not enough based on my first look. We would need to not generate the --param lto-partitions=1 and then use EXTRA_CONF to add the correct parameter. This does look like it requires an ebuild modification.
Comment 14 Jory A. Pratt gentoo-dev 2017-12-11 04:21:59 UTC
Firefox-52.5.2 has been fixed in tree along with thunderbird-52.5.0 Thanks for the patience.
Comment 15 Steffen Hau 2017-12-11 10:12:01 UTC
Would you consider adding the patch for firefox-57.0.1 as well?
Comment 16 Jory A. Pratt gentoo-dev 2018-01-14 13:01:08 UTC
*** Bug 644502 has been marked as a duplicate of this bug. ***
Comment 17 Luke McKee 2018-01-14 16:48:16 UTC
https://bugs.gentoo.org/644502 bug #644502

Suggest fixing with a patch not using portage variables. mozbuild only want's to use these cflags in one module.
Comment 18 Jory A. Pratt gentoo-dev 2018-01-15 15:10:05 UTC
*** Bug 644502 has been marked as a duplicate of this bug. ***