WANproxy on Linux and/or with gcc...

Juli Mallett juli at clockworksquid.com
Sun May 11 01:16:53 PDT 2014


Thanks for putting up with my sloppiness!  :)

Can you pull the latest changes and try again?  I think I've made the right
fixes.


On Sun, May 11, 2014 at 1:05 AM, Alain-Pierre Perrin <apperrin at wanadoo.fr>wrote:

> Hello Juli and all other WANproxy contributors.
>
>
> Building wanproxy from its brand new git repository, I stumbled on some
> portability problems between BSD and Linux (or, more precisely, between
> their respective default compilers Clang ang gcc). Some of them are
> about not standard (enough) string functions and one is about a missing
> constant.
>
> [...]
> g++ -I../.. -Wno-deprecated -Wnon-virtual-dtor -include common/common.h
> -pipe -O -g -W -Wall -Wno-system-headers -Wno-uninitialized -Wpointer-arith
> -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
> -Wunused-parameter -Wchar-subscripts -Wreorder -DTHREADS -c -o
> proxy_socks_connection.o proxy_socks_connection.cc
> proxy_socks_connection.cc: In member function ‘void
> ProxySocksConnection::write_complete(Event)’:
> proxy_socks_connection.cc:274:34: erreur: ‘strlcpy’ was not declared in
> this scope
>       strlcpy(hex, "0", sizeof hex);
>                                   ^
> proxy_socks_connection.cc:276:61: erreur: ‘snprintf’ was not declared in
> this scope
>       snprintf(hex, sizeof hex, "%0x%02x", bytes[0], bytes[1]);
>                                                              ^
> ../../common/program.mk:103: recipe for target 'proxy_socks_connection.o'
> failed
> make: *** [proxy_socks_connection.o] Error 1
>
> "strlcpy" (plus every "strl*" variant) and "snprintf" seem to raise
> portability issues :
> https://en.wikibooks.org/wiki/C_Programming/C_Reference/nonstandard/strlcpy
>
> https://stackoverflow.com/questions/14519161/how-to-use-strlcpy-in-gs-std-c0x-mode
>
> For "snprintf", I solved it by adding this include in
> proxy_socks_connection.cc :
> #include <cstdio>
>
> https://stackoverflow.com/questions/20149633/how-to-use-snprintf-in-g-std-c11-version-4-8-2
>
> For "strlcpy" I tried to substitute "strncpy" to it. The compiler accepts
> it
> but it may have adverse effects. :P
>
> The compilation then stopped on this missing constant :
> [...]
> g++ -I../.. -Wno-deprecated -Wnon-virtual-dtor -include common/common.h
> -pipe -O -g -W -Wall -Wno-system-headers -Wno-uninitialized -Wpointer-arith
> -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
> -Wunused-parameter -Wchar-subscripts -Wreorder -DTHREADS -c -o
> sleep_queue_posix.o ../../common/thread/sleep_queue_posix.cc
> In file included from ../../common/common.h:32:0,
>                  from <command-line>:0:
> ../../common/thread/sleep_queue_posix.h: In member function ‘void
> SleepQueueState::wait(const NanoTime*)’:
> ../../common/thread/sleep_queue_posix.h:106:62: erreur: ‘ETIMEDOUT’ was
> not declared in this scope
>     ASSERT("/sleep/queue/posix/state", error == 0 || error == ETIMEDOUT);
>                                                               ^
>
> I added this include in common/thread/sleep_queue_posix.cc :
> #include <errno.h>
> ...and then wanproxy built successfully. A cleaner placement could probably
> have been to add my includes in common/common.h like this :
> #ifndef __clang__
> #include <errno.h>
> #include <cstdio>
> #endif
>
> ...to keep "non-clang-isms" neatly grouped.
>
>
> Alain-Pierre
> _______________________________________________
> wanproxy mailing list
> wanproxy at lists.wanproxy.org
> http://lists.wanproxy.org/listinfo.cgi/wanproxy-wanproxy.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wanproxy.org/pipermail/wanproxy-wanproxy.org/attachments/20140511/2ad94f40/attachment.htm>


More information about the wanproxy mailing list