brighton36 / phidgets_native

Native C-extension gem for the Phidgets library in ruby
3 stars 1 forks source link

Doesn't compile on Raspberry Pi with Raspbian #3

Closed joshuasiler closed 10 years ago

joshuasiler commented 10 years ago

Tried both the repo version and master. Latest drivers are installed and Phidgets FFi gem works. Both times I get:

ruby ./extconf.rb checking for phidget21.h in /Library/Frameworks/Phidget21.framework/Headers... yes checking for CPhidget_getLibraryVersion() in -llibphidget21... no checking for main() in -lphidget21... yes creating Makefile

and....

make compiling ir_ruby.c In file included from ir_ruby.c:1:0: phidgets_native.h:52:19: error: field âattached_at_tzâ has incomplete type make: *\ [ir_ruby.o] Error 1

Any ideas?

brighton36 commented 10 years ago

I was able to get this to compile on my raspberry pi not that long ago, so I'm fairly certain this should be a trivial fix. Are you compiling with gcc or clang? try changing the "#include " to "#include <sys/time.h>" (at the top of the file) and see if it compiles? Let's get this bug resolved, and then I'll release an updated gem :)

joshuasiler commented 10 years ago

Hi, with that change I get a different error:

compiling ir_ruby.c
In file included from ir_ruby.c:1:0:
phidgets_native.h:129:12: error: field ânow_at_utcâ has incomplete type
make: *** [ir_ruby.o] Error 1
joshuasiler commented 10 years ago

Also, I believe I'm using gcc

brighton36 commented 10 years ago

I think it's just the headers that are weird on the pi. It's been a while since I built on that platform, apparently I distanced myself from the stock build environment. Try adding a "#include " to the top and/or adding the "#include

joshuasiler commented 10 years ago

Nice. I started by adding time.h back and that worked.

Thanks for supporting your code! Pull request submitted.

brighton36 commented 10 years ago

My pleasure. Mind if I ask what you're making with it?

joshuasiler commented 10 years ago

I'm building a new saltwater aquarium system, and I'm using the Raspberry Pi as a custom controller to monitor conditions and manage pumps, heaters and lights. Fun little project. My monitor code is getting some difficult to trace malloc errors after a random amount of time... I'm hoping switching from phidgets-FFI to your code will fix the problem.

brighton36 commented 10 years ago

Awesome. Maybe post a youtube video when you get it working?

joshuasiler commented 10 years ago

sure thing... although I have a feeling it's one of those "never quite finished" projects