[zeromq-dev] Cross compiling for STM32MPU - ARM

Venkat Krishna venkat.krishna at intimetec.com
Tue Oct 31 04:31:30 CET 2023


Hi,

I'm trying to cross compile the libzmq for my arm stm32 unit and I'm facing some issues. I'm a noob so I don't know if I'm missing something. Any help is greatly appreciated!

I'm using Ubuntu 22.04 as my host, and I installed the `gcc-arm-linux-gnueabi, gcc-arm-linux-gnueabihf, g++-arm-linux-gnueabi, g++-arm-linux-gnueabihf packages and also the STM's sdk that comes with a set of cross compilers.

Here's what I've tried:

  1.  » ./configure --host=arm-none-linux-gnueabi CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++​
     *   When I run `make check after this, I get the following errors.
Making check in doc
make[1]: Entering directory '/home/venkatkrishna/Documents/libzmq/doc'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/home/venkatkrishna/Documents/libzmq/doc'
make[1]: Entering directory '/home/venkatkrishna/Documents/libzmq'
  CXX      src/libzmq_la-address.lo
In file included from /usr/arm-linux-gnueabihf/include/stdio.h:430,
                 from src/../include/zmq.h:32,
                 from src/precompiled.hpp:30,
                 from src/address.cpp:3:
/usr/include/x86_64-linux-gnu/bits/floatn.h:74:70: error: unknown machine mode ‘__TC__’
   74 | typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
      |                                                                      ^
/usr/include/x86_64-linux-gnu/bits/floatn.h:86:9: error: ‘__float128’ does not name a type; did you mean ‘__cfloat128’?
   86 | typedef __float128 _Float128;
      |         ^~~~~~~~~~
      |         __cfloat128
In file included from /usr/arm-linux-gnueabihf/include/c++/11/cwchar:44,
                 from /usr/arm-linux-gnueabihf/include/c++/11/bits/postypes.h:40,
                 from /usr/arm-linux-gnueabihf/include/c++/11/bits/char_traits.h:40,
                 from /usr/arm-linux-gnueabihf/include/c++/11/string:40,
                 from src/address.hpp:8,
                 from src/address.cpp:5:
/usr/arm-linux-gnueabihf/include/wchar.h:407:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’?
  407 | extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
      |        ^~~~~~~~~
      |        _Float32x
/usr/arm-linux-gnueabihf/include/wchar.h:524:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’?
  524 | extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
      |        ^~~~~~~~~
      |        _Float32x
In file included from /usr/arm-linux-gnueabihf/include/c++/11/cstdlib:75,
                 from /usr/arm-linux-gnueabihf/include/c++/11/ext/string_conversions.h:41,
                 from /usr/arm-linux-gnueabihf/include/c++/11/bits/basic_string.h:6608,
                 from /usr/arm-linux-gnueabihf/include/c++/11/string:55,
                 from src/address.hpp:8,
                 from src/address.cpp:5:
/usr/arm-linux-gnueabihf/include/stdlib.h:153:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’?
  153 | extern _Float128 strtof128 (const char *__restrict __nptr,
      |        ^~~~~~~~~
      |        _Float32x
/usr/arm-linux-gnueabihf/include/stdlib.h:246:25: error: ‘_Float128’ has not been declared
  246 |                         _Float128 __f)
      |                         ^~~~~~~~~
/usr/arm-linux-gnueabihf/include/stdlib.h:331:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’?
  331 | extern _Float128 strtof128_l (const char *__restrict __nptr,
      |        ^~~~~~~~~
      |        _Float32x
make[1]: *** [Makefile:5481: src/libzmq_la-address.lo] Error 1
make[1]: Leaving directory '/home/venkatkrishna/Documents/libzmq'
make: *** [Makefile:8436: check-recursive] Error 1
  2.

I don't understand why it would pick the x86's include.

2. And then I read a thread on cross compiling for ARM for iPhone and it gave me an idea to use the STM's sdk compilers.
     *
a. I ran again the ./configure with the following flags - compilers and sysroot pointing to the STM sdk
./configure --host=arm-ostl-linux-gnueabi
CC=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi arm-ostl-linux-gnueabi-gcc
CXX=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-g++
CFLAGS="-O --sysroot /home/venkatkrishna/Documents/STM/sdk/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi"
CXXFLAGS="-O --sysroot /home/venkatkrishna/Documents/STM/sdk/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi"
LD=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-ld
LDFLAGS="--sysroot /home/venkatkrishna/Documents/STM/sdk/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi"
AR=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-ar
AS=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-as
STRIP=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-strip
RANLIB=/home/venkatkrishna/Documents/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-ranlib

b. When I run make check, I get an error saying the compiler doesn't work.
c. I tried using the compiler to compile a normal file and it fails with the message below.
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find crt1.o: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find crti.o: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find crtbegin.o: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find -lgcc: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find -lgcc_s: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find -lc: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find -lgcc: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find -lgcc_s: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find crtend.o: No such file or directory
/STM/sdk/sysroots/x86_64-ostl_sdk-linux/usr/libexec/arm-ostl-linux-gnueabi/gcc/arm-ostl-linux-gnueabi/12.2.0/ld: cannot find crtn.o: No such file or directory

         Again, I don't understand this because under my sdk usr folder there are two folders lib and libexec. The lib folder contains these object files but the ld is complaining          that it can't find.

Any help is greatly appreciated.

________________________________
This message and any attachments are confidential and intended solely for the addressees. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. InTimeTec shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20231031/24ee429c/attachment.htm>


More information about the zeromq-dev mailing list