I am having troubles installing libxmlplusplus (https://github.com/libxmlplusplus/libxmlplusplus) in Visual studio.
It is extremely annoying libxml2 wrapper that someone used to parse setup for project I am working and it has so many annoying little dependencies that I am tempted just to rewrite setup parsing with new code as I want to distribute this project as open source and I wish to no one to go through with installation of this library.
The README file in MSVC_NMake directory states that I only need to install libxml2 and include it in my VC directories.
Now I know that this hellish library also needs glib, and glibmm as few years back, this person http://hostagebrain.blogspot.com/2015/07/building-libxml-by-visual-studio.html went through horrible ways to build everything in VC when I am assuming glibmm and libxml2 were not easy to get.
I installed glibmm and libxml2 via vcpkg.
I downloaded libxmlplusplus, went to MSVC_NMake directory and run:
nmake /f Makefile.vc CFG=release
I am getting error messages as:
..\libxml++\attribute.cc: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
So it seems some dependency is not linked, but have no idea which.
I checked ..\libxml++\attribute.cc and went down the include labyrinth to find out that it includes libxml\tree.h and libxml is part of libxml2, so I am suspecting libxml2 was not linked properly.
I exited powershell and then went to manually set VC includes and library dirs to vcpkg/packages/xxx location where they are installed, but I am still getting the same error.
I added glibmm to VC dirs, I even installed gtk and linked to VC hoping it'll find the missing header.
Can someone please help? Shouldn't vcpkg packages be in "path" when running nmake automatically? Am I missing completely different dependency?
nmake won't magically see vcpkg installations. You need to either setup the environment variables (LIB/LIBPATH/PATH/INCLUDE/CL/LINK etc) for it or provide the paths to vcpkg in some other way.
That being said libxml++ is a available port in vcpkg -> see libxmlpp
Related
I'm working on a C++ project that requires libpng. So far I've worked on Linux and everything is smooth. I installed libpng, CMAKE picks it up and everything is alright. Now move to Windows.
Here I first installed zlib (required by libpng) and libpng. When I say install, I mean I downloaded the source files, and then built them and install them using msbuild.
I noticed that by doing so, I got new folders under c:\program files (x86):
c:\program files (x86)\zlib
c:\program files (x86)\libpng
Seemed all right to me. Now when I configure my project with CMAKE zlib is picked up:
-- Found ZLIB: C:/Program Files (x86)/zlib/lib/zlib.lib (found version "1.2.13")
but there's no way CMAKE finds the PNG library:
Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Now I tried to have a look at the FindPNG and I noticed this line:
find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng)
Does this mean that CMAKE expects the file png.h to be in a directory ending in include/libpng? If so, then it will never find it because in my case png.h is placed in libpng/include. But this is also the "official" installation from the source code just downloaded from http://www.libpng.org/pub/png/libpng.html.
So now I am superconfused. How things are supposed to work in Windows? Should I "create" a folder structure with the correct files for every library so that CMAKE is happy? In a way I hoped things in Windows were similar to what happens in Linux: libraries go in a standard folder, they are detected by CMAKE.. everything is ok. But apparently this is not the case. So my question in general is: how do you ship a package like this to a Windows user so that he can builds it without having to go through all this?
Thanks so much
Fabrizio
This would be the right one to use:
find_package(PNG)
You can tell CMake to look in the location where you installed it by adding the libpng base install location to CMAKE_PREFIX_PATH. Without this, CMake doesn't know where you put it.
cmake "-DCMAKE_PREFIX_PATH=C:/Program Files (x86)/libpng" ...
Note that FindPNG first looks for zlib and will fail if zlib could not be found.
I've been trying to install hmatrix on my (64-bit) Windows 10 computer; after searching through and trying many possible solutions (including the instructions under "Windows" and "Alternative Windows Build" given here), I decided to pursue the course of action given on this Reddit thread.
However, when I type in the command
cabal install hmatrix -fopenblas --extra-lib-dir=${c:\msys64\mingw64\bin} --extra-include-dir=${c:\msys64\mingw64\include}
into the MSYS2 shell, the following log is given:
Resolving dependencies...
Configuring hmatrix-0.17.0.2...
Failed to install hmatrix-0.17.0.2
Build log ( C:\Users\Christian\AppData\Roaming\cabal\logs\hmatrix-0.17.0.2.log ):
Configuring hmatrix-0.17.0.2...
cabal.exe: Missing dependency on a foreign library:
* Missing C library: libopenblas
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Leaving directory 'C:\msys64\tmp\cabal-tmp-4244\hmatrix-0.17.0.2'
cabal.exe: Error: some packages failed to install:
hmatrix-0.17.0.2 failed during the configure step. The exception was:
ExitFailure 1
However, when I check the directory c:\msys64\mingw64\bin, I see that libopenblas.dll is right there; I don't know why cabal can't seem to find it.
Any insight into why this is not working or what to do?
UPDATE:
The files libopenblas.dll.a and libopenblas.a are in the directory c:\msys64\mingw64\lib. Is it possible I need to somehow include this directory as well? (If I do, how would I do that?)
I also downloaded the files in Alex Vorobiev's comment below and put them in c:\msys64\mingw64\bin if they are .dlls or c:\msys64\mingw64\lib if they are .libs. The header files were already contained in c:\msys64\include\openblas.
I tried several variations on the command in the original post after making these changes, including switching \bin with \lib and switching \include with \include\openblas, but all of them still give the same error.
I'm a bit suspicious about the
if os(windows)
if flag(openblas)
extra-libraries: libopenblas
in the cabal file, could you unpack it and remove the "lib" part? If that doesn't work please post a log with -v3 output. I've seen quite a few people with troubles installing this package. So could you also open a ticket on the GHC bug tracker if this doesn't work (and CC me "Phyx-")?
Secondly, you never said which version of GHC you're using. 8.0.1 should have far less trouble (and won't need the hack to get it working in GHCi) since the runtime linker has been overhauled and should be much better on Windows. 8.0.2 will likely include the new import libraries support as well.
So I am trying for whole day to integrate Boost with Visual Studio (2008) on Windows 7.
I firstly I went twice trough this How to use Boost in Visual Studio 2010.
I searched over all (there are at least 3 of them) simiral topics and none of them worked.
Some people proposed using this one : www.boostpro.com/download/ but link is not active.
Someone proposed to change runtime library to Multi-threaded DLL but is also didnt work.
I just try to include #include <boost/thread.hpp> and got this error
fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-s-1_53.lib'.
Before installing Boost the error was that it cannot find the thread.hpp so it seems like the Boost is installed somewhat correctly.
The problem is that the libraries were not build while I was using the tutorial. How can I build them manually?
There's no such thing like one-click boost install, you still need to do something manually. In your case it seems you need to compile Boost.Thread library and then add directory where resulting .lib file is to your library path. The link you provided looks pretty good. If you followed it probably you already built Boost.Thread. Make sure you did #6 from the second part.
There are prebuild binaries - installation packages:
http://sourceforge.net/projects/boost/files/boost-binaries/1.53.0/
Use this command:
bjam --build-dir=build-directory toolset=toolset-name --build-type=complete stage
this build the libraries manually. Then add the new directory to additional libraries path
as it is indicated in this link:
http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source
I found this article quite helpful:
http://www.codeproject.com/Articles/11597/Building-Boost-libraries-for-Visual-Studio
The article explains how to build the build tool BJam (mainly by locating the boostrapper.bat)
How to build the libraries, e.g. bjam toolset=msvc-11.0 variant=debug threading=multi link=static (in this case the VS2012 multi-threaded, statically linked debug version).
It also features build batches, but I haven't tried them.
It has some additional information on how to specifiy the used C-Runtime
I am trying to build xmlsec on Windows... I am not an experienced C/C++ developer and not really familiar with the build process if something along the lines of "make ... make install" doesn't do the trick.
xmlsec comes with a Win32 subdirectory, a nice ECMAScript configure.js that takes an optional bunch of parameters and a readme which explains that after running the configure, "nmake ... nmake install" should do the trick. (Obviously it isn't quite that easy or I wouldn't be posting here!)
xmlsec also depends on a number of other libraries (see here for a graphic). I have downloaded the sources for those libraries.
My problem is that I don't know how to arrange those sources, or what to tell the configure.js script, in order to get a build to work.
For instance, the nmake process complains that it can't find "iconv.h" (iconv is one of the required libraries), which is not surprising because there isn't one. Instead there is an "iconv.h.in" and an "iconv.h.build.in"... which I don't know what to do with to produce the required 'iconv.h".
(I am using MS Visual Studio 2010 at the command prompt (which I think is the recommended approach.)
Does anybody out there know how to do this? Any help at all would be very much appreciated.
TIA
Mike Peat
You don't need to build xmlsec, you can directly download the wheel file from this link
https://github.com/mehcode/python-xmlsec/releases
It has all the dependencies installed with it.
have you tried the Msys with Mingw32 compiler? In Msys, you can do make and make install trick. I have successful with Msys in compile xmlsec. If you want to use Msys and have difficulties, I can help.
Anyway, in general, there must be a iconv.h file in the pre-compile folder provided by Zlatkovic (i.e C:\iconv\include\iconv.h). You may want to download again the folder. After figure out where all the dependencies are, put the path in environment path. For your information, I once tried with the configure.js but not successful. Hope that you are luckier than me :D
Hi Kristine (#Kristine T) - (and thanks for getting back to me!)
I had not been doing "make clean", but have now done so ("make clean", followed by "make" - no change in the result though).
The problem I get with the "make" is that it throws an error on compiling "dl.c" saying that "PACKAGE" is undefined (line 295).
I have also had problems using the compiled version of libxml2 - "configure" always says it can't find it (it is there, but...), so I have been using the --with-libxml-src=... parameter to configure, giving it the full source of libxml2 to work with, getting configure to at least finish OK.
I don't have the same problems with openssl or libxslt where I can either tell configure about the compiled version (using --with-XXX={path-to-dir}, or just omit ={path} bit, in which case it seems to find MinGW's own versions, but that doesn't work with libxml2.
Mike
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.