-
Notifications
You must be signed in to change notification settings - Fork 17
libwebsockets: compiling and installing
NOTE: Lucas and I test this and got the segfault error:
sketch.elf[1401]: segfault at ffffffff ip b7586959 sp bfe407d4 error 5 in libuClibc-0.9.34-git.so[b754e000+75000]
According to LYT:
You need to copy the libwebsockets.so and libz.so files into hardware\tools\x86\i586-poky-linux-uclibc\usr\lib of your Arduino folder. On top of that you should also set up the libwebsockets as a regular Arduino library by copying the libwebsockets folder in the libraries folder of your Arduino SDK.
Let's try this on Carlos' machine ASAP
####Installing from OPKG repository to CAT Image
Connect CAT image to the web as follows:
wpa_passphrase NetworkName password > /etc/wpa_supplicant.conf
/etc/init.d/networking restart
ifup wlan0
Once you have confirmed you are on the web, go to etc\opkg\base-feeds.conf
and edit it to include this:
src all http://repo.opkg.net/galileo/all
src clanton http://repo.opkg.net/galileo/clanton
src i586 http://repo.opkg.net/galileo/i586
The packages for libwebsockets are not listed so they have to be linked manually. Uclibc ensures we have the right compiler.
opkg install --force-overwrite uclibc
opkg install http://repo.opkg.net/galileo/i586/libwebsockets_1.3-r0_i586.ipk
opkg install http://repo.opkg.net/galileo/i586/libwebsockets-tests_1.3-r0_i586.ipk
opkg install http://repo.opkg.net/galileo/i586/libwebsockets-dbg_1.3-r0_i586.ipk
opkg install http://repo.opkg.net/galileo/i586/libwebsockets-dev_1.3-r0_i586.ipk
opkg install http://repo.opkg.net/galileo/i586/libwebsockets-staticdev_1.3-r0_i586.ipk
I think you only need the first two, but when I run the test root@clanton:# libwebsockets-test-server
it worked!
root@clanton:/usr/lib/temp# whereis libwebsockets
libwebsockets: /usr/lib/libwebsockets.so /usr/include/libwebsockets.h
root@clanton:/usr/lib# ls libwebsockets.so* -l
lrwxrwxrwx 1 root root 22 Jul 6 22:57 libwebsockets.so -> libwebsockets.so.4.0.0
-rwxr-xr-x 1 root root 90160 Oct 23 2014 libwebsockets.so.4.0.0
So the file you need is libwebsockets.so.4.0.0 - and the other file in order to link to it. It says it's version 1.3 and it worked for me so I'm hoping the issue was just that you were not linking the file correctly in the arduino IDE?
####Compiled with the IOTDK Attempt
First, here are the binary files I compiled to install: click to download
Unzip the files and SCP (or copy) them to your board as follows:
-all files from lib
to usr/local/lib
on your galileo. These are the libraries
-all files from bin
to usr/local/bin
on your galileo. These are the examples
####Documentation
libwebsockets compiled on the board image I was using and installed files as follows:
root@sethM:~/libwebsockets/build# make install
[ 43%] Built target websockets
[ 45%] Built target test-client
[ 47%] Built target test-echo
[ 50%] Built target test-fraggle
[ 52%] Built target test-ping
[ 54%] Built target test-server
[ 56%] Built target test-server-extpoll
[100%] Built target websockets_shared
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/libwebsockets.pc
-- Installing: /usr/local/lib/libwebsockets.a
-- Installing: /usr/local/include/libwebsockets.h
-- Installing: /usr/local/lib/libwebsockets.so.5.0.0
-- Installing: /usr/local/lib/libwebsockets.so
-- Up-to-date: /usr/local/include/libwebsockets.h
-- Installing: /usr/local/bin/libwebsockets-test-client
-- Installing: /usr/local/bin/libwebsockets-test-server
-- Installing: /usr/local/bin/libwebsockets-test-server-extpoll
-- Up-to-date: /usr/local/bin/libwebsockets-test-client
-- Installing: /usr/local/bin/libwebsockets-test-fraggle
-- Installing: /usr/local/bin/libwebsockets-test-ping
-- Installing: /usr/local/bin/libwebsockets-test-echo
-- Installing: /usr/local/share/libwebsockets-test-server/favicon.ico
-- Installing: /usr/local/share/libwebsockets-test-server/leaf.jpg
-- Installing: /usr/local/share/libwebsockets-test-server/libwebsockets.org-logo.png
-- Installing: /usr/local/share/libwebsockets-test-server/test.html
-- Installing: /usr/local/share/libwebsockets-test-server/libwebsockets-test-server.key.pem
-- Installing: /usr/local/share/libwebsockets-test-server/libwebsockets-test-server.pem
-- Installing: /usr/local/lib/cmake/libwebsockets/LibwebsocketsTargets.cmake
-- Installing: /usr/local/lib/cmake/libwebsockets/LibwebsocketsTargets-noconfig.cmake
I think the only files that really matter are: libwebsockets.so
and libwebsockets.so.5.0.0
and maybe libwebsockets.a
the static library.
But it's also nice to have the examples. I ran some of the examples installed in /usr/local/bin
such as libwebsockets-test-server
and they ran!
root@sethM:~/libwebsockets/build# libwebsockets-test-server
lwsts[30906]: libwebsockets test server - (C) Copyright 2010-2014 Andy Green <[email protected]> - licensed under LGPL2.1
lwsts[30906]: Initial logging level 7
lwsts[30906]: Library version: 1.3 c0eb2c3
lwsts[30906]: IPV6 compiled in and enabled
lwsts[30906]: libev support not compiled in
lwsts[30906]: static allocation: 4480 + (12 x 1024 fds) = 16768 bytes
lwsts[30906]: canonical_hostname = sethM
lwsts[30906]: per-conn mem: 144 + 2088 headers + protocol rx buf
lwsts[30906]: Compiled with OpenSSL support
lwsts[30906]: Using non-SSL mode
lwsts[30906]: Listening on port 7681
^Clwsts[30906]: libwebsocket_context_destroy
lwsts[30906]: mirror protocol cleaning up