[question] Compiling OpenSSL with MinGW on Windows
See original GitHub issueHow can I compile OpenSSL with conan and MinGW 8.2 on Windows 10?
I’m using MinGW 8.2.0 from STL compilation and conan 1.20.1 on Windows 10.
I’m trying to install websocketpp that has OpenSSL 1.1.1c as dependency. Console outputs the following:
PS C:\Users\User\Documents\Sources\MRT\Development> conan install . --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=8.2
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
WARN: websocketpp/0.8.1@bincrafters/stable: requirement asio/1.12.0@bincrafters/stable overridden by your conanfile to asio/1.13.0@bincrafters/stable
OpenSSL/1.1.1c@conan/stable: Not found in local cache, looking in remotes...
OpenSSL/1.1.1c@conan/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt: 100%|##########| 58.0/58.0 [00:00<00:00, 17.7kB/s]
Downloading conanfile.py: 100%|##########| 28.7k/28.7k [00:00<00:00, 111kB/s]
OpenSSL/1.1.1c@conan/stable: Downloaded recipe revision 0
conanfile.txt: Installing package
Requirements
OpenSSL/1.1.1c@conan/stable from 'conan-center' - Downloaded
asio/1.13.0@bincrafters/stable from 'conan-center' - Cache
fmt/6.0.0@bincrafters/stable from 'conan-center' - Cache
paho-c/1.3.0@conan/stable from 'conan-center' - Cache
pugixml/1.10@bincrafters/stable from 'conan-center' - Cache
rapidjson/1.1.0@bincrafters/stable from 'conan-center' - Cache
spdlog/1.4.2@bincrafters/stable from 'conan-center' - Cache
sqlite3/3.29.0 from 'conan-center' - Cache
websocketpp/0.8.1@bincrafters/stable from 'bincrafters' - Cache
zlib/1.2.11@conan/stable from 'conan-center' - Cache
Packages
OpenSSL/1.1.1c@conan/stable:0fa24fc17987c7ebda4490aaf810b500f741dab6 - Build
asio/1.13.0@bincrafters/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
fmt/6.0.0@bincrafters/stable:d2e9f0427a9f423abdfdcd9fc1fca32c78f3be27 - Cache
paho-c/1.3.0@conan/stable:11970fe766f2003618a4453bd3b5a3990f025a65 - Cache
pugixml/1.10@bincrafters/stable:d2e9f0427a9f423abdfdcd9fc1fca32c78f3be27 - Cache
rapidjson/1.1.0@bincrafters/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
spdlog/1.4.2@bincrafters/stable:a1605c08cfb1e7a1f94058c08792d89866f7ebbd - Build
sqlite3/3.29.0:8b8ab72be77c9228fea3280f90348dfbde80f9d0 - Cache
websocketpp/0.8.1@bincrafters/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Download
zlib/1.2.11@conan/stable:e50fc893ef691a3c18ad21536d7cf203bc81bd95 - Cache
Build requirements
nasm/2.13.01@conan/stable from 'conan-center' - Cache
Build requirements packages
nasm/2.13.01@conan/stable:456f15897172eef340fcbac8a70811f2beb26a93 - Cache
asio/1.13.0@bincrafters/stable: Already installed!
fmt/6.0.0@bincrafters/stable: Already installed!
nasm/2.13.01@conan/stable: Already installed!
nasm/2.13.01@conan/stable: Using nasm-2.13.01 version
paho-c/1.3.0@conan/stable: Already installed!
pugixml/1.10@bincrafters/stable: Already installed!
rapidjson/1.1.0@bincrafters/stable: Already installed!
sqlite3/3.29.0: Already installed!
zlib/1.2.11@conan/stable: Already installed!
OpenSSL/1.1.1c@conan/stable: Applying build-requirement: nasm/2.13.01@conan/stable
OpenSSL/1.1.1c@conan/stable: Configuring sources in C:\Users\User\.conan\data\OpenSSL\1.1.1c\conan\stable\source
Downloading openssl-1.1.1c.tar.gz: 100%|##########| 8.45M/8.45M [00:20<00:00, 437kB/s]
OpenSSL/1.1.1c@conan/stable: Copying sources to build folder
OpenSSL/1.1.1c@conan/stable: Building your package in C:\Users\User\.conan\data\OpenSSL\1.1.1c\conan\stable\build\0fa24fc17987c7ebda4490aaf810b500f741dab6
OpenSSL/1.1.1c@conan/stable: Generator txt created conanbuildinfo.txt
OpenSSL/1.1.1c@conan/stable: Calling build()
OpenSSL/1.1.1c@conan/stable: using target: mingw-conan-Release-Windows-x86_64-gcc-8.2 -> mingw64
OpenSSL/1.1.1c@conan/stable: my %targets = (
"mingw-conan-Release-Windows-x86_64-gcc-8.2" => {
inherit_from => [ "mingw64" ],
cflags => add("-m64 -O3 -s"),
cxxflags => add("-m64 -O3 -s"),
defines => add("NDEBUG"),
includes => add("C:/Users/User/.conan/data/zlib/1.2.11/conan/stable/package/e50fc893ef691a3c18ad21536d7cf203bc81bd95/include"),
lflags => add("-m64"),
},
);
OpenSSL/1.1.1c@conan/stable: ['"mingw-conan-Release-Windows-x86_64-gcc-8.2"', 'no-shared', '--prefix=/c/users/user/.conan/data/openssl/1.1.1c/conan/stable/package/0fa24fc17987c7ebda4490aaf810b500f741dab6', '--openssldir=/c/users/user/.conan/data/openssl/1.1.1c/conan/stable/package/0fa24fc17987c7ebda4490aaf810b500f741dab6/res', 'no-unit-test', 'PERL=perl', 'no-tests', '--release', '--with-zlib-include="C:/Users/User/.conan/data/zlib/1.2.11/conan/stable/package/e50fc893ef691a3c18ad21536d7cf203bc81bd95/include"', '--with-zlib-lib="C:/Users/User/.conan/data/zlib/1.2.11/conan/stable/package/e50fc893ef691a3c18ad21536d7cf203bc81bd95/lib/zlib.lib"']
OpenSSL/1.1.1c@conan/stable:
OpenSSL/1.1.1c@conan/stable: ERROR: Package '0fa24fc17987c7ebda4490aaf810b500f741dab6' build failed
OpenSSL/1.1.1c@conan/stable: WARN: Build folder C:\Users\User\.conan\data\OpenSSL\1.1.1c\conan\stable\build\0fa24fc17987c7ebda4490aaf810b500f741dab6
ERROR: OpenSSL/1.1.1c@conan/stable: Error in build() method, line 552
self._make()
while calling '_make', line 502
self.run('{perl} ./Configure {args}'.format(perl=self._perl, args=args), win_bash=self._win_bash)
ConanException: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.
PS C:\Users\User\Documents\Sources\MRT\Development>
I have tried changing build_requires from default profile settings to use cygwin_installer/msys2_installer for OpenSSL only.
As shown here:
.conan/profiles/default:
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=8.2
build_type=Release
[options]
[build_requires]
#OpenSSL*: msys2_installer/20161025@bincrafters/stable
#OpenSSL*: cygwin_installer/2.9.0@bincrafters/stable
[env]
But I get some kind of error with some Win32API headers, I have attached a file with the output. cygwin output.txt
May I ask how can I use this package to be used with websocketpp?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to build OpenSSL with MinGW in Windows? [closed]
To build OpenSSL, you need a working Perl installation. Download OpenSSL from its official website and decompress the archive. Windows 32/64 ...
Read more >Compiling OpenSSL with MinGW - Qt Wiki
The Win32OpenSSL project provides pre-compiled libraries for both 32 and 64 bit. However, these depend on the Microsoft Visual C++ 2008 runtime ...
Read more >Compilation and Installation - OpenSSLWiki
OpenSSL uses a custom build system to configure the library. Configuration will allow the library to set up the recursive makefiles from ...
Read more >web.mit.edu/Ghudson/dev/third/openssl/INSTALL.W32
WCE] Heres a few comments about building OpenSSL in Windows environments. ... C (Cygwin or MinGW) If you are compiling from a tarball...
Read more >Issue #1476: Linux to Windows crosscompile mingw64 openssl
I am trying to cross compile strongSwan 5.4.0 from Linux for Window. ... problem with the source? libcrypto does not exist in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
seems like similar to https://github.com/openssl/openssl/issues/2979
so, it’s probably wrong GCC instance was picked up. could you try to specify
CC
/CXX
environment variables within your profile pointing to the right GCC executables (from https://nuwen.net/mingw.html)NEW UPDATE: I deep research this issues. Finally, sum up the experience:
First,
Cannot recognize the Windows subsystem, install MSYS2/cygwin
:add
msys2
toconanfile.py
We need
msys2
supportbash
in windows.Second,
dso_win32
error: If usemsys2/20190524
only environment will due to this error. Why is this happening? When usemsys2
,conanfile.py
identify the system status asmingw64
.read https://mta.openssl.org/pipermail/openssl-commits/2015-March/000733.html openssl:
Cygwin
to useDSO_FLFCN
andmingw
to useDSO_WIN32
. Andmsys2
is based on modern Cygwin. It recognizedis_cygwin
asfalse
, but building withmsys2
(Cygwin) by usingmingw64
mode!1 option If only target
msys2
, you need to tell your profile usecygwin
subsystem:building with
msys2
by using cygwin mode.2 option Add
mingw
build_requires to your profile:or
building with
mingw
by using mingw mode.3 option Use
msys2
subsystemmingw64
:msys2
installmingw-w64-x86_64-toolchain
runC:\.conan\f16a5d\1\bin\msys2.exe
pacman -S mingw-w64-x86_64-toolchain --noconfirm
build profile add targettoolchain=x86_64-w64-mingw32
4 option Update
is_cygwin
logical judgment.The above configurations have been tested.