c++ - 在 32 位平台上编译 OpenSSL 1.1.1g。 MSYS2 - 失败

标签 c++ c perl makefile openssl

我正在尝试构建 1.1.1g 的 OpenSSL。 我已经在 MSYS2 和 MinGW64 下试过了。

我该如何解决?

MSys2 构建:

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

输出:

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

最佳答案

一种解决方案是不在 MSys2 下构建,而是选择 MinGW64。 然后……

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

然后...

(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/库
';
导出路径=
:/C/Perl64/bin:
:/d/msys64/mingw32/i686-w64-mingw32/bin:
:/d/msys64/mingw32/bin:
:/usr/local/bin:
$路径;
回声路径是:$PATH;
./Configure mingw no-shared no-asm no-md2 --prefix=pwd --openssldir=pwd;
依靠;
制作
"

然后构建完成。 注意:路径为比内置 MinGW64 Perl 更新的 Perl 添加了前缀。

关于c++ - 在 32 位平台上编译 OpenSSL 1.1.1g。 MSYS2 - 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63474172/

相关文章:

c - 如何给结构体数组赋值

perl - Perl:将文件移到专用文件夹中

linux - 在 linux 上使用 selenium perl 登录失败

perl - Perl 程序可以知道 __DATA__ 开始的行号吗?

C++ 添加linux用户

c++ - msvc 和 gcc 不同的行为

c - 来源洞察 : Show me Enum Values

c - swift 3 : Compilation error converting String Array to C Char Array

c++ - 您如何测量 OpenGL 中的峰值内存带宽?

c++ - 实现手写动态数组的插入数组方法 - C++