tatsuhiro-t / wslay

The WebSocket library in C
https://tatsuhiro-t.github.io/wslay/
MIT License
608 stars 129 forks source link

Building fails with 'invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*'' #45

Open plusky opened 6 years ago

plusky commented 6 years ago

When building on currenct openSUSE, following occurs:

[   45s] g++ -DHAVE_CONFIG_H -I. -I..  -Wall -I../lib/includes -I../lib/includes  -DHAVE_CONFIG_H   -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -c -o echoserv.o echoserv.cc
[   46s] echoserv.cc: In function 'std::__cxx11::string base64(const string&)':
[   46s] echoserv.cc:126:83: error: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*' [-fpermissive]
[   46s]    base64_encode_raw(dst, src.size(), reinterpret_cast<const uint8_t*>(src.c_str()));
[   46s]                                                                                    ^
[   46s] In file included from echoserv.cc:52:0:
[   46s] /usr/include/nettle/base64.h:117:1: note:   initializing argument 1 of 'void nettle_base64_encode_raw(char*, size_t, const uint8_t*)'
[   46s]  base64_encode_raw(char *dst, size_t length, const uint8_t *src);
[   46s]  ^

Building with -fpermissive as wourkaround helps

vdloo commented 6 years ago

ran into this too:

# make
make  all-recursive
make[1]: Entering directory '/usr/etc/wslay'
Making all in lib
make[2]: Entering directory '/usr/etc/wslay/lib'
Making all in includes
make[3]: Entering directory '/usr/etc/wslay/lib/includes'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/usr/etc/wslay/lib/includes'
make[3]: Entering directory '/usr/etc/wslay/lib'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/usr/etc/wslay/lib'
make[2]: Leaving directory '/usr/etc/wslay/lib'
Making all in tests
make[2]: Entering directory '/usr/etc/wslay/tests'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/etc/wslay/tests'
Making all in examples
make[2]: Entering directory '/usr/etc/wslay/examples'
g++ -DHAVE_CONFIG_H -I. -I..  -Wall -I../lib/includes -I../lib/includes  -DHAVE_CONFIG_H   -g -O2 -MT echoserv.o -MD -MP -MF .deps/echoserv.Tpo -c -o echoserv.o echoserv.cc
echoserv.cc: In function 'std::__cxx11::string base64(const string&)':
echoserv.cc:126:83: error: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*' [-fpermissive]
   base64_encode_raw(dst, src.size(), reinterpret_cast<const uint8_t*>(src.c_str()));
                                                                                   ^
In file included from echoserv.cc:52:0:
/usr/include/nettle/base64.h:117:1: note:   initializing argument 1 of 'void nettle_base64_encode_raw(char*, size_t, const uint8_t*)'
 base64_encode_raw(char *dst, size_t length, const uint8_t *src);
 ^
make[2]: *** [Makefile:506: echoserv.o] Error 1
make[2]: Leaving directory '/usr/etc/wslay/examples'
make[1]: *** [Makefile:442: all-recursive] Error 1
make[1]: Leaving directory '/usr/etc/wslay'
make: *** [Makefile:370: all] Error 2

edit: Archlinux updated nettle to 3.4-1 on 2017-11-21. this commit looks like it might be related https://git.lysator.liu.se/nettle/nettle/commit/f2da403135e2b2f641cf0f8219ad5b72083b7dfd

ryanmjacobs commented 6 years ago

I ran into this issue as well. Please merge in one of these fixes.

tatsuhiro-t commented 6 years ago

49 fixed this issue.

YuyaAizawa commented 5 years ago

I got the same error on the same line. #4a937cd My OS is Raspbian.

# make
make  all-recursive
make[1]: Entering directory '/home/poi/git/wslay'
Making all in lib
make[2]: Entering directory '/home/poi/git/wslay/lib'
Making all in includes
make[3]: Entering directory '/home/poi/git/wslay/lib/includes'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/poi/git/wslay/lib/includes'
make[3]: Entering directory '/home/poi/git/wslay/lib'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/poi/git/wslay/lib'
make[2]: Leaving directory '/home/poi/git/wslay/lib'
Making all in tests
make[2]: Entering directory '/home/poi/git/wslay/tests'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/poi/git/wslay/tests'
Making all in examples
make[2]: Entering directory '/home/poi/git/wslay/examples'
g++ -DHAVE_CONFIG_H -I. -I..  -Wall -I../lib/includes -I../lib/includes  -DHAVE_CONFIG_H   -g -O2 -MT echoserv.o -MD -MP -MF .deps/echoserv.Tpo -c -o echoserv.o echoserv.cc
echoserv.cc: In function ‘std::__cxx11::string base64(const string&)’:
echoserv.cc:126:83: error: invalid conversion from ‘char*’ to ‘uint8_t* {aka unsigned char*}’ [-fpermissive]
   base64_encode_raw(dst, src.size(), reinterpret_cast<const uint8_t*>(src.c_str()));
                                                                                   ^
In file included from echoserv.cc:52:0:
/usr/include/nettle/base64.h:115:1: note:   initializing argument 1 of ‘void nettle_base64_encode_raw(uint8_t*, size_t, const uint8_t*)’
 base64_encode_raw(uint8_t *dst, size_t length, const uint8_t *src);
 ^
Makefile:507: recipe for target 'echoserv.o' failed
make[2]: *** [echoserv.o] Error 1
make[2]: Leaving directory '/home/poi/git/wslay/examples'
Makefile:443: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/poi/git/wslay'
Makefile:371: recipe for target 'all' failed
make: *** [all] Error 2