Search code examples
linuxmipscross-compilingzeromqtoolchain

zeromq library cross compile configure err, unsupported system :elf


I am trying to cross compile Zeromq library on MIPS platform. I have tried version 2.2, 3.2.4, 4.0.4, but all of them fail to pass the configure checking

The environment variables, CC, CPP, CXX, LD, AR, RANLIB are set. Then I run ./configure --host=mips

Linux kernel: 2.6.31
gcc version: 4.3.3

checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether the C compiler works... yes
checking whether we are using Intel C compiler... no
checking whether we are using Sun Studio C compiler... no
checking whether we are using clang C compiler... no
checking whether we are using gcc >= 4 C compiler... yes
checking whether the C++ compiler works... yes
checking whether we are using Intel C++ compiler... no
checking whether we are using Sun Studio C++ compiler... no
checking whether we are using clang C++ compiler... no
checking whether we are using gcc >= 4 C++ compiler... yes
checking whether to enable debugging information... no
checking whether to enable code coverage... no
checking for pthread_create in -lpthread... yes
checking for clock_gettime in -lrt... yes
configure: error: unsupported system: elf

Solution

  • First, disable the epoll if you get err

    Function not implemented (epoll.cpp:41)

    Aborted

    before configure

    export CXXFLAGS=-DZMQ_FORCE_POLL

    Start to cross compile

    Use

    ./configure --host=mips-linux

    There may be an error when you type make

    make[1]: Leaving directory `/home/justinyu/Development/project/askey_cc/zeromq-3.2.4'                                                                       
    justinyu@justinyu-ubuntu:~/Development/project/askey_cc/zeromq-3.2.4$ make
    Making all in src 
    make[1]: Entering directory `/home/justinyu/Development/project/askey_cc/zeromq-3.2.4/src'
    make  all-am
    make[2]: Entering directory `/home/justinyu/Development/project/askey_cc/zeromq-3.2.4/src'
      CXX    libzmq_la-address.lo
      CXX    libzmq_la-clock.lo
      CXX    libzmq_la-ctx.lo
    In file included from ctx.hpp:31,
                     from ctx.cpp:32:
    array.hpp:142:41: error: macro "index" requires 2 arguments, but only 1 given
    In file included from ctx.hpp:31,
                     from ctx.cpp:32:
    array.hpp:142: error: function definition does not declare parameters
    make[2]: *** [libzmq_la-ctx.lo] Error 1
    make[2]: Leaving directory `/home/justinyu/Development/project/askey_cc/zeromq-3.2.4/src'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/justinyu/Development/project/askey_cc/zeromq-3.2.4/src'
    make: *** [all-recursive] Error 1
    

    Fix it by adding some line in array.hpp

    #ifdef index
    #undef index
    #endif
    
    #ifndef __ZMQ_ARRAY_INCLUDED__
    #define __ZMQ_ARRAY_INCLUDED__
    
    #include <vector>
    #include <algorithm>
    
    namespace zmq 
    {