I've been trying to cross compile Ncat for the MIPS architecture (big endian), and I really need SSL support, so I first must compile OpenSSL. I downloaded the latest version from Github and configured like this because my toolchain binaries are named like 'mips-gcc mips-ld...etc :

export PATH=$PATH:/path/to/toolchain
./Configure linux-mips32 --cross-compile-prefix=mips-

That configured the makefile using the cross toolchain, like:


So, I ran make

I got these errors the first run:

../libcrypto.a(async_posix.o): In function `async_global_init':
async_posix.c:(.text+0x278): undefined reference to `pthread_key_create'
async_posix.c:(.text+0x2a4): undefined reference to `pthread_key_create'
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory `/home/anon/Source/openssl/apps'
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/home/anon/Source/openssl/apps'
make: *** [build_apps] Error 1

I read on another thread to add the option -lpthread to my CFLAGS, but I am still getting the same error. Someone else suggested using G++ instead off GCC (does that even make sense?). Now I get this error instead:

s_socket.o: In function `do_server':
s_socket.c:(.text+0x6d4): warning: gethostbyaddr is obsolescent, usegetaddrinfo() instead.
s_socket.o: In function `host_ip':
s_socket.c:(.text+0x100): warning: gethostbyname is obsolescent, use getnameinfo() instead.
../libcrypto.a(async.o): In function `async_fibre_swapcontext':
async.c:(.text+0x248): undefined reference to `setcontext'
../libcrypto.a(async_posix.o): In function `async_fibre_makecontext':
async_posix.c:(.text+0x154): undefined reference to `getcontext'
async_posix.c:(.text+0x1b4): undefined reference to `makecontext'
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory `/home/anon/Source/openssl/apps'
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/home/anon/Source/openssl/apps'
make: *** [build_apps] Error 1

The cflags I am using are:


OPTIONS look like:

--cross-compile-prefix=mips- no-deprecated no-ec_nistp_64_gcc_128 no-jpake no-md2 no-rc5 no-sctp no-shared no-ssl-trace no-store no-unit-test no-zlib no-zlib-dynamic static-engine

I've search all over the net looking for a solution. I am not very experienced with compiling C, and at this point I am stuck. I'd really appreciate some help. What am I doing wrong?

  • I suggest you to replace OpenSSL with LibreSSL because LibreSSL has much more generic configure system instead of OpenSSL mess. It's more suitable for cross compiling. In the rest, they're nearly same, LibreSSL omits some vulnerable features though. – user140866 Dec 22 '15 at 6:08
  • Can I used them interchangably? I mean, could I compile nmap/ncat and tell it to use libressl as the ssl path? – Chev_603 Dec 22 '15 at 13:46
  • LibreSSL should serve as a drop-in replacement, but certain vulnerable things are missing from it (for example, SSLv3). I do not yet know what Nmap requires. Try it. – user140866 Dec 22 '15 at 15:29
  • Okay, thank you. I will report back once I give this a shot. – Chev_603 Dec 25 '15 at 5:10
  • 1
    You need libpcap.a for mips being available during linking. – user140866 Jan 2 '16 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.