[zeromq-dev] Cross compiling for STM32MPU - ARM

Francesco francesco.montorsi at gmail.com
Tue Oct 31 13:06:43 CET 2023


Hi Venkat,

I suggest you read the page:
https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
which describes how to do a cross-compiler build of a project using
Automake in general (e.g. you're missing the --build option).
It seems that all the compiler errors you're having are not related at all
to libzmq.

My suggestion is for you as exercise/test to first cross-compile a simple
helloworld application that uses automake (you can follow automake
tutorials on the web to create such simple app).
Once you get that cross-compiled, you can try cross compiling libzmq

HTH,
Francesco



Il giorno mar 31 ott 2023 alle ore 08:37 Edwin van den Oetelaar <
edwin at oetelaar.com> ha scritto:

> ChatGPT4 suggest using --with-sysroot and using the correct -I flags for
> pointing to the correct include directories eg:
>
> ./configure --host=arm-linux-gnueabihf --with-sysroot=/path/to/arm/sysroot
>
> This is not a specific issue with zeromq but skills about using the tools
> of the trade.
>
> Good luck,
> Edwin
>
>
>
> On Tue, 31 Oct 2023 at 04:32, Venkat Krishna via zeromq-dev <
> zeromq-dev at lists.zeromq.org> wrote:
>
>> 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++​
>>       1. 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.
>>    1. 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.
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20231031/43eae01e/attachment.htm>


More information about the zeromq-dev mailing list