I am building an application for embedded system using QT framework. I came to the point where I need to use the ZeroMQ library on the target system, this is my first time building liblaries and I can't get it to work.
Host: TiAM335*32-BIT RISC, Cortex-A8, Linux 3.2, uname -m returns armv7l
Build on: Ubuntu 20.04.2 LTS Release: 20.04, QT 5.6.2 used to deploy on target system
Step 1: Download and extract zeromq-4.3.4.tar.gz
Step 2:
Using manufacturer provided compiler. Note: CPP="cpp" CXXCPP="cpp" added acorrding to this answer, though without it result is still the same.
./configure CC=/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/arm-teachbox_a8-linux-gnueabihf-g++ CPP="cpp" CXXCPP="cpp" --host=arm-linux-gnueabihf
make
Result:
CC src/libzmq_la-tweetnacl.lo
cc1plus: warning: command line option '-std=gnu11' is valid for C/ObjC but not for C++
src/tweetnacl.c:57:3: error: uninitialized const '_0' [-fpermissive]
_0[16],
^
src/tweetnacl.c:60:3: error: uninitialized const 'gf0' [-fpermissive]
gf0,
^
src/tweetnacl.c:167:29: error: initializer-string for array of chars is too long [-
fpermissive]
static const u8 sigma[16] = "expand 32-byte k";
^
make[1]: *** [Makefile:5252: src/libzmq_la-tweetnacl.lo] Error 1
make[1]: Leaving directory '/home/peter/Downloads/zeromq-4.3.4'
make: *** [Makefile:8217: all-recursive] Error 1
Step 3: change config to:
./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabi-gcc
make
Result :
CC external/sha1/src_libzmq_la-sha1.lo
CXXLD src/libzmq.la
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: src/.libs/libzmq_la-tweetnacl.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:4022: src/libzmq.la] Error 1
make[1]: Leaving directory '/home/peter/Downloads/zeromq-4.3.4'
make: *** [Makefile:8217: all-recursive] Error 1
Note: using CPP="cpp" CXXCPP="cpp" gives the same output
Step 4: Following this guide
export LDFLAGS="-lgcc -lgcc_s"; ./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabi-gcc
make
Result: Same as in step 3
I need to link ZeroMq lib in my QT .pro file so I can deploy my project on embedded system. Do I do it the right way?
EDIT: Step 5: I noticed that in step 1 i am passing CC=g++, as I understand i have to specify c compiler. So I run another config with new parameters but the output is the same as in step 1.
./configure --host=arm-none-linux-gnueabi CC=/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/arm-teachbox_a8-linux-gnueabihf-g++ CXX=/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/arm-teachbox_a8-linux-gnueabihf-g++
EDIT 2 Step 6 fixed compiler linking CC to gcc, CXX to g++ as suggested in comments
./configure --host=arm-none-linux-gnueabihf --with-multilib-list=aprofile CC=/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/arm-teachbox_a8-linux-gnueabihf-gcc CXX=/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/arm-teachbox_a8-linux-gnueabihf-g++
Now I have brand new errors:
CXXLD src/libzmq.la
/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/../lib/gcc/arm-
teachbox_a8-linux-gnueabihf/5.2.0/../../../../arm-teachbox_a8-linux-
gnueabihf/bin/ld.bfd: error: src/.libs/libzmq.so.5.2.4 uses VFP register
arguments, src/.libs/libzmq_la-tweetnacl.o does not
/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/../lib/gcc/arm-
teachbox_a8-linux-gnueabihf/5.2.0/../../../../arm-teachbox_a8-linux-
gnueabihf/bin/ld.bfd: failed to merge target specific data of file
src/.libs/libzmq_la-tweetnacl.o
/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/../lib/gcc/arm-
teachbox_a8-linux-gnueabihf/5.2.0/../../../../arm-teachbox_a8-linux-
gnueabihf/bin/ld.bfd: error: src/.libs/libzmq.so.5.2.4 uses VFP register
arguments, external/sha1/.libs/src_libzmq_la-sha1.o does not
/opt/am335x_tp/arm-teachbox_a8-linux-gnueabihf/bin/../lib/gcc/arm-
teachbox_a8-linux-gnueabihf/5.2.0/../../../../arm-teachbox_a8-linux-
gnueabihf/bin/ld.bfd: failed to merge target specific data of file
external/sha1/.libs/src_libzmq_la-sha1.o
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:4022: src/libzmq.la] Error 1
make[1]: Leaving directory '/home/peter/Downloads/zeromq-4.3.4'
make: *** [Makefile:8217: all-recursive] Error 1