robotconscience / ofxLibwebsockets

[Deprecated] openFrameworks wrapper of libwebsockets for WebSocket client and server functionality
Other
171 stars 68 forks source link

How to use ofxLibwebsockets on RaspberryPI #33

Closed orgicus closed 10 years ago

orgicus commented 10 years ago

I've tried to compile example_server_echo from the addon examples, but ran into this error:

make[1]: *** No rule to make target `../../../addons/obj/linuxarmv6l/Release/ofxLibwebsockets/libs/ofxLibwebsockets/src/ofxLibwebsockets.h', needed by `bin/ofxLibwebsocketsTest'.  Stop.
make: *** [Release] Error 2

How can I get past that and use ofxLibwebsockets ? I am using OpenFrameworks 0.8.0 on RaspberryPI (3.10.36+ #665 PREEMPT Wed Apr 9 15:01:53 BST 2014 armv6l GNU/Linux)

robotconscience commented 10 years ago

Hey George, I'll have to read up on the RPi compilation, not my area if expertise.

However, the current master branch does not have a compiled version of libwebsockets for RPi. You can either: 1 - compile it yourself and add it to your libs path (please submit a PR if you do!) 2 - revert to the last release of ofxLibwebsockets that does have it

@jvcleave any other rpi tips?

On May 2, 2014, at 6:56 PM, George Profenza notifications@github.com wrote:

I've tried to compile example_server_echo from the addon examples, but ran into this error:

make[1]: * No rule to make target ../../../addons/obj/linuxarmv6l/Release/ofxLibwebsockets/libs/ofxLibwebsockets/src/ofxLibwebsockets.h', needed bybin/ofxLibwebsocketsTest'. Stop. make: * [Release] Error 2 How can I get past that and use ofxLibwebsockets ? I am using OpenFrameworks 0.8.0 on RaspberryPI (3.10.36+ #665 PREEMPT Wed Apr 9 15:01:53 BST 2014 armv6l GNU/Linux)

— Reply to this email directly or view it on GitHub.

orgicus commented 10 years ago

Thank you for the prompt answer. I've managed to compile libwebsockets from source but can also grab the previous release. From what I can tell there's something missing in the makefile on RPi but could be something that needs to be added to addon_config.make or something similar to please that.h file. I'll grove this another go in the morning, but once I place the Rpi compiled .a file how should I proceed?

Thanks, George

jvcleave commented 10 years ago

just tried to compile it but it ran the RPi out of memory - looks like it may take some Cmake tweaks

robotconscience commented 10 years ago

OK! Sorry, I still haven't gone down the OF RPi rabbit hole yet. Let me know if there's anything I can fix? Mind submitting a PR if you get it to work?

rc1 commented 10 years ago

Just checking if there is any news on this? Agreed this seems more to do with the makefile than the missing library. This also happens on OSX via the makefile.

rc1 commented 10 years ago

Hi Brett,

I have the fix for this; I think... still running a test.

Before doing a PR, one question: What systems are using addon_config.mk I.e. is Visual Studio using it?

I have had to removed lines from "common:", so if this works with "vs:" I will re-add them there.

Thanks Ross

rc1 commented 10 years ago

Nope. Spoke too soon. Just get segmentation faults with the new library. What version/commit of libwebsockets is this repo up-too-date with? I tried @kikko's branch with the latest libwebsockets but this has issues off windows.

robotconscience commented 10 years ago

Hey Ross, sorry I've been MIA, been gone this weekend. Still away from my comp, but I believe this is what lws commit I'm at: https://github.com/warmcat/libwebsockets/commit/dfca3abfa1da9bf6b0eac53ca11baa115f9ce1d4

LMK where you end up. I'll set aside some time this week to look into this! (And to upgrading lws version / documenting where I'm at better)

On Sep 14, 2014, at 5:51 PM, Ross Cairns notifications@github.com wrote:

Nope. Spoke too soon. Just get segmentation faults with the new library. What version/commit of libwebsockets is this repo up-too-date with? I tried @kikko's branch with the latest libwebsockets but this has issues off windows.

— Reply to this email directly or view it on GitHub.

robotconscience commented 10 years ago

OK, I'm starting a new branch (https://github.com/labatrockwell/ofxLibwebsockets/tree/0.8.4) to knock out some fixes! I updated the libwebsockets version on OS X and had to add a few cases to the Util.h client event catcher. I'll probably have to add a few more to the server ones, will keep you posted.

Give that a try and see if that helps your segfaults!

rc1 commented 10 years ago

Great, thank you Brett! Will try asap and report back.

robotconscience commented 10 years ago

Sounds good! I just pushed fixes for the server as well, so getting somewhere. What changes did you end up needing to make in the addon_config.mk? I've been mostly using it for the OF project generator, so just want to make sure that still works post-changes

rc1 commented 10 years ago

Ha! I was just writing a comment when yours appear. Just referenced changes to the addon_config.mk I had to comment out these lines as well as add the others. Not sure how that will affect others platforms. Also not sure if a segmentation fault could occur if the library (.a) is not being added properly.

Away to pull your latest. Just tried before your last push and was still getting segmentation fault. Will let you know how it goes...

robotconscience commented 10 years ago

Ah! That comment out makes sense. On OS X and windows, those lines just make sure the source files get added to the IDE for clarity; they aren't really necessary there.

Do you know where the segfault is happening? Or with which example?

rc1 commented 10 years ago

No more segmentation faults but it won't connect. I am using example_client_hello_world (also modified for the rpi). I just logs the error:

[ error ] [ofxLibwebsockets] client connection failed

Away to reference this work in progress...

rc1 commented 10 years ago

Hmm... I am short on ideas to try next.

robotconscience commented 10 years ago

Try ofSetLogLevel( OF_LOG_VERBOSE) and put whatever you get here. I may have missed a case or two. Also, are you connecting to echo.websocket.org? Is the network working on the device?

rc1 commented 10 years ago

This is about it...

[verbose] [ofxLibwebsockets] connect: echo.websocket.org:80/:0
[verbose] LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
[verbose] LWS_CALLBACK_PROTOCOL_INIT
[verbose] [ofxLibwebsockets] libwebsocket init success
[ error ] [ofxLibwebsockets] client connection failed
rc1 commented 10 years ago

There shouldn't be any network issues. I have been push & pulling from the Pi. It's on the same network which as the desktop.

robotconscience commented 10 years ago

Hm, I just pushed a quick patch that at least catches the LWS_CALLBACK_PROTOCOL_INIT case... But you should be getting more events after that regardless.

When you compiled libwebsockets for the pi, did you compile the test client apps? If so, try the client test app with the same server:

cd /path/to/libwebsockets/build/bin
./libwebsockets-test-client echo.websocket.org --port=80
rc1 commented 10 years ago

Sorry if this ends up being system related!

When I run the example client, it is not working either:

[1881:9183] NOTICE: Initial logging level 7
[1881:9198] NOTICE: Library version: 1.3 b944cc1
[1881:9210] NOTICE: IPV6 compiled in and enabled
[1881:9222] NOTICE: libev support not compiled in
[1881:9259] NOTICE:  static allocation: 4472 + (12 x 1024 fds) = 16760 bytes
[1881:9283] NOTICE:  canonical_hostname = alarmpi
[1881:9293] NOTICE:  per-conn mem: 140 + 1594 headers + protocol rx buf
[1882:0119] WARN: Unable to open socket
libwebsocket connect failed
Exiting

Going to write a quick node app to see if that can connect.

robotconscience commented 10 years ago

Ah! Make sure that port is open as well. Lots of testing/crashing may have locked up that port.http://superuser.com/questions/127863/manually-closing-a-port-from-commandline

rc1 commented 10 years ago

This is suggesting to compile it without IPV6 support... going to try it and report back.

rc1 commented 10 years ago

Woop! It works. Ok... will create a PR

robotconscience commented 10 years ago

Awesome! PR against this branch. I'll test it on win and merge it in.

On Sep 15, 2014, at 1:14 PM, Ross Cairns notifications@github.com wrote:

Woop! It works. Ok... will create a PR

— Reply to this email directly or view it on GitHub.

rc1 commented 10 years ago

Will do. Can you check that it works with the project generator? If not... I presume the commented code could be move to vs & osx. I will leave this commented code in there for now.

The building of these libraries would be a great use case for apothecary. I have no idea what status that is (not used OF for months).

I hope this works. Thank you for all your help and responsiveness.

robotconscience commented 10 years ago

Awesome! Thank you, happy to get this going (especially after it had been dormant so long). Appreciate your help!

Will keep this issue open 'til it's merged into master.