anonCoder
anonCoder

Reputation: 51

Compiling OpenSSL 1.1.1g on 32bit Platforms. MSYS2 - fails

I am trying to build 1.1.1g of OpenSSL. I have tried under MSYS2 and MinGW64.

How do I resolve ?

MSys2 Build:

cd '${workspace_loc:/${project_name}}'; \
export MSYS=/D/msys64; \
export CC=' \
/D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static \
-L/usr/lib \
'; \
export PATH=\
:/d/msys64/mingw32/i686-w64-mingw32/bin:\
:/d/msys64/mingw32/bin:\
:/usr/local/bin:\
perl Configure mingw shared no-hw no-asm no-md2 --prefix=`pwd` --openssldir=`pwd`; \
echo make depend; make; \
echo mingw32-make depend; mingw32-make; \
make Makefile openssl.pc libssl.pc libcrypto.pc build_libs build_apps build_tools

Output:

Configuring OpenSSL version 1.1.1g (0x1010107fL) for mingw
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
make depend
perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _all
make[1]: Entering directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
make[1]: Leaving directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
make[1]: Entering directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
perl util/mkbuildinf.pl " /D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static -L/usr/lib  -m32 -Wall
 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT 
-DOPENSSL_USE_APPLINK -DNDEBUG" "mingw" > crypto/buildinf.h
/D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static -L/usr/lib   -I. -Iinclude -Icrypto -m32 -Wall -
O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/d/Develop/WorkspaceCCpp/openssl-1.
1.1g\"" -DENGINESDIR="\"/d/Develop/WorkspaceCCpp/openssl-1.1.1g/lib/engines-1_1\"" -DUNICODE -D_UNIC
ODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_USE_APPLINK -DNDEBUG  -MMD -MF crypto/cversion.d.tmp -MT c
rypto/cversion.o -c -o crypto/cversion.o crypto/cversion.c
In file included from D:/msys64/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
                 from D:/msys64/mingw32/i686-w64-mingw32/include/stddef.h:7,
                 from D:/msys64/mingw32/lib/gcc/i686-w64-mingw32/10.1.0/include/stddef.h:1,
                 from /mingw32/include/stdlib.h:55,
                 from include/internal/cryptlib.h:13,
                 from crypto/cversion.c:10:
D:/msys64/mingw32/i686-w64-mingw32/include/corecrt.h:128:18: error: expected ';' before 'typedef'
  128 | __MINGW_EXTENSION typedef __int64 __time64_t;
      |                  ^~~~~~~~
      |                  ;
In file included from /mingw32/include/time.h:45,
                 from include/openssl/crypto.h:15,
                 from include/internal/cryptlib.h:22,
                 from crypto/cversion.c:10:
/mingw32/include/sys/types.h:149:23: error: conflicting types for 'time_t'
  149 |    typedef __time32_t time_t;
      |                       ^~~~~~
...
...
...
D:/msys64/mingw32/i686-w64-mingw32/include/corecrt.h:143:20: note: previous declaration of 'time_t' 
was here
  143 | typedef __time64_t time_t;
      |                    ^~~~~~
make: *** [Makefile:2406: crypto/cversion.o] Error 1

Upvotes: 3

Views: 603

Answers (1)

anonCoder
anonCoder

Reputation: 51

One solution is to not build under MSys2 and Choose MinGW64 instead. Then...

\mingw64\mingw32\msys\1.0\bin\bash.exe

Then...

(1) --login -i -c "
cd '${workspace_loc:/${project_name}}';
export CC='/D/msys64/mingw32/bin/gcc.exe -DWIN32_LEAN_AND_MEAN -D_WIN32 -D_WIN64=0 -m32 -static -D_TIME_T_DEFINED -L/usr/lib';
-L/usr/lib
';
export PATH=
:/C/Perl64/bin:
:/d/msys64/mingw32/i686-w64-mingw32/bin:
:/d/msys64/mingw32/bin:
:/usr/local/bin:
$PATH;
echo PATH is: $PATH;
./Configure mingw no-shared no-asm no-md2 --prefix=pwd --openssldir=pwd;
make depend;
make
"

It then builds to completion. NOTE: The path prepend for a newer Perl than the in-built MinGW64 Perl.

Upvotes: 1

Related Questions