cross compile z-connector for ARM?

Discussions about Z-Way software and Z-Wave technology in general
wtip
Posts: 1
Joined: 17 Aug 2011 05:55

cross compile z-connector for ARM?

Post by wtip »

I have a small computer that is based on the Sheevaplug platform. It has an arm processor with 128MB of RAM.
Processor : Feroceon 88FR131 rev 1 (v5l)
Kernel: 2.6.32-5-kirkwood #1 Tue Mar 8 10:56:14 UTC 2011 armv5tel GNU/Linux

It's running debian linux. I have never cross compiled anything before. How would I go about this?
Does the z-connector software use a lot of ram?
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Yes, it is possible!

Post by PoltoS »

Z-Connector is designed to be extremely small and portable. It runs on powerful Intel 500Mhz Geode boxes with 256MB RAM as well as on simple OpenWRT routers (like Asus WL-500g) and on Fritz Box.

In your personal Z-Connector package downloadable from our site you can find sources of Z-Agent (command line utility for Z-Connector GUI). It can be compiled on Windows, Unix and GNU/Linux platforms.

To avoid cross-compilation try first to install gcc on your box. Since it is Debian, it should be possible, provided you have enough space (use external flash drive for this). If gcc is not available for this Debian distro, cross-compilation is the only way to build it. Most of embedded Linux distributions comes with toolkit for developers. You should probably refer to the description of your Debian distribution.

For example the distribution we have tested (Voyage, based on Debian too) have gcc packages available to compile new software directly on the box. OpenWRT distro have well done toolkit to cross-compile your own software on the PC.

Z-Agent is dependant only from three libraries: libargtable2, libssl and libcrypto.

You are welcome to make a short report about your experience with your ARM box on this forum. Other users might also enjoy your solution.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Fritz Box 7170

Post by pz1 »

I happen to have a Fritzbox 7170 (German version ISDN). Has it been compiled for that platform? If so is it available as installable package? (I did find this unsuccessful post: http://en.z-wave.me/content/fritzbox)

PS: I am also trying to get it to work on my Synology DS212+ (ARM mv6282). Linux is rather harsh on users unfortunately. After the command 'make clean all' I get a lot of SSL related errors:

DS212> make clean all
rm -f *.o z-agent
g++ -c ioutil.c
In file included from ioutil.c:1:
common.h:14:25: error: openssl/ssl.h: No such file or directory
common.h:47:7: warning: no newline at end of file
In file included from ioutil.c:2:
ioutil.h:10:7: warning: no newline at end of file
ioutil.c:3:25: error: openssl/err.h: No such file or directory
In file included from ioutil.c:4:
ssl.h:21:7: warning: no newline at end of file
In file included from ioutil.c:5:
log.h:16:7: warning: no newline at end of file
ioutil.c:98:2: warning: no newline at end of file
In file included from ioutil.c:2:
ioutil.h:5: error: 'SSL' has not been declared
In file included from ioutil.c:4:
ssl.h:10: error: expected constructor, destructor, or type conversion before '*' token
ssl.h:13: error: variable or field 'SSLFreeContext' declared void
ssl.h:13: error: 'SSL_CTX' was not declared in this scope
ssl.h:13: error: 'ctx' was not declared in this scope
ssl.h:16: error: expected constructor, destructor, or type conversion before '*' token
ssl.h:19: error: variable or field 'SSLCloseSession' declared void
ssl.h:19: error: 'SSL' was not declared in this scope
ssl.h:19: error: 'ssl' was not declared in this scope
ioutil.c:7: error: 'SSL' has not been declared
ioutil.c: In function 'int ReadSockTimeout(SOCKET, int*, char*, size_t, long int)':
ioutil.c:21: error: 'SSL_read' was not declared in this scope
ioutil.c:23: error: 'SSL_get_error' was not declared in this scope
ioutil.c:25: error: 'SSL_ERROR_NONE' was not declared in this scope
ioutil.c:28: error: 'SSL_ERROR_ZERO_RETURN' was not declared in this scope
ioutil.c:34: error: 'ERR_get_error' was not declared in this scope
ioutil.c:34: error: 'ERR_reason_error_string' was not declared in this scope
make: *** [ioutil.o] Error 1


OpenSSL 0.9.8v 19 Apr 2012, was already installed on my machine by Synology.
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

openssl/ssl.h is missing

Post by PoltoS »

You have to install libssl-dev package (this is the name of package under Ubuntu/Debian, but should be similiar on other platforms).

Why are you compiling on the Synology box and not on your PC (cross-compilation)?

There is no package for Fritz!Box yet. It is not so easy to make one, since it has to be on a flash stick and loaded every time during boot time. But may be for more modern boxes it is different.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Fritzbox 7170 is not on my

Post by pz1 »

Fritzbox 7170 is not on my critical path, but would have been nice for an absolute low power solution.
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Copy artable2.h file to your box in system include folder

Post by PoltoS »

The problem resides in the line:
main.c:3:23: error: argtable2.h: No such file or directory

First of all make sure argtable2 lib is installed on your box. Certainly the .h file is somewhere too.

If not, take sources of that lib at http://argtable.sourceforge.net/. Download the full sources and extract src/argtable2.h file only. Copy it to your box in something like /usr/include/

This should help.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

No argtable2 lib available for DS212+

Post by pz1 »

1) Because I use IPKG packages, I did copy argtable2.h to the IPKG path /opt/include . I do not get the above errors anymore. Except for the 'warning: no newline at end of file. Must I manually correct those sources?

2) Unfortunately there is no argtable2 lib available for DS212+. Also I have not yet been able to compile and install it from the sources you mention. I tried the instructions from the README to no avail. The second command .configure just fails, does not exist. Yes it is Linux, these guys are there to make my life miserable. I assume I have to do some of the tricks that are obvious only to them.

So as a result of the missing library I guess the compilateion of the z-agent failed as shown below. Anyhow, it is one step ahead :)

g++ ioutil.o main.o log.o serial.o ssl.o -lssl -largtable2 -lcrypto -o z-agent
/opt/lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/bin
/ld: cannot find -largtable2
collect2: ld returned 1 exit status
make: *** [z-agent] Error 1
DS212>
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Yes, the last step is to get

Post by PoltoS »

Yes, the last step is to get argtable2 library for your box. You should probably try to get support from the community, but usually the compilation is done by simple ./configure && make && make install. Note, that it is not .configure, but ./configure. It just means run configure file in current (.) folder.Here is an example of successful compilation of argtable2 for similiar box (it is cross-compilation, so throw away all CC=... arguments).You don't need to fix no newline warning. It's just a warning.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

I am not yet there, but

Post by pz1 »

I am not yet there, but installation of openssl-dev resulted in this:

DS212> make clean all
rm -f *.o z-agent
g++ -c ioutil.c
In file included from ioutil.c:1:
common.h:47:7: warning: no newline at end of file
In file included from ioutil.c:2:
ioutil.h:10:7: warning: no newline at end of file
In file included from ioutil.c:4:
ssl.h:21:7: warning: no newline at end of file
In file included from ioutil.c:5:
log.h:16:7: warning: no newline at end of file
ioutil.c:98:2: warning: no newline at end of file
g++ -c main.c
In file included from main.c:1:
common.h:47:7: warning: no newline at end of file
main.c:3:23: error: argtable2.h: No such file or directory
In file included from main.c:5:
log.h:16:7: warning: no newline at end of file
In file included from main.c:6:
ioutil.h:10:7: warning: no newline at end of file
In file included from main.c:7:
serial.h:6:7: warning: no newline at end of file
In file included from main.c:11:
ssl.h:21:7: warning: no newline at end of file
main.c:380:18: warning: no newline at end of file
main.c: In function 'int main(int, char**)':
main.c:277: error: 'arg_file1' was not declared in this scope
main.c:278: error: 'arg_str1' was not declared in this scope
main.c:279: error: 'arg_int0' was not declared in this scope
main.c:280: error: 'arg_file0' was not declared in this scope
main.c:284: error: 'arg_lit0' was not declared in this scope
main.c:286: error: invalid use of incomplete type 'struct arg_end'
main.c:286: error: forward declaration of 'struct arg_end'
main.c:299: error: 'arg_nullcheck' was not declared in this scope
main.c:303: error: 'arg_freetable' was not declared in this scope
main.c:306: error: 'arg_parse' was not declared in this scope
main.c:308: error: invalid use of incomplete type 'struct arg_lit'
main.c:284: error: forward declaration of 'struct arg_lit'
main.c:311: error: 'arg_print_syntax' was not declared in this scope
main.c:313: error: 'arg_print_glossary' was not declared in this scope
main.c:316: error: 'arg_freetable' was not declared in this scope
main.c:319: error: invalid use of incomplete type 'struct arg_lit'
main.c:284: error: forward declaration of 'struct arg_lit'
main.c:323: error: 'arg_print_errors' was not declared in this scope
main.c:326: error: 'arg_freetable' was not declared in this scope
main.c:366: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:367: error: invalid use of incomplete type 'struct arg_str'
main.c:278: error: forward declaration of 'struct arg_str'
main.c:367: error: invalid use of incomplete type 'struct arg_int'
main.c:279: error: forward declaration of 'struct arg_int'
main.c:367: error: invalid use of incomplete type 'struct arg_int'
main.c:279: error: forward declaration of 'struct arg_int'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:368: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:369: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:369: error: invalid use of incomplete type 'struct arg_file'
main.c:277: error: forward declaration of 'struct arg_file'
main.c:377: error: 'arg_freetable' was not declared in this scope
make: *** [main.o] Error 1

Seems that I am missing argtable2. I can not find that in the list of available packages for my Synology.
The other thing is that the source files are not ending with a new line. Must I add that manually for my compiler, or is that a mistake in your sources.
We are inching forward it seems.
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

"Why are you compiling on the

Post by pz1 »

"Why are you compiling on the Synology box and not on your PC (cross-compilation)?"

I really have no idea. I read somewhere on the Synology forum that I had to compile on the target machine. So that is what I did. This unix stuff is hard. It is to darn complicated and user-hostile. But I am determined to crack it now. It escapes me totally that one can have several files with the name ssl.h, but apparantly with different content depending on where it is located. At least that is what I infer from seeing my results.

I think I have to install openssl-dev with IPKG. That is available for my machine. It will take a bit of time, because I had to do a firmware upgrade on my Synobox. That ruined my settings.
I'll be back.
Since 29-12-2016 I am no longer a moderator for this forum
Post Reply