I'm trying to build the rustless "basic usage" sample project.
This is my Cargo.toml. I had to add the dependencies in Cargo.toml in order to avoid the build error error[E0463]: can't find crate for 'hyper'
[package]
name = "rustlessTest"
version = "0.1.0"
authors = ["x"]
[dependencies.rustless]
git = "https://github.com/rustless/rustless"
[dependencies]
hyper = "0.9.14"
iron = "0.4.0"
rustc-serialize = "0.3.22"
valico = "1.0.1"
I also downloaded the OpenSSL library & sources. I stored them under C:\OpenSSL\lib and C:\OpenSSL\include and set the directories as a environment variable, as mentioned in this thread about how to using Hyper on Windows.
When I try to compile, it fails with the following output:
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl v0.7.14`
....
....
I finally managed to build OpenSSL on Windows by following the solution from this blog post.
Here's a summary:
Download Win64 OpenSSL v1.0.1u from here. Install it with default settings.
Set the following environment variables
DEP_OPENSSL_INCLUDE=C:\OpenSSL-Win64\include
OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win64\include
OPENSSL_LIB_DIR=C:\OpenSSL-Win64\lib\VC
OPENSSL_LIBS=ssleay32MT:libeay32MT
Install Visual Studio 2015 or Visual Studio Code with C++ support.
Ensure that all path variables are set correctly
Set rust-msvc as the toolchain. You can check this by typing rustup show into the console. You should get an output like this:
Default host: x86_64-pc-windows-msvc
stable-x86_64-pc-windows-msvc (default)
rustc 1.13.0 (2c6933acc 2016-11-07)
Now you should able to build Rust projects which requires OpenSSL.
You are right that it is because OpenSSL is not found. A good tutorial is in the README of rust-openssl.
Windows MSVC
On MSVC it's unfortunately not always a trivial process acquiring
OpenSSL. Perhaps the easiest way to do this right now is to download
precompiled binaries and install them on your system. Currently it's
recommended to install the 1.1.0 (non-light) installation if you're
choosing this route.
Once a precompiled binary is installed you can configure this crate to
find the installation via an environment variable:
set OPENSSL_DIR=C:\OpenSSL-Win64
Note that this OpenSSL distribution does not ship with any root
certificates. So to make requests to servers on the internet, you have
to install them manually. Download the cacert.pem file from here,
copy it somewhere safe (C:\OpenSSL-Win64\certs is a good place) and
point the SSL_CERT_FILE environment variable there:
set SSL_CERT_FILE=C:\OpenSSL-Win64\certs\cacert.pem
After that, you're just a cargo build away!
Windows GNU (MinGW)
The easiest way to acquire OpenSSL when working with MinGW is to
ensure you're using MSYS2 and to then
execute:
# 32-bit pacman -S mingw-w64-i686-openssl
# 64-bit pacman -S mingw-w64-x86_64-openssl
And after that, a cargo build should be all you need!
Manual configuration
rust-openssl's build script will by default attempt to locate OpenSSL
via pkg-config or other system-specific mechanisms. This will not work
in some situations however, for example cross compiling or when using
a copy of OpenSSL other than the normal system install.
The build script can be configured via environment variables:
OPENSSL_DIR - If specified, a directory that will be used to find OpenSSL installation. It's expected that under this directory the
include folder has header files and a lib folder has the runtime
libraries.
OPENSSL_LIB_DIR - If specified, a directory that will be used to find OpenSSL libraries. Overrides the lib folder implied by
OPENSSL_DIR (if specified).
OPENSSL_INCLUDE_DIR - If specified, a directory that will be used to find OpenSSL header files. Overrides the include folder implied
by OPENSSL_DIR (if specified).
OPENSSL_STATIC - If specified, OpenSSL libraries will be statically rather than dynamically linked.
If OPENSSL_DIR is specified, then the build script will skip the
pkg-config step.
It's a nightmare; OpenSSL with Windows is really painful. I hope that one day Rust has its own implementation of SSL/TLS.
Related
I tried to install Rust on Cygwin but failed to be able link with mingw. Now I am trying to install it with Msys2. I already installed Msys2 and Mingw. I tried to follow this wiki page but I got lost at number 2:
Download and install Rust+Cargo using the installer but be sure to disable the Linker and platform libraries option.
Is it referring to the "rustup-init.exe" on the install page? Should I double click to run this file or run it from Msys2? I tried to run from Msys2 and got the options:
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
I don't know what to do next.
The Using Rust on Windows page you linked to dates from before rustup replaced the installer as the default option to install Rust. Installers are still available, but you should use rustup if possible, because it makes it easy to update and to use multiple toolchains at once (e.g. stable, beta and nightly). If you must use the installer, just select the x86_64-pc-windows-gnu installer and follow the step from the Using Rust on Windows page. If you're using rustup, read on.
By default, rustup on Windows installs the compiler and tools targeting the MSVC toolchain, rather than the GNU/MinGW-w64 toolchain. At the initial menu, select 2) Customize installation. When asked for a host triple, enter x86_64-pc-windows-gnu. Then make a choice for the other questions, then proceed with the installation.
Note: If rustup is already installed, then rerunning rustup-init won't actually install the requested toolchain. Instead, run rustup toolchain install stable-x86_64-pc-windows-gnu if you already have the MSVC-based toolchain. Then run rustup default stable-x86_64-pc-windows-gnu to set the GNU-based toolchain as the default.
Rustup will install the MinGW linker and platform libraries automatically (as part of the rust-mingw component) and refuses to let you remove them. If you prefer to use the MinGW linker and libraries you installed with MSYS2, you'll need to create a .cargo/config file (either in your profile directory, i.e. C:\Users\you\.cargo\config, or in your project's directory if this configuration is specific to a project). The contents of that file might look like this:
[target.x86_64-pc-windows-gnu]
linker = "C:\\msys2\\mingw64\\bin\\gcc.exe"
ar = "C:\\msys2\\mingw64\\bin\\ar.exe"
Rustup will modify the PATH environment variable unless you told it not to. However, MSYS2 resets PATH by default when you launch, so when you try to invoke cargo or rustc from your MSYS2 shell, it might not find it. You'll need to edit your .profile/.bash_profile script to set the PATH correctly (you need to prepend /c/Users/yourname/.cargo/bin: to PATH).
my problem resolved by following way
Run rustup toolchain install stable-x86_64-pc-windows-gnu
Second open .rustup folder
Open settings.toml file
Change first line with: default_toolchain = "stable-x86_64-pc-windows-gnu"
done!
I wrote a complete guide on how to
install Rust on windows with Visual Studio Code and MSYS2 MinGW
on the page found here:
https://stackoverflow.com/a/68835925/4230643
After successful installation of Ada 2012 on windows 10 (with AdaCore-Download-2016-07-14_0729 package) I didn't find how to step forward to add database driver support to Ada. I found GNATColl library and download package but I didn't really found any description how to prepare cygwin envirnment to compile it.
Do i need to install gcc toolchain with ada support, postgres and python inside cygwin again or just prepare PATH to /cygdrive/* locations in windows ?
Installing ADA 2012 on Windows 10 64bit
After installation of base Ada package we got all what we need to develop in Ada with IDE environment (GPS) and GNAT mingw environment with debugger (GDB).
On windows OS only 32bit installation is supported. Windows can be 64bit edition.
http://libre.adacore.com/download/configurations
1. Prerequisites :
1.1. Install Python 2.7 for windows - 32bit
https://www.python.org/downloads/windows/
Select 32bit windows edition: Windows x86 MSI installer
Add C:\Python27 to PATH on windows.
1.2. Install PostgreSQL 32bit
Gcc compiler for GNAT in AdaCore and external libraries must be in the same format.
Postgres libraries in the 32bit format are available: http://www.enterprisedb.com/products-services-training/pgbindownload
File: postgresql-9.5.3-1-windows-binaries.zip
Unzip postgres into folder where build will get libraries :
Folder: H:\Ada\PostgreSQL953
For compiling client applications we do not need whole server installed, just libraries in proper format.
1.3. Install Cygwin
Download from: https://cygwin.com/install.html
Take setup-x86.exe file, this is 32bit version of cygwin.
1.3.1. Install make
If you forget to install anything on the first setup run, just run setup again and add missing package.
Start setup-x86.exe again and search for »make« package in »Devel«, mark it for installation and proceed with »Next«. Package will be installed in the existing installation.
2. Install Ada
2.1. Install GNAT Gpl – base Ada package
File: gnat-gpl-2016-x86-windows-bin.exe
Install with »Run as administrator« .
Destination folder. H:\Ada\GNAT\2016
2.2. Install Win32Ada
D:\Install\Ada\AdaCore-Download-2016-07-14_0729\x86-windows\adagpl-2016\win32ada
File: win32ada-gpl-2016-x86-windows-bin.exe
Install with »Run as administrator« .
Destination folder: H:\Ada\GNAT\2016
2.3. Install GtkAda
D:\Install\Ada\AdaCore-Download-2016-07-14_0729\x86-windows\adagpl-2016\gtkada
File: gtkada-gpl-2016-x86-windows-bin.exe
Install with »Run as administrator« .
Destination folder: H:\Ada\GtkAda
2.4. Install AWS - ada web server
D:\Install\Ada\AdaCore-Download-2016-07-14_0729\x86-windows\adagpl-2016\aws\sources
File: aws-gpl-2016-src.tar.gz unzip file to working folder.
Now execute next commands in cygwin environment :
$ make setup build
$ make --prefix=/Ada/GNAT/2016 install
AWS should be installed on GNAT compiler root folder by default.
http://docs.adacore.com/aws-docs/aws/building_aws.html
2.5. Install GNATColl library with postgres interface
D:\Install\Ada\AdaCore-Download-2016-07-14_0729\x86-windows\adagpl-2016\gnatcoll\sources\
File gnatcoll-gpl-2016-src.tar.gz unzip file to working folder.
**Now execute next commands in cygwin environment :**
$ ./configure --prefix=/Ada/GNAT/2016 –with-postgresql=H:/ADA/PostgreSQL953/lib
Be very careful with path to postgresql lib folder.
--------- Summary for GNAT Components --------------
Shared libraries: yes (default: static)
Gtk+: yes (requires pkg-config and gtkada.gpr)
PostgreSQL: yes -LH:/ADA/PostgreSQL953/lib (see --with-postgresql)
Sqlite: embedded (see --with-sqlite)
Projects: yes
Other components where on "no".
Manually edit file: gnatcoll_shared.gpr
I am not sure if this is really necessary, but I did this clean up.
Clean broken lines where RETURN character divide »end of line«, for example:
Python_Version := "27
";
Change to :
Python_Version := "27";
Execute make commands in cygwin
$ make
$ make install
In case of errors, reset build environment with »make clean« command and restart with "configure".
How to build app with source of openssl, without compiled openssl.dll and libeay.dll ?
I downloaded openssl-0.9.8h, set include paths to path-to-sources/include/. Files located in include/openssl/ it's links to files ../../{crypto/_algo-name_/algosource.h}, and VS do not understand this links.
Actually, you need to build OpenSSL and that will generate the library and header files in the patch specified in makefile. And you should use that include files. These header files are like template files and used while building OpenSSL. See this question.
And search how to build OpenSSL on Windows.
As the problem mentioned by you after compilation, there should not be any need of OpenSSL, you can do it in the following manner:
Generate static library of OpenSSL and use it in your application. Now, after compilation of your application, OpenSSL dlls will not be required.
If your application is very small, you can compile it with OpenSSL static library.
How to build app with source of openssl, without compiled openssl.dll and libeay.dll
You cannot. You need to build the OpenSSL library first.
I downloaded openssl-0.9.8h, set include paths to path-to-sources/include/....
Your next step is to open INSTALL.W32 and read the instructions. Here's an exceprt with most of the steps. But be sure to execute it using a Visual Studio Command Prompt so the tools like cl.exe and link.exe are on path.
If you want to compile in the assembly language routines with Visual
C++, then you will need already mentioned Netwide Assembler binary,
nasmw.exe or nasm.exe, to be available on your %PATH%.
Firstly you should run Configure with platform VC-WIN32:
> perl Configure VC-WIN32 --prefix=c:\some\openssl\dir
Where the prefix argument specifies where OpenSSL will be installed to.
Next you need to build the Makefiles and optionally the assembly
language files:
- If you are using NASM then run:
> ms\do_nasm
- If you don't want to use the assembly language files at all then run:
> perl Configure VC-WIN32 no-asm --prefix=c:/some/openssl/dir
> ms\do_ms
If you get errors about things not having numbers assigned then check the
troubleshooting section: you probably won't be able to compile it as it
stands.
Then from the VC++ environment at a prompt do:
> nmake -f ms\ntdll.mak
If all is well it should compile and you will have some DLLs and
executables in out32dll. If you want to try the tests then do:
> nmake -f ms\ntdll.mak test
To install OpenSSL to the specified location do:
> nmake -f ms\ntdll.mak install
Thomas Hruska of Shining Light Productions offers Win32 OpenSSL. Its a pre-built OpenSSL with a Windows installer. He's been providing it for years.
Once installed, just point to it in Visual Studio. There's no fussing with environments like Cygwin, Perl and scripts to modify source code so that Unix and Linux work on Windows. (That's a dumb idea to me. Windows is Windows, and Linux is Linux. Stop trying to make one act like the other).
I am trying to do it, but all I can get is some source code that I don't know how to do deal with I downloaded from http://pkgconfig.freedesktop.org/releases/.
This is a step-by-step procedure to get pkg-config working on Windows, based on my experience, using the info from Oliver Zendel's comment.
I assume here that MinGW was installed to C:\MinGW. There were multiple versions of the packages available, and in each case I just downloaded the latest version.
go to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
download the file pkg-config_0.26-1_win32.zip
extract the file bin/pkg-config.exe to C:\MinGW\bin
download the file gettext-runtime_0.18.1.1-2_win32.zip
extract the file bin/intl.dll to C:\MinGW\bin
go to http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28
download the file glib_2.28.8-1_win32.zip
extract the file bin/libglib-2.0-0.dll to C:\MinGW\bin
Now CMake will be able to use pkg-config if it is configured to use MinGW.
Get the precompiled binaries from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
Download pkg-config and its depend libraries :
pkg-config_0.26-1_win32.zip
glib_2.28.8-1_win32.zip
gettext-runtime_0.18.1.1-2_win32.zip
A alternative without glib dependency is pkg-config-lite.
Extract pkg-config.exe from the archive and put it in your path.
Nowdays this package is available using chocolatey, then it could be installed with
choco install pkgconfiglite
I did this by installing Cygwin64 from this link https://www.cygwin.com/
Then - View Full, Search gcc and scroll down to find pkg-config.
Click on icon to select latest version.
This worked for me well.
I would like to extend the answer of #dzintars about the Cygwin version of pkg-config in that focus how should one use it properly with CMake, because I see various comments about CMake in this topic.
I have experienced many troubles with CMake + Cygwin's pkg-config and I want to share my experience how to avoid them.
1. The symlink C:/Cygwin64/bin/pkg-config -> pkgconf.exe does not work in Windows console.
It is not a native Windows .lnk symlink and it won't be callable in Windows console cmd.exe even if you add ".;" to your %PATHEXT% (see https://www.mail-archive.com/cygwin#cygwin.com/msg104088.html).
It won't work from CMake, because CMake calls pkg-config with the method execute_process() (FindPkgConfig.cmake) which opens a new cmd.exe.
Solution: Add -DPKG_CONFIG_EXECUTABLE=C:/Cygwin64/bin/pkgconf.exe to the CMake command line (or set it in CMakeLists.txt).
2. Cygwin's pkg-config recognizes only Cygwin paths in PKG_CONFIG_PATH (no Windows paths).
For example, on my system the .pc files are located in C:\Cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\pkgconfig. The following three paths are valid, but only path C works in PKG_CONFIG_PATH:
A) c:/Cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
does not work.
B) /c/cygdrive/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
does not work.
C) /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - works.
Solution: add .pc files location always as a Cygwin path into PKG_CONFIG_PATH.
3) CMake converts forward slashes to backslashes in PKG_CONFIG_PATH on Cygwin.
It happens due to the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21629. It prevents using the workaround described in [2].
Solution: manually update the function _pkg_set_path_internal() in the file C:/Program Files/CMake/share/cmake-3.x/Modules/FindPkgConfig.cmake. Comment/remove the line:
file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
4) CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH have no effect on pkg-config in Cygwin.
Reason: the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21775.
Solution: Use only PKG_CONFIG_PATH as an environment variable if you run CMake builds on Cygwin. Forget about CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH.
Install mingw64 from https://sourceforge.net/projects/mingw-w64/. Avoid program files/(x86) folder for installation. Ex. c:/mingw-w64
Download pkg-config__win64.zip from here
Extract above zip file and copy paste all the files from pkg-config/bin folder to mingw-w64. In my case its 'C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin'
Now set path = C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin
taddaaa you are done.
If you find any security issue then follow steps as well
Search for windows defender security center in system
Navigate to apps & browser control> Exploit protection settings> Program setting> Click on '+add program customize'
Select add program by name
Enter program name: pkgconf.exe
OK
Now check all the settings and set it all the settings to off and apply.
Thats DONE!
Another place where you can get more updated binaries can be found at Fedora Build System site. Direct link to mingw-pkg-config package is: http://koji.fedoraproject.org/koji/buildinfo?buildID=354619
for w64-based computers you have to install mingw64. If pkg-config.exe is missing then, you can refer to http://ftp.acc.umu.se/pub/gnome/binaries/win64/dependencies/
Unzip and copy/merge pkg-config.exe into your C:\mingw-w64 installation, eg. into on my pc into C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
In 2022 VS Code works with CMake & pkgconfig out of the box (add pkgconf && vcpkg-pkgconfig-get-modules to your vcpkg.json)
From: https://github.com/JoinMarket-Org/joinmarket/wiki/Installing-JoinMarket-on-Windows
This guide describes how to install JoinMarket and its dependencies (python, libsodium, secp256k1) on Windows.
Some or all of this may or may not work for all versions of Windows. Reports appreciated. It is not claimed to be in any way comprehensive. Verification of downloads are your own responsibility.
Install JoinMarket - go to https://github.com/JoinMarket-Org/joinmarket/releases and download the most recent release. Unzip it into any location you choose.
You will need to install MinGW from here or go to their website. After a few introductory screens, you will be shown a windows with some optional components that you have to choose; this basic setup is sufficient:
From "Basic Setup" in the left menu:
mingw-developer-toolkit
mingw32-base
mingw32-gcc-g++
msys-base
Once you have chosen these, choose "Update" from the main menu first item. These components will be installed into C:\MinGW\bin. Once that is complete, you should have this dll: libgcc_s_dw2-1.dll in that folder C:\MinGW\bin, along with a lot of other files; I'm mentioning this file explicitly, since it's needed specifically for libsecp256k1 to operate in this setup.
Next, you must make sure C:\MinGW\bin is added to your PATH variable. Here's one guide to how to do that; you must append ;C:\MinGW\bin to the end of the path before continuing.
Install Python from https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi. Run the executable. Choose to install the feature Add python.exe to Path (it's the last option in the installer, off by default - switch it on) on local hard drive during installation; Python should then be installed in C:\Python27 (EXTRA NOTE: the most recent 2.7 installation linked here seems to install pip automatically, which is very useful for step 4)
Check that Python runs. Open a new command prompt as administrator by typing cmd.exe into the Start menu and pressing Ctrl+Shift+Enter. Type python and you should see something like:
Python 2.7.11 (default....
....
>>>
Exit the Python console with exit() or by pressing Ctrl+C. Now, make sure your version of pip is up to date: run the command: python -m pip install --upgrade pip.
Go to the directory C:\Python27\Lib\distutils and add a new file, called distutils.cfg. Inside it, put:
[build]
compiler=mingw32
Close and save the file.
Next, you need to install the dll for libnacl. First go to https://download.libsodium.org/libsodium/releases/ and choose the file libsodium-1.0.4-msvc.zip to download. Unzip anywhere, and then copy the file libsodium.dll from the directory \Win32\Release\v120\dynamic (do not use v140), and paste it into root joinmarket directory (the same directory where README.md lives). Then you need to address the Visual C++ 2013 runtime dependency. Do so by going to www.microsoft.com/en-us/download/details.aspx?id=40784 and clicking Download. Choose x86 even on a 64-bit system, and run the executable.
Note that after doing this, you must run pip install -r requirements-windows.txt from the Joinmarket root directory (where the README.md file is) and should not get an error message (this will install/check the python packages libnacl and secp256k1(-transient)).
I'm using libcurl in a Win32 C++ application.
I have the curllib.vcproj project added to my solution and set my other projects to depend on it.
How do I build it with SSL support enabled?
Well, since this post failed badly, I had to dig into the matter myself.
Also check out the other answers and comments for additional info regarding other versions etc.
EDIT: Since I posted this Q there seems to be ready-built binaries made available from the curl homepage. Check out James' answer.
So here goes:
-
Preprocessor
The following two symbols need to be fed to the preprocessor to enable SSL for libcurl:
USE_SSLEAY
USE_OPENSSL
(libcurl uses OpenSSL for SSL support)
Alternatively the symbols can be added directly to a file called setup.h in libcurl, but I'm not too happy about modifying code in 3rd party distributions unless I really have to.
Rebuilding the libcurl library, I now got some errors about OpenSSL include files not being found. Naturally, since I haven't set up the OpenSSL distribution properly yet.
Compiling OpenSSL binaries
I downloaded the OpenSSL 0.9.8 source distribution and unpacked it.
In the root of the source distribution there's a file called INSTALL.W32 which describes how to compile the OpenSSL binaries. The build chain requires perl, so I installed the latest version of ActivePerl.
I had some trouble with the build, which might not be applicable to all systems, but I'll go through it here in case somebody experiences the same.
According to INSTALL.W32:
Run the following commandline tasks with current directory set to the source distribution root:
1> perl Configure VC-WIN32 --prefix=c:/some/openssl/dir
(Where "c:/some/openssl/dir" should be replaced by the dir where OpenSSL should be installed. Don't use spaces in this path. The compilation further ahead will fail in that case)
2> ms\do_ms
For me this step was unsuccessful at first, since I lacked the environment variables OSVERSION and TARGETCPU. I set these to 5.1.2600 and x86 respectively. You may get complaint about OSVERSION being "insane", but look closer, this error is for WinCE and doesn't affect the Win32 setup. To get hold of your OS version, run the 'ver' command from a command prompt or run winver.exe.
3> nmake -f ms\nt.mak (for static library)
or
3> nmake -f ms\ntdll.mak (for DLL)
The source now compiles. Took approx 5 minutes on my laptop.
When compilation is completed, the libs or binaries have been placed in:
distroot/out32 - for static library build
or
distroot/out32dll - for DLL build
Building and linking
Now, back to visual studio and point out the libs and include path for headers. The include files are located in distroot/inc32/openssl.
Remember to add libeay32.lib and ssleay32.lib as linker input.
Rebuild the libcurl project.
Error!
Well at least for me with this version of OpenSSL.
it complained about a struct typedef in one of the OpenSSL headers. I couldn't find any info on this. After an hour of googling I broke my own principle and commented out the typedef from the OpenSSL header, and luckily libcurl wasn't using that symbol so it built fine.
Update: As pointed out by Jason, this issue seems to have dissapeared as of version 1.0.0a.
Now, for confirming that SSL support is enabled for libcurl, run the following code:
curl_version_info_data * vinfo = curl_version_info( CURLVERSION_NOW );
if( vinfo->features & CURL_VERSION_SSL )
// SSL support enabled
else
// No SSL
Simple as that.
Maybe this isn't the answer anyone is looking for, but I simply just downloaded the precompiled DLLs from this link found at http://curl.haxx.se/download.html
I ran the test that sharkin provided, and if( vinfo->features & CURL_VERSION_SSL ) proved to be true.
Following Robert Oschler's advice, here is my comment on the question as answer :
You can build recent libcurl (2012) with native SSL support for windows using the preprocessor symbols: USE_WINDOWS_SSPI and USE_SCHANNEL instead of the OpenSSL ones.
When compiling OpenSSL 1.0.0 on Windows with Visual Studio 2010, it eventually threw a 0x2 error:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
It seems that this error will be thrown because of a flag in the perl Configure file, namely -WX.
As the MSDN documentation states:
Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.
After removing the -WX occurrences in the Configure file and re-entering the commands stated here it built fine and passed all tests.
In my case follow the curl README file was enough.
My configuration is the following:
Visual Studio 2015 (VC14)
Static library
Win64
curl version 7.57.0
OpenSSL 1.0.2
Compilation of libCurl
Download libcurl source there: https://curl.haxx.se/download.html
Uncompress the file and go to the folder curl-7.57.0\projects
Open the README file and follow the instructions, this lead me to do the following:
Downloaded OpenSSL
Extract it and rename it to openssl, put it aside the curl folder, this is important as you'll open the VS project that expect to find openssl there.
Install Perl
Execute the utility build-openssl.bat to perform the compilation of openSSL. With my settings this became the following:
.\build-openssl.bat vc14 x64 release ..\..\openssl\
just runs .\build-openssl.bat -help to know more about the parameters.
After that you can see OpenSSL has been compiled as you got a new folder here: openssl\build\Win64
Open the Visual Studio project curl-7.57.0\projects\Windows\VC14\curl-all.sln
Be sure to set the visual studio project to the build configuration you need (LIB Release - LIB OpenSSL in my case)
Build all
The library is located at curl-7.57.0\build\Win64\VC14\LIB Release - LIB OpenSSL\libcurl.lib
Remarks
Don't forget to define the CURL_STATICLIB preprocessor in your own project
With static library, you will have to links with the dependencies of libcurl, see this answer
You might not want to depend on LDAP, in that case you can disable it by setting the preprocessor CURL_DISABLE_LDAP before you compile libcurl.
If you build with Visual Studio IDE and get 58 odd warnings as the likes of
"inconsistent dll linkage curl_global_init / curl_msnprintf /..."
you should add CURL_STATICLIB to the preproccessor definitions.
so the entire definition line should look like:
USE_SSLEAY;USE_OPENSSL;CURL_STATICLIB.
With this all the warning will disappear.
Some would ignore the warnings and go on using the libs, but then will get corresponding *error*s as the likes of curl_global_init / curl_msnprintf. It can be very annoying.
Hope it can help somebody.
\ fatal error C1083: Cannot open include
file: 'stdlib.h': No such file or directory
NMAKE: fatal error U1077::return code
That error can be solved by executing vcvarsall.bat in Visual Studio.
How to build libcurl C/C++ with OpenSSL (SSL support) on Windows
Install libcurl
Install OpenSSl
Build libcurl with OpenSSL
Installing libcurl
Go to the download page of libcurl and donwnload the ZIP file under Source Archives. In my case it is called curl-7.58.0.zip
Extract the archive and open projects/Windows/VC15/curl_all.sln with Visual Studio.
Installing OpenSSL
Download the windows binary of OpenSSL. In my case, I downloaded the windows installer file Win32 OpenSSL v1.1.0g from the Shining Light Productions distribution.
The installation folder for me is C:\OpenSSL-Win32.
Building libcurl with OpenSSL
In the curl_all.sln Visual Studio solution file, change the build configuration to DLL Debug - DLL OpenSSL.
In the Solution Explorer, right click the project curl and go to Properties.
Under Linker -> General modify Additional Library Directories and add the path to your OpenSSL directory + \lib. In my case, this is C:\OpenSSL-Win32\lib.
Apply and close the properties window.
Right click the project libcurl and do the same as the previous step, add OpenSSL directory + \lib to Additional Library Directories under Linker -> General.
Under C/C++ -> General, add C:\OpenSSL-Win32\include to the Additional Include Directories.
Finally go to Linker -> Input and modify Additional Dependencies. Replace all the lib files to the following:
ws2_32.lib
wldap32.lib
openssl.lib
libssl.lib
libcrypto.lib
Apply and close the properties window.
With the DLL Debug - DLL OpenSSL build configuration still selected, go to Build -> Build Solution.
Copy the two dll files libcrypto-1_1.dll and libssl-1_1.dll from the OpenSSL bin directory (C:\OpenSSL-Win32\bin) to the just created build directory curl-7.58.0\build\Win32\VC15\DLL Debug - DLL OpenSSL.
Validating Build
Inside the build directory, run curld.exe. If it runs with no errors (missing dll, etc.) then your build was successful.
i did "do_nt.bat" for windows 7 rc7100
don't forget "nmake -f ms\nt.mak install" to copy the headers correctly
thanks this did help a lot
Couple of notes in response to and/or in addition to the above..
First, if you don't want to mess with ActivePerl, Strawberry Perl is terrific and worked perfectly for this.
Second, in lieu of using do_ms.bat, I would recommend preferring do_masm if possible since, according to INSTALL.W32,
This is worth doing because it will
result in faster code: for example it
will typically result in a 2 times
speedup in the RSA routines.
Also, build 0.9.8l (L) of OpenSSL was a nightmare so I eventually gave up and reverted to 0.9.8k which built and linked (statically) with libcurl 1.9 without issue.