Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 608688 - dev-db/mongodb fails to build with LTO
Summary: dev-db/mongodb fails to build with LTO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ultrabug
Keywords: EBUILD, PATCH, PullRequest
Depends on:
Blocks: lto
  Show dependency tree
Reported: 2017-02-09 06:12 UTC by Amit Prakash Ambasta
Modified: 2019-03-04 01:35 UTC (History)
1 user (show)

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

mongodb-3.4.1.ebuild (mongodb-3.4.1.ebuild,4.93 KB, text/plain)
2017-02-09 06:12 UTC, Amit Prakash Ambasta

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Prakash Ambasta 2017-02-09 06:12:36 UTC
Created attachment 462920 [details]


Currently, mongodb fails to emerge at all when -flto=thin or -flto are included in CFLAGS with:

Compiler must support a thread local storage class for trivially constructible types

This is because while mongodb supports building with LTO, it requires an additional scons argument as:

scons_opts+=( --lto=on )

to be enabled. I'd recommend that the ebuilds support this feature either by detecting LTO in cflags or passing it on as a separate USE flag.

I'm attaching a working ebuild alongwith for reference.
Comment 1 Larry the Git Cow gentoo-dev 2019-03-04 01:35:48 UTC
The bug has been closed via the following commit(s):

commit 020f4bb69894058b9a5fc7342aaeb3fa06c9e957
Author:     Tomas Mozes <>
AuthorDate: 2019-01-26 05:26:46 +0000
Commit:     Thomas Deutschmann <>
CommitDate: 2019-03-04 00:47:28 +0000

    dev-db/mongodb: bump to 4.0.5
    Signed-off-by: Tomas Mozes <>
    Signed-off-by: Thomas Deutschmann <>

 dev-db/mongodb/Manifest             |   1 +
 dev-db/mongodb/mongodb-4.0.5.ebuild | 164 ++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+)