我正在尝试运行 libonion 的 websockets.c 示例(https://github.com/davidmoreno/onion/tree/master/examples/websockets)。但是,当我运行它时,它会出现此错误。
“[ERROR codecs.c:389] 如果未编译 gnutls,则无法计算 SHA1!现在中止”
其他示例运行良好。
我正在编译:
$ gcc -o muz websockets.c -I$ONION_DIR/src/ -L$ONION_DIR/src/onion/ -lonion_static -Lpam -Lgnutls -Lgcrypt -lpthread
终端输出如下所示。
[49CDC700] [2017-08-21 11:26:12] [DEBUG onion.c:216] Ignoring SIGPIPE
[49CDC700] [2017-08-21 11:26:12] [DEBUG poller.c:328] Init thread stuff for poll. Eventfd at 4
[49CDC700] [2017-08-21 11:26:12] [DEBUG poller.c:328] Init thread stuff for poll. Eventfd at 4
[49CDC700] [2017-08-21 11:26:12] [DEBUG onion.c:649] add 0x136a400 listen_point (0x136a470, 0x136a400, (nil))
[49CDC700] [2017-08-21 11:26:12] [DEBUG onion.c:461] Created default HTTP listen port
[49CDC700] [2017-08-21 11:26:12] [DEBUG listen_point.c:192] Trying to listen at (null):8080
[49CDC700] [2017-08-21 11:26:12] [DEBUG listen_point.c:233] Listening to 0.0.0.0:8080, fd 6
[49CDC700] [2017-08-21 11:26:12] [DEBUG onion.c:507] Adding listen point fd 6 to poller
[49CDC700] [2017-08-21 11:26:12] [DEBUG onion.c:515] Start polling / listening 0x136a470, 0x136a400, (nil)
[494F1700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[48CF0700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[474ED700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[47CEE700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[484EF700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[46CEC700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[49CDC700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[464EB700] [2017-08-21 11:26:12] [DEBUG poller.c:497] Start polling
[464EB700] [2017-08-21 11:26:26] [DEBUG response.c:104] Recalculating date header
[464EB700] [2017-08-21 11:26:26] [INFO response.c:189] [127.0.0.1] "GET /" 200 501 (Keep-Alive)
[464EB700] [2017-08-21 11:26:26] [DEBUG websocket.c:88] Websockets!
[464EB700] [2017-08-21 11:26:26] [ERROR codecs.c:389] Cant calculate SHA1 if gnutls is not compiled in! Aborting now