OpenZWave / open-zwave

a C++ library to control Z-Wave Networks via a USB Z-Wave Controller.
http://www.openzwave.net/
GNU Lesser General Public License v3.0
1.05k stars 911 forks source link

Cross compilation for Asus RT-N16 #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have Asus RT-N16 (running on Broadcom 47xx, linux). Trying to cross-compile 
the library on Ubuntu 10.04 (thru VMWare Player).

What steps will reproduce the problem?
1. Download toochain from 
http://code.google.com/p/wl500g/downloads/list?can=3&q=hndtools-mipsel-uclibc-4.
4.6-K26&colspec=Filename+Summary+Uploaded+Size+DownloadCount
2. Add that to the path:
PATH=$PATH:/home/user/hndtools-mipsel-uclibc-4.4.6-K26/bin/
3. Install subversion:
sudo apt-get install subversion
4. Checkout all needed files:
svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave
5. Add to /open-zwave/cpp/build/linux/Makefile
CROSS_COMPILE = mipsel-linux-
6. Try to make
user@ubuntu1004desktop:~/open-zwave/cpp/build/linux$ make
...
../../hidapi/linux/hid.c:40:26: error: linux/hidraw.h: No such file or directory
../../hidapi/linux/hid.c:42:21: error: libudev.h: No such file or directory
../../hidapi/linux/hid.c:62: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'kernel_version'
...
7. Replace gcc with mipsel-linux-gcc, g++ with mipsel-linux-g++ at 
/home/user/open-zwave/cpp/hidapi/linux/Makefile
8. Try to make HIDAPI:
user@ubuntu1004desktop:~/open-zwave/cpp/hidapi/linux$ make
It returns a lot of errors.

Original issue reported on code.google.com by and7ey@gmail.com on 5 Sep 2011 at 6:24

GoogleCodeExporter commented 9 years ago
This is the same thing as before.  Before reporting a bug, take a little time 
first.  Clearly in this case, you are missing the linux/hidraw.h header; this 
is part of the kernel headers, which you will need for your toolchain/target 
system.

Yes, we could document a little better the library requirements here.  

Regards.

Original comment by pnau...@gmail.com on 6 Sep 2011 at 2:08

GoogleCodeExporter commented 9 years ago
Sorry, I am quite new to linux (first of all), to C/C++ coding and 
cross-compilation, so have to ask such questions. Hope, this is right place for 
them. I'll try to find hidraw.h and compile that for my target system.

I also tried to compile hidapi and got the following errors:

user@ubuntu1004desktop:~/open-zwave/cpp/hidapi/linux$ make
mipsel-linux-gcc -I../hidapi -Wall -g -c `pkg-config libusb-1.0 --cflags` 
hid-libusb.c -o hid-libusb.o
hid-libusb.c:44:19: error: iconv.h: No such file or directory
hid-libusb.c: In function 'get_usb_string':
hid-libusb.c:313: error: 'iconv_t' undeclared (first use in this function)
hid-libusb.c:313: error: (Each undeclared identifier is reported only once
hid-libusb.c:313: error: for each function it appears in.)
hid-libusb.c:313: error: expected ';' before 'ic'
hid-libusb.c:341: error: 'ic' undeclared (first use in this function)
hid-libusb.c:341: warning: implicit declaration of function 'iconv_open'
hid-libusb.c:351: warning: implicit declaration of function 'iconv'
hid-libusb.c:361: warning: implicit declaration of function 'wcsdup'
hid-libusb.c:361: warning: assignment makes pointer from integer without a cast
hid-libusb.c:364: warning: implicit declaration of function 'iconv_close'
make: *** [hid-libusb.o] Error 1

Looks like I also should find iconv.h and compile that, right?

Original comment by and7ey@gmail.com on 6 Sep 2011 at 2:50

GoogleCodeExporter commented 9 years ago
This is not really the right place.  I assume you're targeting DD-wrt.  You 
should consult its forums for general questions on cross compilation for your 
system, especially if you are a novice.  If you think there are specific issues 
related to cross-compilation (which works fine for me on OpenWrt) then you can 
bring them here.

Original comment by pnau...@gmail.com on 6 Sep 2011 at 3:24

GoogleCodeExporter commented 9 years ago
I am targeting another firmware (wl500g.info). 
I've raised the same questions at according forum, but I am not getting answers 
there since this library is not so popular as well as open z-wave not popular.

Could you please publish your steps (probably, as wiki article) to compile that 
for OpenWrt? Or publish binary version?
Thanks a lot in advance.

Original comment by and7ey@gmail.com on 6 Sep 2011 at 3:41

GoogleCodeExporter commented 9 years ago
My binaries are of no use to you.  The openzwave build is not special in any 
way.  I refer you to previous discussion on the list about this matter:

http://groups.google.com/group/openzwave/browse_thread/thread/cf1f970962714d9d/a
93a9ccc3f6039c9?lnk=gst&q=openwrt#

Adding openzwave to any cross compilation environment is not different to 
adding anything else.  If you have further openzwave specific issues, then 
start a new thread on the mailing list.

Original comment by pnau...@gmail.com on 6 Sep 2011 at 3:59