Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 649558 - app-portage/eix-0.33.2: cache/parse/parse.cc:382:17: error: no member named 'emplace_back' in 'std::__1::vector<bool, std::__1::allocator<bool> >'
Summary: app-portage/eix-0.33.2: cache/parse/parse.cc:382:17: error: no member named '...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords:
: 654360 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-04 11:25 UTC by therjak
Modified: 2018-09-29 08:16 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description therjak 2018-03-04 11:25:14 UTC
eix 0.33.2 uses std.vector<bool>.emplace_back which is a c++14 feature.
(http://en.cppreference.com/w/cpp/container/vector_bool)
But it sets CXXFLAGS to -std=c++11

Reproducible: Always

Steps to Reproduce:
1.set used compiler to clang with 'default-libcxx'

Actual Results:  
fails compile with:
cache/parse/parse.cc:382:17: error: no member named 'emplace_back' in 'std::__1::vector<bool, std::__1::allocator<bool> >'
                further_works.PUSH_BACK((*it)->readCategoryPrepare(cat_name));
                ~~~~~~~~~~~~~ ^
./eixTk/dialect.h:49:19: note: expanded from macro 'PUSH_BACK'
#define PUSH_BACK emplace_back


Expected Results:  
it compiles
Comment 1 Martin Väth 2018-03-06 08:56:01 UTC
emplace_back is a c++11 feature.

However, eix has a ./configure test which checks whether the feature can be used.

I am wondering why this test succeeds while the actual compilation fails.

Does it work if you replace in line 303 and 304
MV_APPEND by MV_PREPEND
(and then run ./autogen.sh or eautoreconf to regenerate ./configure)?
Comment 2 Martin Väth 2018-03-06 08:58:36 UTC
Whoops, wrong patch suggestion...
The patch I meant was to replace
MV_APPEND by MV_PREPEND in line 942 (and only there).
Comment 3 therjak 2018-03-08 22:07:57 UTC
i think the error is somewhere else. if i execute ./configure manually it gets c++17.

ebuild eix-0.33.2.ebuild configure --debug
reports at the end:
CXX: clang++       
                   
CXXFLAGS: -march=native -O2 -pipe -std=c++11
PREPEND_CXXFLAGS: -fdata-sections -ffunction-sections
                   
LDFLAGS: -Wl,-O1 -Wl,--as-needed
PREPEND_LDFLAGS: -Wl,--gc-sections

i think these lines:

+ local myconf                                                               
+ append-cxxflags -std=c++11                                            
+ [[ 1 -eq 0 ]]                                                               
+ export 'CXXFLAGS+= -std=c++11'                                                                                                                                               
+ CXXFLAGS+=' -std=c++11'                                                   
+ return 0                                                                      
+ econf --disable-paranoic-asserts --enable-nls --without-extra-doc --with-sqlite --without-always-accept-keywords --with-dep-default --with-required-use-default --with-portage-rootpath=/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0:/usr/lib/llvm/5/bin:/usr/local/sbin:/usr/local/bin:/usr/sb
in:/usr/bin:/sbin:/bin:/opt/bin --with-eprefix-default= --disable-separate-binaries --disable-separate-tools --disable-debugging --disable-new_dialect --disable-optimization --disable-strong-optimization --disable-security --disable-nopie-security --disable-strong-security

point to the cause. the ebuild states in line 76-77:

    # https://github.com/vaeth/eix/issues/35
    append-cxxflags -std=c++11
Comment 4 Martin Väth 2018-04-08 09:27:30 UTC
(In reply to therjak from comment #3)
> if i execute ./configure manually it gets c++17.

Unless you specify --disable-new_dialect (which is meanwhile not the default anymore) ./configure chooses the most current available dialect.

In any case, there is a ./configure check whether emplace_back is working with your CXXFLAGS (and possibly appended dialect flags from ./configure which finally will be prepended to your CXXFLAGS):
If ./configure finds that it is not working with your compiler (for whatever reason) with these flags, emplace_back is not used.

So the only possible difference between the ./configure test and the actual compilation I can imagnine is that in the former case the flags are appended while in the latter the flags are prepended.

If this is not the reason, it might help to see the configure output (to see whether the test indeed succeeds) and the config.log output (if the test succeeded which flags were used in contrast to the final compilation.)
Comment 5 therjak 2018-04-08 18:56:25 UTC
configure checks if emplace_back works on vector<pair<int,int>> and set<pair<int,int>> which are c++11 feature.
emplace_back on vector<bool> is a c++14 feature and is not checked.
Comment 6 Martin Väth 2018-04-09 12:37:23 UTC
Thank you for the clarification. I was not aware of an exception in the standard for vector<bool>. (Also, gcc-7 does not seem to make such a difference.)

I have fixed the configure test in eix correspondingly to include vector<bool>;
I will not write special code only to optimize for c++11 but not c++14.

So passing -std=c++11 (which I did not recommend anyway, see the cited link) should "just" force non-optimizing emplace_back with >=eix-0.33.3
Comment 7 Martin Väth 2018-05-29 11:50:30 UTC
*** Bug 654360 has been marked as a duplicate of this bug. ***
Comment 8 Denis Pronin 2018-09-25 22:38:33 UTC
@Martin, I still have the same issue @therjak pointed out

std::vector<bool>::emplace and std::vector<bool>::emplace_back are c++14 features and I have the build failed
Is something being planned to take the issue down?
Why wouldn't you like to set c++14 rather than c++11 explicitly? There are almost no essential differences in terms of working ability of code, just smallish improvements relatively to c++11

Thank you
Comment 9 Martin Väth 2018-09-26 05:48:40 UTC
I am not a proxied maintainer.

The eix build system does set correct -std according to the compiler's ability.

The eix ebuild in the gentoo repository intentionally overrides that build system against my explicit recommendation. The background is political or perhaps personal (see the discussion preceding commit 39f0ae3fe1259d17abc10cc0b21e2c9820089292 if it should still be on github); changes related to that commit are politically dangerous for gentoo developers.

I recommend to use the ebuilds from the mv overlay for my packages: These do not suffer from politics, and bugs are fixed immediately.
Comment 10 Sora Lee 2018-09-29 02:38:47 UTC
So does that make this a WONTFIX?
Comment 11 Martin Väth 2018-09-29 07:24:26 UTC
> So does that make this a WONTFIX?

A few minutes ago, I released eix-0.33.5, so from my side the bug was already fixed 3 releases ago:

The eix bug (that compilation with pure c+11 dialect does not work) is fixed since eix-0.33.3.

The fix is not optimal (for simplicity, all emplace_back-optimizations are avoided if vector<bool>::emplace_back does not work), but this is only a minor optimization issue; the non-usage of other optimal CFLAGS for eix in the gentoo ebuild has other much worse speed and memory penalties anyway.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-09-29 08:04:31 UTC
(In reply to Sora Lee from comment #10)
> So does that make this a WONTFIX?

The maintainer could just swap c++11 for c++14.  However, since he didn't reply to this bug for 6 months, I'm going to claim maintainer timeout and fix it.
Comment 13 Larry the Git Cow gentoo-dev 2018-09-29 08:16:56 UTC
The bug has been closed via the following commit(s):

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

commit f8039025292b2bbac64eedc22c6321ac442559fb
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-09-29 08:06:58 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-09-29 08:16:48 +0000

    app-portage/eix: Fix C++ standard to C++14 to fix code bugs
    
    Closes: https://bugs.gentoo.org/649558
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 app-portage/eix/eix-0.33.2-r1.ebuild | 109 +++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)