[Libwebsockets] problems compiling on Raspberry Pi, Debian Wheezy

Andy Green andy at warmcat.com
Tue May 6 01:52:15 CEST 2014

On 6 May 2014 07:41:12 GMT+08:00, Kristopher Wehage <ktwehage at ucdavis.edu> wrote:
>Hi all, I am trying to compile libwebsockets on a raspberry pi, model B
>running Debian Wheezy. I can succesfully build libwebsockets using the 
>instructions in the README.build file, however when I try to run the 
>libwebsockets-test-server application, I get an error.

I can make an educated guess the problem is the raspberry pi kernel lacks ipv6 support configured in.

Try disable ipv6 support at cmake and see if the problem goes away.

A lot of these low-cost boards still have badly incomplete support in mainline kernel, forcing dependency on old magic vendor kernels that can't be regenerated.  And if they lack something you need (iptables...) you're just screwed unless you want to waste a lot of time in "vendor kernel archaeology".


>Here are the steps I followed.
>1. Per the README.build instructions, I installed OpenSSL, created the 
>build directory within the libwebsockets folder, and ran 'cmake ..' 
>within the build directory.
>When I do that I get the following output:
>kristopher at raspberrypi /usr/src/libwebsockets/build $ sudo cmake ..
>-- The C compiler identification is GNU 4.6.3
>-- The CXX compiler identification is GNU 4.6.3
>-- Check for working C compiler: /usr/bin/gcc
>-- Check for working C compiler: /usr/bin/gcc -- works
>-- Detecting C compiler ABI info
>-- Detecting C compiler ABI info - done
>-- Check for working CXX compiler: /usr/bin/c++
>-- Check for working CXX compiler: /usr/bin/c++ -- works
>-- Detecting CXX compiler ABI info
>-- Detecting CXX compiler ABI info - done
>-- Found Git: /usr/bin/git
>Git commit hash: 7cc7ae4
>-- Performing Test HAVE_inline
>-- Performing Test HAVE_inline - Success
>-- Performing Test HAVE___inline__
>-- Performing Test HAVE___inline__ - Success
>-- Performing Test HAVE___inline
>-- Performing Test HAVE___inline - Success
>-- Looking for bzero
>-- Looking for bzero - found
>-- Looking for fork
>-- Looking for fork - found
>-- Looking for getenv
>-- Looking for getenv - found
>-- Looking for malloc
>-- Looking for malloc - found
>-- Looking for memset
>-- Looking for memset - found
>-- Looking for realloc
>-- Looking for realloc - found
>-- Looking for socket
>-- Looking for socket - found
>-- Looking for strerror
>-- Looking for strerror - found
>-- Looking for vfork
>-- Looking for vfork - found
>-- Looking for getifaddrs
>-- Looking for getifaddrs - found
>-- Looking for dlfcn.h
>-- Looking for dlfcn.h - found
>-- Looking for fcntl.h
>-- Looking for fcntl.h - found
>-- Looking for in6addr.h
>-- Looking for in6addr.h - not found
>-- Looking for inttypes.h
>-- Looking for inttypes.h - found
>-- Looking for memory.h
>-- Looking for memory.h - found
>-- Looking for netinet/in.h
>-- Looking for netinet/in.h - found
>-- Looking for stdint.h
>-- Looking for stdint.h - found
>-- Looking for stdlib.h
>-- Looking for stdlib.h - found
>-- Looking for strings.h
>-- Looking for strings.h - found
>-- Looking for string.h
>-- Looking for string.h - found
>-- Looking for sys/prctl.h
>-- Looking for sys/prctl.h - found
>-- Looking for sys/socket.h
>-- Looking for sys/socket.h - found
>-- Looking for sys/stat.h
>-- Looking for sys/stat.h - found
>-- Looking for sys/types.h
>-- Looking for sys/types.h - found
>-- Looking for unistd.h
>-- Looking for unistd.h - found
>-- Looking for vfork.h
>-- Looking for vfork.h - not found
>-- Looking for zlib.h
>-- Looking for zlib.h - found
>-- Looking for 4 include files stdlib.h, ..., float.h
>-- Looking for 4 include files stdlib.h, ..., float.h - found
>-- Looking for stddef.h
>-- Looking for stddef.h - found
>-- Check size of pid_t
>-- Check size of pid_t - done
>-- Check size of size_t
>-- Check size of size_t - done
>-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version
>ZLib include dirs: /usr/include
>ZLib libraries: /usr/lib/arm-linux-gnueabihf/libz.so
>Compiling with SSL support
>-- Found OpenSSL: 
>(found version "1.0.1e")
>OpenSSL include dir: /usr/include
>OpenSSL libraries: 
>Searching for OpenSSL executable and dlls
>OpenSSL executable: /usr/bin/openssl
>Generating SSL Certificates for the test-server...
>Generating a 1024 bit RSA private key
>writing new private key to 
>You are about to be asked to enter information that will be
>into your certificate request.
>What you are about to enter is what is called a Distinguished Name or a
>There are quite a few fields but you can leave some blank
>For some fields there will be a default value,
>If you enter '.', the field will be left blank.
>Country Name (2 letter code) [AU]:State or Province Name (full name) 
>[Some-State]:Locality Name (eg, city) []:Organization Name (eg,
>[Internet Widgits Pty Ltd]:Organizational Unit Name (eg, section) 
>[]:Common Name (e.g. server FQDN or YOUR name) []:Email Address 
>[]:SUCCSESFULLY generated SSL certificate
>Generating API documentation
>-- Looking for RPMTools... - found rpmuild is /usr/bin/rpmbuild
>-- RPMTools:: Using RPM_ROOTDIR=/usr/src/libwebsockets/build/RPM
>-- Simple copy spec file <libwebsockets.spec> --> 
>   Settings:  (For more help do cmake -LH <srcpath>
>  LWS_WITH_SSL = ON  (SSL Support)
>  LWS_USE_CYASSL = OFF (CyaSSL replacement for OpenSSL)
>  LWS_IPV6 = ON
>-- Configuring done
>-- Generating done
>-- Build files have been written to: /usr/src/libwebsockets/build
>2. 'make'
>3. 'make install'
>4. Run the test server by issuing 'libwebsockets-test-server' (or 
>alternatively cd to the libwebsockets/build/bin/ directory and issue 
>I then get the following error message:
>$ sudo ./libwebsockets-test-server
>lwsts[27525]: libwebsockets test server - (C) Copyright 2010-2013 Andy 
>Green <andy at warmcat.com> - licensed under LGPL2.1
>lwsts[27525]: Initial logging level 7
>lwsts[27525]: Library version: 1.3 7cc7ae4
>lwsts[27525]: IPV6 compiled in and enabled
>lwsts[27525]: libev support not compiled in
>lwsts[27525]:  static allocation: 4468 + (12 x 1024 fds) = 16756 bytes
>lwsts[27525]:  canonical_hostname = raspberrypi
>lwsts[27525]:  per-conn mem: 128 + 1554 headers + protocol rx buf
>lwsts[27525]:  Compiled with OpenSSL support
>lwsts[27525]:  Using non-SSL mode
>lwsts[27525]: ERROR opening socket
>lwsts[27525]: libwebsocket_context_destroy
>lwsts[27525]: mirror protocol cleaning up
>lwsts[27525]: libwebsocket init failed
>I thought it was strange that there was no flag speficied for 
>LWS_USE_LIBEV, so I ran 'cmake -LH ..'
>The output shows that the LWS_WITH_LIBEV:BOOL flag is set to off.
>// Compile with support for libev
>Do you have any advice for me? I have successfully installed and ran
>test applications on my 64 bit Linux workstation no problem. No luck so
>far on the Raspberry Pi.
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list