Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 624616 - dev-libs/boost ignores i486 CFLAGS and i486-pc-linux-gnu platform, builds with i686 anyhow
Summary: dev-libs/boost ignores i486 CFLAGS and i486-pc-linux-gnu platform, builds wit...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: David Seifert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-11 20:01 UTC by tedheadster
Modified: 2021-05-31 15:45 UTC (History)
4 users (show)

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


Attachments
Patch to set boost instruction-set architecture from /etc/portage/make.conf:CHOST value (boost-1.63.0.ebuild.patch,264 bytes, patch)
2017-11-15 17:07 UTC, tedheadster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tedheadster 2017-07-11 20:01:17 UTC
While rebuilding my dev-libs/boost, I noticed that it ignores my architecture of 'i486' and compiles for -march=i686 anyhow. I put '-march=i486' in my /etc/portage/make.conf CFLAGS variable, but it seems to ignore that.


>>> Emerging (4 of 7) dev-libs/boost-1.62.0-r1::gentoo
 * boost_1_62_0.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...             [ ok ]
>>> Unpacking source...
>>> Unpacking boost_1_62_0.tar.bz2 to /var/tmp/portage/dev-libs/boost-1.62.0-r1\
/work

...

gcc.compile.c++ bin.v2/libs/atomic/build/gcc-4.9/gentoorelease/boost.locale.icu\
-off/pch-off/threading-multi/lockpool.o

    "i486-pc-linux-gnu-g++"  -ftemplate-depth-128 -O2 -march=i486 -mtune=i486 -\
pipe -std=c++14 -finline-functions -Wno-inline -Wall -march=i686 -pthread -fPIC\
 -m32  -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -DN\
DEBUG  -I"." -c -o "bin.v2/libs/atomic/build/gcc-4.9/gentoorelease/boost.locale\
.icu-off/pch-off/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"
Comment 1 tedheadster 2017-07-17 11:57:31 UTC
I have figured out that I need to invoke the 'b2' build utility with an added parameter 'b2 instruction-set=i486'. 

I need to know how to cleanly pass 'instruction-set=i486' into the build system. Without that, it is going with a hard-coded default of i686 and it is not detecting the i486 environment.
Comment 2 tedheadster 2017-07-18 05:19:44 UTC
I was able to get it to build with an inelegant patch to the boost.ebuild file:

--- boost-1.62.0-r1.ebuild.orig 2017-07-17 16:42:30.623493308 +0000
+++ boost-1.62.0-r1.ebuild      2017-07-17 17:26:33.272971870 +0000
@@ -141,10 +141,11 @@
        OPTIONS=(
                $(usex debug gentoodebug gentoorelease)
                "-j$(makeopts_jobs)"
                -q
                -d+2
+               instruction-set=i486
        )

   if [[ ${CHOST} == *-darwin* ]]; then
                # We need to add the prefix, and in 


Is there a way to pass in the "instruction-set=${ARCH}" parameter to OPTIONS to the ebuild process via the command line, or perhaps adding a new USE flag?
Comment 3 txt.file 2017-08-18 00:02:21 UTC
I also just saw that problem while I compiled boost on one of my computers.

On #boost@freenode somebody said that i686 is default in boost as it gives more performance. So this is an upstream problem and I wonder if/how we should handle this downstream.
Comment 4 tedheadster 2017-08-18 11:46:02 UTC
I found another workaround:

mkdir -p /mnt/gentoo/etc/portage/env/dev-libs/
nano -w /mnt/gentoo/etc/portage/env/dev-libs/boost

- Add the following to the /mnt/gentoo/etc/portage/env/dev-libs/boost file:

post_src_configure() {
   OPTIONS+=( instruction-set=i486 )
   echo "OPTIONS updated to: ${OPTIONS[@]}"
}
Comment 5 tedheadster 2017-10-26 20:19:45 UTC
Does it not seem likely we could parse /etc/portage/make.conf for the CHOST variable (i486-pc-linux-gnu in this case) and make the cpu architecture available to the boost configuration files?
Comment 6 tedheadster 2017-11-15 17:07:05 UTC
Created attachment 504294 [details, diff]
Patch to set boost instruction-set architecture from /etc/portage/make.conf:CHOST value

Here is a patch to the ebuild file that fixes this problem.

It passes the boot configuration parameter "instruction-set=${MARCH}" to the configuration utility. 

The ${MARCH} value is obtained from /etc/portage/make.conf in the CHOST variable. It is {i486,i586,i686,x86_64}-pc-linux-gnu commonly.
Comment 7 tedheadster 2019-04-07 03:42:38 UTC
This problem persists almost two years later. Can we please apply the patch I provided in comment 6 that fixes this?
Comment 8 Larry the Git Cow gentoo-dev 2019-09-14 18:30:43 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c5cac8011ada68f211a05c48150f390aa7666de

commit 7c5cac8011ada68f211a05c48150f390aa7666de
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2019-09-14 18:29:41 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2019-09-14 18:29:41 +0000

    dev-util/boost-build: Version bump to 1.71.0
    
    Bug: https://bugs.gentoo.org/624616
    Package-Manager: Portage-2.3.76, Repoman-2.3.17
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-util/boost-build/Manifest                      |   1 +
 dev-util/boost-build/boost-build-1.71.0.ebuild     | 122 +++++++++++++++++++++
 .../boost-build-1.71.0-respect-c_ld-flags.patch    |   9 ++
 3 files changed, 132 insertions(+)
Comment 9 David Seifert gentoo-dev 2019-09-14 18:36:09 UTC
(In reply to tedheadster from comment #7)
> This problem persists almost two years later. Can we please apply the patch
> I provided in comment 6 that fixes this?

I've fixed the problem differently. Removing all the default -march= tuples prevents bjam from adding them in the first place. Overriding "instruction-set" is fraught with pain, as bjam maintains its own list of valid -march= options, which is obviously idiotic and can't scale in practice (oh how I hate bjam/b2). On my Ivybridge laptop, it rejects -march=ivybridge for instance. With this fix, the user -march= value should be the final value.

Please give boost 1.71 a try.
Comment 10 tedheadster 2019-09-14 20:20:08 UTC
This appeared to have worked with one test compile (but on a virtual machine).

Can you backport it to those of us stuck using older versions?
Comment 11 David Seifert gentoo-dev 2019-09-14 21:12:52 UTC
bjam changed a lot between 1.70 and 1.71. Given that most 1.70 bugs are fixed and 1.71 brought no API changes (unlike 1.70), I hope to stabilize boost 1.71 soon. Hence backporting these fixes won't happen, also because there's tons of bugs in 1.65 we'd like to get rid of.
Comment 12 David Seifert gentoo-dev 2019-12-07 19:49:38 UTC
Boost 1.71 is stable and old versions have been removed.