Cross Compile MQTT For ARM board

3,785 views
Skip to first unread message

rohit malve

unread,
Jun 25, 2014, 8:16:03 AM6/25/14
to mq...@googlegroups.com
HI everyone,
I have successfully MQTT client on my pc(OS:linux) by following the steps given on http://www.eclipse.org/paho/clients/c/.
Now I want to cross compile the same for ARM board. Can any one tell me step by step how to do this.

rohit malve

unread,
Jun 30, 2014, 7:01:36 AM6/30/14
to mq...@googlegroups.com

On Wednesday, June 25, 2014 5:46:03 PM UTC+5:30, rohit malve wrote:
HI everyone,
I have successfully created MQTT client on my pc(OS:linux) by following the steps given on http://www.eclipse.org/paho/clients/c/.

Ian Craggs

unread,
Jun 30, 2014, 4:37:11 PM6/30/14
to mq...@googlegroups.com
if your ARM board is running Linux and has a compiler onboard, the easiest way is to build in exactly the same way as you did for your Linux PC.  But on the ARM board of course.

Otherwise, well do you have a cross-compiler already? If not, you have to get one - presumably the makers of the board have some instructions for you on how to build applications.

Once you have the cross-compiler, the name of which might be something like arm-linux-gcc, you can set the CC environment variable to the name of your compiler, and call make as you do for Intel Linux. 

Ian

rohit malve

unread,
Jul 2, 2014, 5:04:29 AM7/2/14
to mq...@googlegroups.com
Hi Ian Thanx for you reply.
i) if your ARM board is running Linux and has a compiler onboard, the easiest way is to build in exactly the same way as you did for your Linux PC.  But on the ARM board of course.
The ARM Board doesnt have the compiler.
ii) I have cross compiler called arm-linux-gcc installed on my linux machine.I tried the following things:
              a) In the makefile, i replace CC ?= gcc with  CC = arm-linux-gcc
                    But its gives me errors related to liabraries.
               
mroot@ubuntu:~/Downloads/mqtt/org.eclipse.paho.mqtt.c# make
mkdir -p build/output/samples
mkdir -p build/output/test
arm-linux-gcc -g -fPIC -Os -Wall -fvisibility=hidden -o build/output/libpaho-mqtt3c.so.1.0 src/Clients.c src/Heap.c src/LinkedList.c src/Log.c src/Messages.c src/MQTTClient.c src/MQTTPacket.c src/MQTTPacketOut.c src/MQTTPersistence.c src/MQTTPersistenceDefault.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/SocketBuffer.c src/Socket.c src/StackTrace.c src/Thread.c src/Tree.c src/utf-8.c -shared -Wl,-soname,libpaho-mqtt3c.so.1 -Wl,-init,MQTTClient_init -lpthread
ln -s libpaho-mqtt3c.so.1.0  build/output/libpaho-mqtt3c.so.1
ln -s libpaho-mqtt3c.so.1 build/output/libpaho-mqtt3c.so
arm-linux-gcc -g -fPIC -Os -Wall -fvisibility=hidden -o build/output/libpaho-mqtt3cs.so.1.0 src/Clients.c src/Heap.c src/LinkedList.c src/Log.c src/Messages.c src/MQTTClient.c src/MQTTPacket.c src/MQTTPacketOut.c src/MQTTPersistence.c src/MQTTPersistenceDefault.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/SocketBuffer.c src/Socket.c src/SSLSocket.c src/StackTrace.c src/Thread.c src/Tree.c src/utf-8.c -DOPENSSL -shared -Wl,-soname,libpaho-mqtt3cs.so.1 -lpthread -ldl -lcrypto -lssl -Wl,-no-whole-archive -Wl,-init,MQTTClient_init
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/arm-none-linux-gnueabi/bin/../lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libcrypto.so when searching for -lcrypto
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
make: *** [build/output/libpaho-mqtt3cs.so.1.0] Error 1


Please Guide on the same.

Ian Craggs

unread,
Jul 2, 2014, 6:09:32 PM7/2/14
to mq...@googlegroups.com
Looks like the non-SSL MQTT libraries have been built - one of them at least.  The build can't find the OpenSSL libraries which are needed to build the Paho SSL capable MQTT libraries.  You will need to build OpenSSL with the cross-compiler first if you want to use MQTT with OpenSSL.  To do that, you'll need instructions from the OpenSSL website.  If you don't need SSL, you can skip the build of the SSL libraries.

Ian
Reply all
Reply to author
Forward
0 new messages