I'm trying to build on Ubuntu 14.04.5. Since the available version of GCC is 4.8.4, I installed clang 3.8 and I am compiling by doing
CXX=clang++-3.8 make
I think I have installed all dependencies.
However, when compiling, make spits out a lot of warning: unknown attribute 'optimize' ignored [-Wunknown-attributes] and finally stops on
command_manager.cc:466:16: error: no viable overloaded '='
it = tokens.insert(tokens.erase(it),
~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:708:11: note: candidate function (the implicit copy assignment operator) not
viable: cannot convert argument of incomplete type 'void' to 'const __gnu_cxx::__normal_iterator<Kakoune::Token *, std::vector<Kakoune::Token,
Kakoune::Allocator<Kakoune::Token, Kakoune::MemoryDomain::Undefined> > >'
class __normal_iterator
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:708:11: note: candidate function (the implicit move assignment operator) not
viable: cannot convert argument of incomplete type 'void' to '__gnu_cxx::__normal_iterator<Kakoune::Token *, std::vector<Kakoune::Token,
Kakoune::Allocator<Kakoune::Token, Kakoune::MemoryDomain::Undefined> > >'
2 warnings and 1 error generated.
make: *** [.command_manager.debug.o] Error 1
It looks like it's using GCC 4.8 libraries? I am confused, since I am using clang-3.8 to compile. Am I doing something wrong?
I have also tried installing libc++ and compiling with CXX=clang++-3.8 CXXFLAGS+=-stdlib=libc++ make, and now the error is
clang++-3.8 -DKAK_DEBUG -I/usr/include/ncursesw -stdlib=libc++ -pedantic -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -Wno-address -MD -MP -MF .alias_registry.debug.d -c -o .alias_registry.debug.o alias_registry.cc
In file included from alias_registry.cc:1:
In file included from ./alias_registry.hh:5:
./string.hh:96:3: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
[[gnu::optimize(3)]] // this is recursive for constexpr reason
^
In file included from alias_registry.cc:4:
./containers.hh:136:80: error: no matching function for call to object of type 'const std::__1::__mem_fn<Kakoune::StringView std::__1::pair<Kakoune::StringView,
Kakoune::StringView>::*>'
auto operator*() -> TransformedResult<ContainerIt, Transform> { return m_view.m_transform(*m_it); }
^~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/algorithm:846:13: note: in instantiation of member function 'Kakoune::TransformView<std::__1::vector<std::__1::pair<Kakoune::StringView,
Kakoune::StringView>, Kakoune::Allocator<std::__1::pair<Kakoune::StringView, Kakoune::StringView>, Kakoune::MemoryDomain::Undefined> > &,
std::__1::__mem_fn<Kakoune::StringView std::__1::pair<Kakoune::StringView, Kakoune::StringView>::*> >::Iterator::operator*' requested here
if (*__first == __value_)
^
./containers.hh:316:17: note: in instantiation of function template specialization
'std::__1::find<Kakoune::TransformView<std::__1::vector<std::__1::pair<Kakoune::StringView, Kakoune::StringView>,
Kakoune::Allocator<std::__1::pair<Kakoune::StringView, Kakoune::StringView>, Kakoune::MemoryDomain::Undefined> > &, std::__1::__mem_fn<Kakoune::StringView
std::__1::pair<Kakoune::StringView, Kakoune::StringView>::*> >::Iterator, Kakoune::String>' requested here
return std::find(begin(container), end(container), value);
^
./containers.hh:328:12: note: in instantiation of function template specialization
'Kakoune::find<Kakoune::TransformView<std::__1::vector<std::__1::pair<Kakoune::StringView, Kakoune::StringView>,
Kakoune::Allocator<std::__1::pair<Kakoune::StringView, Kakoune::StringView>, Kakoune::MemoryDomain::Undefined> > &, std::__1::__mem_fn<Kakoune::StringView
std::__1::pair<Kakoune::StringView, Kakoune::StringView>::*> > &, Kakoune::String>' requested here
return find(container, value) != end(container);
^
alias_registry.cc:60:17: note: in instantiation of function template specialization
'Kakoune::contains<Kakoune::TransformView<std::__1::vector<std::__1::pair<Kakoune::StringView, Kakoune::StringView>,
Kakoune::Allocator<std::__1::pair<Kakoune::StringView, Kakoune::StringView>, Kakoune::MemoryDomain::Undefined> > &, std::__1::__mem_fn<Kakoune::StringView
std::__1::pair<Kakoune::StringView, Kakoune::StringView>::*> >, Kakoune::String>' requested here
if (not contains(res | transform(std::mem_fn(&AliasDesc::first)), alias.key))
^
/usr/include/c++/v1/functional:1224:11: note: candidate function not viable: 'this' argument has type 'const std::__1::__mem_fn<Kakoune::StringView
std::__1::pair<Kakoune::StringView, Kakoune::StringView>::*>', but method is not marked const
operator() (_ArgTypes&&... __args)
^
1 warning and 1 error generated.
make: *** [.alias_registry.debug.o] Error 1
Is it the same after a make clean?
Yes, I always do make clean before.
same here
same with clang 3.5
You don't have either a g++ or a libc++ recent enough to be able to compile the project (I reproduced both your errors in a docker container), so I think the only solution is to upgrade your packages (maybe add the llvm repository to your apt sources?).
EDIT: the commit that closed this issue didn't fix the compilation error for me.
It should have fixed the error when compiling with libc++, but using the g++ 4.8 std lib wont work. Reopen if compiling with libc++ and clang-3.8 still fails.
Compiling with clang-3.8 and libc++ still fails with different errors:
In file included from commands.cc:3:
In file included from ./buffer.hh:4:
In file included from ./clock.hh:4:
In file included from /usr/include/c++/v1/chrono:280:
/usr/include/c++/v1/type_traits:433:83: error: no matching function for call to '__source'
: public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>())) == 1>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/type_traits:438:14: note: in instantiation of template class 'std::__1::__libcpp_is_function<Kakoune::Buffer *() const, false>' requested here
: public __libcpp_is_function<_Tp> {};
^
/usr/include/c++/v1/type_traits:443:97: note: in instantiation of template class 'std::__1::is_function<Kakoune::Buffer *() const>' requested here
template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
^
/usr/include/c++/v1/type_traits:446:14: note: in instantiation of template class 'std::__1::__libcpp_is_member_function_pointer<Kakoune::Buffer
*(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const>' requested here
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {};
^
/usr/include/c++/v1/type_traits:460:38: note: in instantiation of template class 'std::__1::is_member_function_pointer<Kakoune::Buffer
*(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const>' requested here
!is_member_function_pointer<_Tp>::value> {};
^
/usr/include/c++/v1/type_traits:3122:17: note: in instantiation of template class 'std::__1::is_member_object_pointer<Kakoune::Buffer
*(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const>' requested here
is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
^
/usr/include/c++/v1/__functional_base:399:1: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
__invoke(_Fp&& __f, _A0&& __a0)
^
/usr/include/c++/v1/__functional_base:419:22: note: while substituting deduced template arguments into function template '__invoke' [with _Fp = Kakoune::Buffer
*(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const, _A0 = const std::__1::unique_ptr<Kakoune::Buffer,
std::__1::default_delete<Kakoune::Buffer> > &, $2 = (no value)]
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
^
/usr/include/c++/v1/functional:1223:17: note: in instantiation of template class 'std::__1::__invoke_return<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer,
std::__1::default_delete<Kakoune::Buffer> >::*)() const, const std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> > &>' requested
here
typename __invoke_return<type, _ArgTypes...>::type
^
./containers.hh:123:36: note: while substituting deduced template arguments into function template 'operator()' [with _ArgTypes = <const
std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> > &>]
using TransformedResult = decltype(std::declval<T>()(*std::declval<I>()));
^
./containers.hh:131:68: note: in instantiation of template type alias 'TransformedResult' requested here
typename std::remove_reference<TransformedResult<ContainerIt, Transform>>::type>
^
commands.cc:1545:50: note: in instantiation of member class 'Kakoune::TransformView<Kakoune::BufferManager &, std::__1::__mem_fn<Kakoune::Buffer
*(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator' requested here
Vector<SafePtr<Buffer>> buffers{ptrs.begin(), ptrs.end()};
^
/usr/include/c++/v1/type_traits:424:28: note: candidate template ignored: substitution failure [with _Tp = Kakoune::Buffer *() const]: reference to function type
'Kakoune::Buffer *() const' cannot have 'const' qualifier
template <class _Tp> _Tp& __source();
~~~ ^
commands.cc:1545:37: error: no matching constructor for initialization of 'Vector<SafePtr<Kakoune::Buffer> >' (aka 'std::__1::vector<Kakoune::RefPtr<Kakoune::Buffer,
Kakoune::SafeCountablePolicy>, Kakoune::Allocator<Kakoune::RefPtr<Kakoune::Buffer, Kakoune::SafeCountablePolicy>, Kakoune::MemoryDomain::Undefined> >')
Vector<SafePtr<Buffer>> buffers{ptrs.begin(), ptrs.end()};
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/vector:524:5: note: candidate constructor not viable: no known conversion from 'Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator' to 'size_type'
(aka 'unsigned long') for 1st argument
vector(size_type __n, const_reference __x);
^
/usr/include/c++/v1/vector:558:5: note: candidate constructor not viable: no known conversion from 'Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator' to
'initializer_list<value_type>' (aka 'initializer_list<Kakoune::RefPtr<Kakoune::Buffer, Kakoune::SafeCountablePolicy> >') for 1st argument
vector(initializer_list<value_type> __il, const allocator_type& __a);
^
/usr/include/c++/v1/vector:569:5: note: candidate constructor not viable: no known conversion from 'Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator' to 'const
std::__1::vector<Kakoune::RefPtr<Kakoune::Buffer, Kakoune::SafeCountablePolicy>, Kakoune::Allocator<Kakoune::RefPtr<Kakoune::Buffer,
Kakoune::SafeCountablePolicy>, Kakoune::MemoryDomain::Undefined> >' for 1st argument
vector(const vector& __x, const allocator_type& __a);
^
/usr/include/c++/v1/vector:577:5: note: candidate constructor not viable: no known conversion from 'Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator' to
'std::__1::vector<Kakoune::RefPtr<Kakoune::Buffer, Kakoune::SafeCountablePolicy>, Kakoune::Allocator<Kakoune::RefPtr<Kakoune::Buffer,
Kakoune::SafeCountablePolicy>, Kakoune::MemoryDomain::Undefined> >' for 1st argument
vector(vector&& __x, const allocator_type& __a);
^
/usr/include/c++/v1/vector:528:35: note: candidate template ignored: disabled by 'enable_if' [with _InputIterator = Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator]
typename enable_if<__is_input_iterator <_InputIterator>::value &&
^
/usr/include/c++/v1/vector:543:35: note: candidate template ignored: disabled by 'enable_if' [with _ForwardIterator = Kakoune::TransformView<Kakoune::BufferManager &,
std::__1::__mem_fn<Kakoune::Buffer *(std::__1::unique_ptr<Kakoune::Buffer, std::__1::default_delete<Kakoune::Buffer> >::*)() const> >::Iterator]
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
^
/usr/include/c++/v1/vector:535:9: note: candidate constructor template not viable: requires at least 3 arguments, but 2 were provided
vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
^
/usr/include/c++/v1/vector:549:9: note: candidate constructor template not viable: requires at least 3 arguments, but 2 were provided
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
^
/usr/include/c++/v1/vector:513:40: note: candidate constructor not viable: requires single argument '__a', but 2 arguments were provided
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
^
/usr/include/c++/v1/vector:520:14: note: candidate constructor not viable: requires single argument '__n', but 2 arguments were provided
explicit vector(size_type __n);
^
/usr/include/c++/v1/vector:556:5: note: candidate constructor not viable: requires single argument '__il', but 2 arguments were provided
vector(initializer_list<value_type> __il);
^
/usr/include/c++/v1/vector:568:5: note: candidate constructor not viable: requires single argument '__x', but 2 arguments were provided
vector(const vector& __x);
^
/usr/include/c++/v1/vector:574:5: note: candidate constructor not viable: requires single argument '__x', but 2 arguments were provided
vector(vector&& __x)
^
/usr/include/c++/v1/vector:525:5: note: candidate constructor not viable: requires 3 arguments, but 2 were provided
vector(size_type __n, const_reference __x, const allocator_type& __a);
^
/usr/include/c++/v1/vector:506:5: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
vector()
^
2 warnings and 2 errors generated.
make: *** [.commands.debug.o] Error 1
Also, may I suggest that you actually specify the required versions of libc++ for g++ and clang++ in your Requirements section? Right now they are not there, and the fact that you don't support normal (albeit a bit old) Ubuntu 14 packages cuts out a large number of people who would like to try out the editor. At least explain the required versions, and how to get them on a couple popular distros.
I cannot reopen the issue because you closed it. One of you guys needs to reopen this.
@mawww this issue needs reopening because the commit that closed it doesn't seem to have completely solved the issue.
@Fbonazzi what version of libc++ is installed on your machine ?
1.0~svn199600-1, the one available in the standard repos.
I suspect thats a very old version as well. Does installing g++-5 and compiling with CXX=g++-5 works ?
GCC 5 is not available by default on Ubuntu 14.04. I solved the issue by following this guide:
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update && sudo apt-get dselect-upgrade
$ sudo apt-get install gcc-6 g++-6
$ CXX=g++-6 make clean all
Now it compiles fine!
Please add the version requirement for libc++: as it is now in the README, it looks like one can compile the software on Ubuntu 14.04 by using clang >=3.4 and libc++. However this is not true, and your editor cannot be compiled with software available by default on Ubuntu 14.04. I hope the steps above can help other people which have this issue.
Like I said earlier, the "fix" is to install versions of the required tools that are supported by the project, there's no point adding instructions for each individual distributions about how to do that.
Well we could be more precise and explicitely say g++-5/clang-3.4 means the compilers and the associated standard library.
However what happens here seems more to be an ubuntu problem, the fact that you get seemingly totally independant clang and libc++ packages does not make much sense. I expect that when you installed gcc-6, it did install libstdc++-6 as well with it, which is the sane thing to do for a package manager.
the "fix" is to install versions of the required tools that are supported by the project
I am just saying you could perhaps specify the version of the required tools that are supported by the project (e.g. versions of the standard libraries). I followed the requirements you have now and it still wouldn't work for me.
I agree that it doesn't make sense for Ubuntu to have independent clang and libc++, I was surprised as well. Thanks for the help though, you are really responsive and that's cool in itself.
Please don't forget to close the issue if everything is working properly on your side now.
Thank you for making the minimum compiler requirements available, that definitely helped me. More specifics on which OS were likely to work would also have been really helpful, even if that's not exhaustive or certain.
Most helpful comment
GCC 5 is not available by default on Ubuntu 14.04. I solved the issue by following this guide:
Now it compiles fine!
Please add the version requirement for
libc++: as it is now in the README, it looks like one can compile the software on Ubuntu 14.04 by using clang >=3.4 and libc++. However this is not true, and your editor cannot be compiled with software available by default on Ubuntu 14.04. I hope the steps above can help other people which have this issue.