Closed james-d-mitchell closed 6 years ago
Hi james
I just pushed on master a new version that should fix the problem. I did'nt had the time to thoroughly test that It indeed fix all the duplicate symbol problem. Please tell me if it works. If so I'll make a new release.
Awesome I'll give it a try today
Unfortunately, with the most recent commits to master
, HPCombi
doesn't even compile, it appears that you are using C++14 features again (see below).
One possible solution would be to make a stable-0.0
branch, merge this PR (or some version or alternative to it), and release v0.0.2 with only these minimal changes. This way I could release libsemigroups 1.0.0 (when it's ready!) including a copy of v0.0.2.
In file included from src/elements.cc:22:
In file included from src/elements.h:39:
src/../extern/HPCombi/include/perm16.hpp:34:50: error: no type named 'index_sequence' in
namespace 'std'
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
~~~~~^
src/../extern/HPCombi/include/perm16.hpp:34:64: error: expected ')'
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
^
src/../extern/HPCombi/include/perm16.hpp:34:32: note: to match this '('
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
^
src/../extern/HPCombi/include/perm16.hpp:39:35: error: no member named 'make_index_sequence' in
namespace 'std'
return make_epu8_helper(f, std::make_index_sequence<16>{});
~~~~~^
src/../extern/HPCombi/include/perm16.hpp:39:57: error: initializer list cannot be used on the
right hand side of operator '>'
return make_epu8_helper(f, std::make_index_sequence<16>{});
^~~
src/../extern/HPCombi/include/perm16.hpp:38:42: error: no return statement in constexpr function
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:111:3: error: 'auto' return without trailing return
type; deduced return types are a C++14 extension
auto begin() { return as_array().begin(); }
^
src/../extern/HPCombi/include/perm16.hpp:112:3: error: 'auto' return without trailing return
type; deduced return types are a C++14 extension
auto end() { return as_array().end(); }
^
src/../extern/HPCombi/include/perm16.hpp:111:25: error: cannot initialize return object of type
'int' with an rvalue of type 'iterator' (aka 'unsigned char *')
auto begin() { return as_array().begin(); }
^~~~~~~~~~~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:112:23: error: cannot initialize return object of type
'int' with an rvalue of type 'iterator' (aka 'unsigned char *')
auto end() { return as_array().end(); }
^~~~~~~~~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:209:45: error: no matching function for call to
'make_epu8'
static constexpr PTransf16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:209:30: error: no return statement in constexpr
function
static constexpr PTransf16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:211:31: error: cannot convert between vector values of
different size ('epu8' (vector of 16 'uint8_t' values) and 'int')
return permuted(p).v | (v == 0xFF); }
~ ^ ~~~~
src/../extern/HPCombi/include/perm16.hpp:228:44: error: no matching function for call to
'make_epu8'
static constexpr Transf16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:228:29: error: no return statement in constexpr
function
static constexpr Transf16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:301:42: error: no matching function for call to
'make_epu8'
static constexpr Perm16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:301:27: error: no return statement in constexpr
function
static constexpr Perm16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:302:49: error: no matching function for call to
'make_epu8'
static constexpr Perm16 left_cycle() { return make_epu8(make_left_cycle); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:302:27: error: no return statement in constexpr
function
static constexpr Perm16 left_cycle() { return make_epu8(make_left_cycle); }
^
src/../extern/HPCombi/include/perm16.hpp:303:50: error: no matching function for call to
'make_epu8'
static constexpr Perm16 right_cycle() { return make_epu8(make_right_cycle); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [src/libsemigroups_la-elements.lo] Error 1
make: *** Waiting for unfinished jobs....
In file included from src/cong.cc:19:
In file included from src/cong.h:32:
In file included from src/semigroups.h:31:
In file included from src/elements.h:39:
src/../extern/HPCombi/include/perm16.hpp:34:50: error: no type named 'index_sequence' in
namespace 'std'
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
~~~~~^
src/../extern/HPCombi/include/perm16.hpp:34:64: error: expected ')'
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
^
src/../extern/HPCombi/include/perm16.hpp:34:32: note: to match this '('
constexpr epu8 make_epu8_helper(Function f, std::index_sequence<Indices...>) {
^
src/../extern/HPCombi/include/perm16.hpp:39:35: error: no member named 'make_index_sequence' in
namespace 'std'
return make_epu8_helper(f, std::make_index_sequence<16>{});
~~~~~^
src/../extern/HPCombi/include/perm16.hpp:39:57: error: initializer list cannot be used on the
right hand side of operator '>'
return make_epu8_helper(f, std::make_index_sequence<16>{});
^~~
src/../extern/HPCombi/include/perm16.hpp:38:42: error: no return statement in constexpr function
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:111:3: error: 'auto' return without trailing return
type; deduced return types are a C++14 extension
auto begin() { return as_array().begin(); }
^
src/../extern/HPCombi/include/perm16.hpp:112:3: error: 'auto' return without trailing return
type; deduced return types are a C++14 extension
auto end() { return as_array().end(); }
^
src/../extern/HPCombi/include/perm16.hpp:111:25: error: cannot initialize return object of type
'int' with an rvalue of type 'iterator' (aka 'unsigned char *')
auto begin() { return as_array().begin(); }
^~~~~~~~~~~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:112:23: error: cannot initialize return object of type
'int' with an rvalue of type 'iterator' (aka 'unsigned char *')
auto end() { return as_array().end(); }
^~~~~~~~~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:209:45: error: no matching function for call to
'make_epu8'
static constexpr PTransf16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:209:30: error: no return statement in constexpr
function
static constexpr PTransf16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:211:31: error: cannot convert between vector values of
different size ('epu8' (vector of 16 'uint8_t' values) and 'int')
return permuted(p).v | (v == 0xFF); }
~ ^ ~~~~
src/../extern/HPCombi/include/perm16.hpp:228:44: error: no matching function for call to
'make_epu8'
static constexpr Transf16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:228:29: error: no return statement in constexpr
function
static constexpr Transf16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:301:42: error: no matching function for call to
'make_epu8'
static constexpr Perm16 one() { return make_epu8(make_one); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:301:27: error: no return statement in constexpr
function
static constexpr Perm16 one() { return make_epu8(make_one); }
^
src/../extern/HPCombi/include/perm16.hpp:302:49: error: no matching function for call to
'make_epu8'
static constexpr Perm16 left_cycle() { return make_epu8(make_left_cycle); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
src/../extern/HPCombi/include/perm16.hpp:302:27: error: no return statement in constexpr
function
static constexpr Perm16 left_cycle() { return make_epu8(make_left_cycle); }
^
src/../extern/HPCombi/include/perm16.hpp:303:50: error: no matching function for call to
'make_epu8'
static constexpr Perm16 right_cycle() { return make_epu8(make_right_cycle); }
^~~~~~~~~
src/../extern/HPCombi/include/perm16.hpp:38:42: note: candidate template ignored: substitution
failure [with Function = unsigned char (*)(unsigned char)]
template <class Function> constexpr epu8 make_epu8(Function f) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit
I'm sorry but I don't understand what is happening. Are you sure that you where using v.0.0.1 ? There is a lot of error in your message which are about thing that didn't chang between v.0.0.1 and master.
For example: for the std::index_sequence
I'm providing a fallback which should be used:
#if __cplusplus <= 201103L
#include "fallback/seq.hpp"
#endif
Can you check that your compiler is correctly answering to it
I'm fairly sure that I was using v0.0.1, in particular, a fresh copy was downloaded by our travis tests, every time. I'll try to figure out what is going wrong, and update you.
I think I figured out what happened. Didn't you mixed up master on my repo with master on your repo. The hash you should have is 37396a36aad10ffbae9520de0665af6fc4caa6a2
.
Dear James,
I found some time to write test for the multiple inclusion. It turned out that there where still some problems which should be now fixed on the master branch of my repo. Please report any problems.
@hivert the master branch now works, I must've pulled from the master branch of my fork instead of yours, sorry about that :/
The only issue now is some compiler warnings:
In file included from tests/../src/../extern/HPCombi/include/perm16.hpp:380:
tests/../src/../extern/HPCombi/include/perm16_impl.hpp:447:5: warning: suggest braces around
initialization of subobject [-Wmissing-braces]
epu8 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14},
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/../src/../extern/HPCombi/include/perm16_impl.hpp:464:5: warning: suggest braces around
initialization of subobject [-Wmissing-braces]
epu8 { 0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15},
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/../src/../extern/HPCombi/include/perm16_impl.hpp:480:5: warning: suggest braces around
initialization of subobject [-Wmissing-braces]
epu8 { FF, 0, FF, 2, FF, 4, FF, 6, FF, 8, FF, 10, FF, 12, FF, 14},
I added a further comment, which I deleted, because I forgot to update travis to use your master branch. Sorry!
@james-d-mitchell: warnings should be silenced now. If you confirm that everything is ok from your side, I'll make another release. Again still a super alpha release because lot of the other stuff is not properly tested and the build system is not finished from my point of view.
The compilation warnings are now gone when compiling with clang. Thanks for the quick fix. With GCC, I'm still getting:
In file included from src/elements.h:39:0,
from src/semigroups.h:31,
from src/cong.h:32,
from src/rws.h:30,
from src/rws.cc:19:
src/../extern/HPCombi/include/perm16.hpp:146:14: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
iter begin() { return as_array().begin(); }
^
src/../extern/HPCombi/include/perm16.hpp:147:12: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
iter end() { return as_array().end(); }
^
src/../extern/HPCombi/include/perm16.hpp: In member function ‘std::array<unsigned char, 16ul>& HPCombi::Vect16::as_array()’:
src/../extern/HPCombi/include/perm16.hpp:128:63: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
return reinterpret_cast<std::array<unsigned char, 16> &>(v);
^
src/../extern/HPCombi/include/perm16.hpp: In member function ‘const std::array<unsigned char, 16ul>& HPCombi::Vect16::as_array() const’:
src/../extern/HPCombi/include/perm16.hpp:135:69: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
return reinterpret_cast<const std::array<unsigned char, 16> &>(v);
^
In file included from src/elements.h:39:0,
from src/semigroups.h:31,
from src/cong.h:32,
from src/rws.h:30,
from src/rws.cc:19:
src/../extern/HPCombi/include/perm16.hpp: In member function ‘std::size_t std::hash<HPCombi::Vect16>::operator()(const HPCombi::Vect16&) const’:
src/../extern/HPCombi/include/perm16.hpp:386:14: error: ISO C++ does not support ‘__int128’ for ‘v0’ [-Werror=pedantic]
__int128 v0 = _mm_extract_epi64(ar.v, 0);
^
src/../extern/HPCombi/include/perm16.hpp:387:14: error: ISO C++ does not support ‘__int128’ for ‘v1’ [-Werror=pedantic]
__int128 v1 = _mm_extract_epi64(ar.v, 1);
^
These are only warnings, showing up as errors because I compiled with -Werror
(to avoid having to remove duplicate warnings).
This is with:
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is very strange. I don't get any of those warning compiling with -Wall with
Are you using any particular picky compiler flag e.g. -pedantic ?
Weird, I'm compiling with the default C/CXXFLAGS (i.e they are unset, and echoing them shows that there are none). Maybe it's not important, in particular, I am not forced to see these warnings since I'm not using GCC regularly.
The problem was fixed in 3c77161f5080234fe6d47e5563028b481361fe30. I'm closing this PR.
I don't know if this is the correct, or a desirable, fix for this issue, but it is not currently possible to build libsemigroups with HPCombi v0.0.1 when
perm16.hpp
is included in more than one source file. The reason is that the static data members and static member functions are included separately in each translation unit, and so linking fails with a duplicate symbols error.The changes in the PR were made against the tag
v0.0.1
. I'm making this PR just to highlight what the issue is and one possible way of resolving it, I'm happy if you have an alternative solution.