Closed daniele77 closed 7 years ago
I just wonder if clang 3.5 is supported compiler because this library IMO needs C++14.
P.
On Aug 24, 2017 17:39, "Daniele Pallastrelli" notifications@github.com wrote:
Can't compile with clang v. 3.5.0 a simple cpp file including the header file superior_mysql.hpp:
int main() { return 0; }
I've tried both with latest commits (c57030c https://github.com/seznam/SuperiorMySqlpp/commit/c57030c4312e80ae9300af1543b812033c2686b5 and 4428775 https://github.com/seznam/SuperiorMySqlpp/commit/44287752dff36a8c99bcd9e25b93df40f572b01b ).
The errors produced are the following:
In file included from superior_mysqlpp/logging.hpp:18:
superior_mysqlpp/prepared_statements/validate_metadata_modes.hpp:120:17:
error: inline declaration of 'isCompatible<0>' follows
non-inline definition
inline bool
isCompatible
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seznam/SuperiorMySqlpp/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzXnYo7XWFnBVcLJ9vh-eEaI6gGpb3Zks5sbZlLgaJpZM4PBjye .
According to clang C++ support page, Clang 3.4 and later impolement all of the ISO C++ 2014 standard. Of course, I compiled with the appropriate flag to ensure c++14 was enabled. I hope you can fix this because e.g., debian stable distros come with an old clang package.
I tried compiling the library itself using:
Debian clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
from
$ apt-cache policy clang-3.5
clang-3.5:
Installed: 1:3.5~svn212963-1~exp1
Candidate: 1:3.5~svn212963-1~exp1
Version table:
*** 1:3.5~svn212963-1~exp1 0
500 http://llvm.org/apt/wheezy/ llvm-toolchain-wheezy/main amd64 Packages
100 /var/lib/dpkg/status
And it fails on
error: invalid value 'c++14' in '-std=c++14'
So it seems, that clang 3.5.x
doesn't support required C++14 or the precompiled packages provided by llvm.org are from some really old branch.
Are you sure you're compiling using clang++
and not clang
by mistake?
I'm compiling with:
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: i386-pc-linux-gnu
Thread model: posix
and the flag -std=c++14
is correctly supported. Exactly as indicated in this page:
https://clang.llvm.org/cxx_status.html
C++14 implementation status
Clang 3.4 and later implement all of the ISO C++ 2014 standard.
You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).
This is what I get:
$ clang++ -std=c++14 tests/uncaught_exception_counter.cpp
error: invalid value 'c++14' in '-std=c++14'
$ clang++ --version
Debian clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
I think the version 3.5.0-1~exp1 (trunk)
is not tagged in the repository, maybe has got some issue with the flag.
Could you please try with -std=c++1y
, instead? It should be the same that -std=c++14
.
Thanks
I got compiler errors, seems like the llvm.org clang 3.5.0-1~exp1 version is incomplete. I'll try Debian Jessie with different clang++ 3.5 package later.
$ CXX=clang++ CC=clang make -j1 test
make -C ./tests/ test
make[1]: Entering directory `/home/patrik/work/sklik/SuperiorMySqlpp/tests'
clang++ -std=c++1y -pedantic-errors -Wall -Wextra -Wswitch-enum -Wnarrowing -DHAVE_CLANG -Werror -fPIC -fsanitize=address -fsanitize=leak -fsanitize=undefined -g3 -I../include/ -I../third_party/bandit/ -DDEBUG -O0 -c -MMD -o converters/converters.o converters/converters.cpp
In file included from converters/converters.cpp:8:
In file included from ../include/superior_mysqlpp/converters.hpp:10:
../include/superior_mysqlpp/converters/to_integer.hpp:253:17: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_unsigned<T>::value, T> toInteger(const char* str, unsigned int length)
~~~~~^~~~~~~~~~~
enable_if
With
$ clang++-3.5 --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
I get simillar error you reported:
$ CXX=clang++-3.5 CC=clang-3.5 make -j1 test
make -C ./tests/ test
make[1]: Entering directory '/home/patrik/work/sklik/SuperiorMySqlpp/tests'
clang++-3.5 -std=c++14 -pedantic-errors -Wall -Wextra -Wswitch-enum -Wnarrowing -DHAVE_CLANG -Werror -fPIC -fsanitize=address -fsanitize=leak -fsanitize=undefined -g3 -I../include/ -I../third_party/bandit/ -DDEBUG -O0 -c -MMD -o converters/converters.o converters/converters.cpp
In file included from converters/converters.cpp:8:
In file included from ../include/superior_mysqlpp/converters.hpp:11:
../include/superior_mysqlpp/converters/to_floating_point.hpp:27:18: error: inline declaration of 'toFloatingPoint<float>' follows non-inline definition
inline float toFloatingPoint(const char* str, std::size_t length)
^
../include/superior_mysqlpp/converters/to_floating_point.hpp:27:18: note: previous definition is here
../include/superior_mysqlpp/converters/to_floating_point.hpp:37:19: error: inline declaration of 'toFloatingPoint<double>' follows non-inline definition
inline double toFloatingPoint(const char* str, std::size_t length)
^
../include/superior_mysqlpp/converters/to_floating_point.hpp:37:19: note: previous definition is here
../include/superior_mysqlpp/converters/to_floating_point.hpp:47:24: error: inline declaration of 'toFloatingPoint<long double>' follows non-inline definition
inline long double toFloatingPoint(const char* str, std::size_t length)
^
../include/superior_mysqlpp/converters/to_floating_point.hpp:47:24: note: previous definition is here
3 errors generated.
makefile:101: recipe for target 'converters/converters.o' failed
But it doesn't make sense to me. I need more time.
Thanks. I'll try to help in my (few) spare time
I finally found something but it's not a good news: Specialized template function with deleted “general” case fails to compile with g++ <=4.8.0 and clang++
Looks like the clang++ << 3.9.0 implemented C++14 draft, that was later polished so later versions of clang accept current source. I'm affraid this won't be fixed.
Thanks anyway. At least I learned that clang I'm using has not got that feature :-) I'll try to install a more recent version of clang: I read that multiple version can cohexist on Debian so I hope it won't be a big deal. Thanks again.
Can't compile with clang v. 3.5.0 a simple cpp file including the header file superior_mysql.hpp:
I've tried both with latest commits (c57030c and 4428775).
The errors produced are the following: