December 8, 2010

Compile Openssl for Linux MIPS

1. Grab openssl source 1.0.c
2. Grab the Linux-MIPS patch at
3. apply the patch: the patch basically just add a few lines to the Configure file. you can do that manually if you want.
4. CC=YOUR-MIPS-CC ./configure linux-mips  (add "shared" if you want to build shared library)
5. make


  1. Hi,
    First of all thanks for this post. I tried your steps. But I am getting this error:

    make[2]: *** No rule to make target `-fPIC', needed by `lib'. Stop.

    Anything I could miss?


  2. There is an error in Makefile of crypto/modes:
    at line 26-27
    LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o gcm128.o \
    ccm128.o xts128.o $(MODES_ASM_OBJ)
    MODES_ASM_OBJ=fPIC and shouldn't be there since it is not a target but a compile options.
    I removed $(MODES_ASM_OBJ) and it worked.

    1. Awesome! It worked for me! Thanks!


  3. Compiling openssl 1.0.1e for linux-mips

    tar xvzf openssl-1.0.1e.tar.gz
    cd openssl-1.0.1e

    # with no asm optimization

    sed -i '/^# uClinux/i\
    "linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}\\$(SHLIB_MAJOR).\\$(SHLIB_MINOR)",' Configure

    # with MIPS32 asm optimization

    sed -i '/^# uClinux/i\
    "linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}\\$(SHLIB_MAJOR).\\$(SHLIB_MINOR)",' Configure

    ./Configure linux-mips --openssldir=$SYSROOT/etc/ssl --prefix=$SYSROOT/usr \
    make CC=$PREFIX/bin/mips-linux-uclibc-gcc
    make CC=$PREFIX/bin/mips-linux-uclibc-gcc -i install

  4. I have used this particular configuration -

    The compilation goes on fine for static library libcrypto.a
    When i try to build (shared library) by specifying shared option:

    ./Configure shared linux-mips64

    I get this message

    Configured for linux-mips64.

    You gave the option 'shared'. Normally, that would give you shared libraries.
    Unfortunately, the OpenSSL configuration doesn't include shared library support
    for this platform yet, so it will pretend you gave the option 'no-shared'. If
    you can inform the developpers (openssl-dev\ how to support shared
    libraries on this platform, they will at least look at it and try their best
    (but please first make sure you have tried with a current version of OpenSSL).

    Any idea what needs to be done here?

  5. This patch works perfectly for linux-mips64 compilation.

  6. I facing problem while compiling openssl library for mipsel-linux-gcc. From your post looks like you are able to build.
    Please help how to build it?

    I took the source code of openssl from ''

    And also when i am accessing for link '' it showing 404 error.

    Please provide me the patch file and necessary steps for successful compilation.

    Thanks in Advance,
    Pravallika KG