error: no matching constructor for initialization of 'duration' (aka 'std::chrono::duration<long, std::ratio<1, 1000000> >') #148

Closed
nurpax opened this Issue Feb 25, 2014 · 4 comments

Projects

None yet

2 participants

@nurpax
nurpax commented Feb 25, 2014

I'm trying to build rtags with clang 3.4 but hitting this error with GCC 4.7 std headers:

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:540:6: error: no matching constructor for
      initialization of 'duration' (aka 'std::chrono::duration<long, std::ratio<1, 1000000> >')
          : __d(__t.time_since_epoch())
            ^   ~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:111:42: note: in instantiation of
      function template specialization 'std::chrono::time_point<std::chrono::system_clock,
      std::chrono::duration<long, std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long, std::ratio<1,
      1000000000> > >' requested here
        const __clock_t::time_point __s_atime = __s_entry + __delta;
                                                ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:234:12: note: candidate constructor not viable:
      no known conversion from 'duration<[...], ratio<[...], 1000000000>>' to 'const duration<[...], ratio<[...],
      1000000>>' for 1st argument
        constexpr duration(const duration&) = default;
                  ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:237:19: note: candidate template ignored:
      disabled by 'enable_if' [with _Rep2 = std::chrono::duration<long, std::ratio<1, 1000000000> >]
               enable_if<is_convertible<_Rep2, rep>::value
                         ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:244:19: note: candidate template ignored:
      disabled by 'enable_if' [with _Rep2 = long, _Period2 = std::ratio<1, 1000000000>]
               enable_if<treat_as_floating_point<rep>::value
                         ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:232:12: note: candidate constructor not viable:
      requires 0 arguments, but 1 was provided
        constexpr duration() : __r() { }
                  ^
1 error generated.
make[2]: *** [src/rct/CMakeFiles/rct.dir/rct/ReadWriteLock.cpp.o] Error 1

I'm not sure if I should be using the headers that came as part of g++-4.7 installation.

I have built clang 3.4 from source, and have it installed at $HOME/llvm.

@nurpax
nurpax commented Feb 25, 2014

I'll try to tweak the source and send a PR if I get it to compile.

@nurpax
nurpax commented Feb 25, 2014

Hmm, I guess there's no PR to be sent since the error comes from STL header inclusion.

Seems like this is fixed in libstdc++ 4.7.3 and 4.8.x http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53841. Debian testing ships with 4.7, so I need to figure out a way to install a newer version.

I also tried compiling straight with g++-4.7 but hit SIGABORT on free when I tried to run rdm. I didn't debug that further as I wanted to try also with clang.

@jhanssen
Collaborator

Could be interesting to see why rdm would abort on startup, some kind of C++ exception perhaps?

I don't have GCC 4.7 to test here but I know 4.8.1 works just fine.

@nurpax
nurpax commented Feb 26, 2014

I dist-upgraded my Debian and it comes with a newer C++ library. Rebuilt with that and rdm starts up just fine.

As to the abort on free'.. It looked as iffree' was throwing an exception. But I blew away the tree that did this and I don't have an older GCC and LLVM to re-test this. It could've also been that I was on LLVM 3.1, maybe that's too old. Anyway, that's gone too.

It might make sense to bump up the version requirements on the rtags home page to GCC 4.8?

Closing the bug.

@nurpax nurpax closed this Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment