Compiling LZ4 compression library on Windows - c++

I'm trying to use the LZ4 compression library with a C++ project in Visual Studio 2013. I need to build the .dll files for it so I can link it in the project. I'm trying to use mingw to build it with the make file, but that is throwing unpleasant errors. Navigating to the base directory of the repository and running mingw32-make.exe gives the following error output:
process_begin: CreateProcess(NULL, uname, ...) failed.
The filename, directory name, or volume label syntax is incorrect.
Makefile:72: recipe for target 'lz4programs' failed
mingw32-make: *** [lz4programs] Error 1
I'm not overly familiar with compiling make files on Windows, and am having difficulty with figuring out what's causing the error. Additionally, in something that I find rather odd given how popular this compression library is, I cannot find any information online about compiling it for Windows. Any assistance in getting this thing to compile would be greatly appreciated.

I was able to use CMake with the CMakeLists.txt file in the cmake_unofficial folder to compile the library and the lz4 executable.
The solution is compiling a static version of the library. If you want a dll version, you should be able to experiment with the Visual Studio settings to get the dll if the static library isn't sufficient.

Related

Which files shoud I copy to my project to use ImageMagick? or How to compile ImageMagick with MinGW on Windows?

My question might look a little simple because I am new with QT and C++ but I was struggling with this for a day, so I decided to ask someone for help. I am trying to use the ImageMagick library in my QT-MinGW C++ project to convert between different image types. I downloaded the source code from here and followed the described steps to build it:
./configure
make
make install
Now I can use commands such as convert, magick and etc. in the command line, but How should I add the library to my QT project? There is no .dll and \include folder. Which files should I add to my project? Where is the library file?
Note: I would like to use the library in the Windows environment. I am using Windows Subsystem for Linux to compile it.
Note 2: I have tried to compile with MinGW MSYS on windows but I got thousands of warnings plus error : c:\ImageMagic/MagickCore/nt-base.c:2774: undefined reference to SetDllDirectoryW' collect2.exe: error: ld returned 1 exit status make[1]: *** [MagickCore/libMagickCore-7.Q16HDRI.la] Error 1.
Desperately need for help.
If you have built ImageMagick with MinGW as both static and shared libraries you should have these .a files in the lib folder:
libMagick++-7.Q16HDRI.a
libMagick++-7.Q16HDRI.dll.a
libMagickCore-7.Q16HDRI.a
libMagickCore-7.Q16HDRI.dll.a
libMagickWand-7.Q16HDRI.a
libMagickWand-7.Q16HDRI.dll.a
and something like these .dll files in the bin folder:
libMagick++-7.Q16HDRI-4.dll
libMagickCore-7.Q16HDRI-7.dll
libMagickWand-7.Q16HDRI-7.dll
If you don't have the .dll.a and .dll files then you don't have the shared build.
If you built ImageMagick yourself and the shared libraries are not built, it could be because the dependancies are also missing their shared libraries.

Link glew.lib as a static library with eclipse

I am a newbie in C++, I made many searches before I ask, I started OpenGL tutorial with C++ , I am using eclipse with GNU cross compiler, I know how to like static libraries with libXXX.a format then I want to use GLEW library, I have its source code and a precompiled version for windows which is libglew32.lib, if I use make to compile the source code I get an error which is
make (e=2): The system cannot find the file specified.
Makefile:131: recipe for target 'tmp/cygwin/default/shared/glew.o' failed
make: *** [tmp/cygwin/default/shared/glew.o] Error 2.
if I put the library in the libraries folder and add it to the linker as I do with other libraries I get errors in compiling the project like undefined reference to 'glewExperimental' or Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)'
so I have 2 questions:
how can I compile the source code correctly to a static library which I can use in eclipse.
can I add .lib files to use with eclipse? if yes, how can I do?
I compiled it using gcc and lined by ar finally I get the libglew.a

Boost c++ LNK1104 cannot open file 'libboost_serialization-vc140-mt-gd-1_62.lib' error

I am currently trying to add boost to my c++ project but I am hit with this error
LNK1104 cannot open file 'libboost_serialization-vc140-mt-gd-1_62.lib'
i am actually trying this guys method Here
And i am going to use the headers only library using visual studio 2015 but i keep having this error , I've also tried using the nuget to install the boost but it gave me the same error
when i try using b.jam following this person's guide here
And I always get failed to update error so i have no clue what to do to get boost running in my C++ project
First of all, need to Building Boost.Build engine (just run bootstrap.bat on Windows)
Second step is to compile boost libraries (run b2.exe on Windows)
Third and the final step is to add path "...\boost_1_62_0\stage\lib\" to General->Library directories project configuration
I got the same error when trying to build a CMake application using Boost on Windows, also after building Boost. I could find the exact *.lib file in the Boost directory, but I would still get the "Cannot open file" error.
I solved it by adding the -DBoost_USE_STATIC_LIBS="ON" flag to my application build. (You could also add set(Boost_USE_STATIC_LIBS ON) to your application CMakeLists.txt.)

How to build Crypto++ library on Linux with MinGW?

im trying to port a c++ project from visual studio 2013 to netbeans on ubuntu. The target is a windows executable, so far im able to compile windows exe files from netbeans using mingw as compiler.
The project needs the Crypto++ library and i only have the .lib version for visual studio. To include the library in netbeans i first need to build the Crypto++ library in the .a format.
Its not clear to me how should i do that.
Ive found informations on how to build the library for linux with mingw but not for cross compilation with mingw. The provided GNUmakefile does not work.
Should i set up a vm with windows and mingw and compile the library that way? Or maybe use the qmake "hack" as suggested here http://www.qtcentre.org/threads/28809-Compiling-amp-using-Crypto-with-mingw-version-of-Qt ? The last good Crypto++ version suggested there is quite old. This is confusing, porting the whole project is easier than having the required library.
Im open to any suggestion.
tldr: how to build libcryptopp.a on linux for the cross compilation of a windows exe project
edit:
for example if i cross compile something there are windows libraries in the /usr/i686-w64-mingw32/lib/ folder like libuser32.a. i need to make the equivalend libcryptopp.a.. sorry if is a bit unclear.
if i simply build using the steps in answer (and in the wiki) i end up with a libcryptopp.a file but i suspect is linux-only, cause if i link that library in netbeans in the .exe file im cross compiling i end up with undefined references to cryptopp stuff everywere. the paths are correct, i suspect the library needs to be replaced with the equivalent libcryptopp.a compatible with crosscompiling.
edit2: im trying to follow the answer down here, now im stuck here. after this command to build cryptopp.
make CXX=/usr/bin/i686-w64-mingw32-gcc INCLUDES="-I /usr/i686-w64-mingw32/include" LIBS="-L /usr/i686-w64-mingw32/lib" CXXFLAGS="-std=c++0x"
and many variations of it i always end up with this error
trap.h:26:25: fatal error: Windows.h: No such file or directory
# include
which makes me think its using the right compiler to make a .a lib file for cross compiling the windows .exe with the lib.
however i dont understand whats going on now with the missing header..:(
Also if i try to link the lib file (used with visual studio) i get a lot of linking errors, undefined reference to cryptopp stuff.
ill offer a symbolic beer (a couple of $ of Bitcoins) if someone finds out how to do it.
Inspired by http://wiki.amule.org/wiki/Cross-compilation_for_windows_with_mingw:
sudo apt-get install mingw-w64
git clone https://github.com/weidai11/cryptopp
cd cryptopp
export TARGET=i686-w64-mingw32
CXX=$TARGET-g++ RANLIB=$TARGET-ranlib AR=$TARGET-ar LDLIBS=-lws2_32 make -f GNUmakefile
I've found informations on how to build the library for linux with mingw but not for cross compilation with mingw.
Its relatively easy...
Get Crypto++ ZIP into MinGW.
Unpack Crypto++ ZIP.
Change directories.
Build the library.
Verify All tests passed.
(1) and (2) can be tricky because Cygwin and MinGW are missing a lot of tools. So curl https://www.cryptopp.com/cryptopp563.zip -o cryptopp563.zip may not work.
For (2), I seem to recall ZIP is missing, so unzip -aoq cryptopp563.zip -d cryptopp-5.6.3 may not work.
At step (4), just perform make static dynamic test and be sure it finished with All tests passed.
I do a lot of testing with Cygwin and MinGW. I have a script that copies Crypto++ into the environments from my Desktop. I have not been able to figure out a way to automate it. A recent question on automating it was closed, so no one can supply an answer (see How to automate software testing for Cygwin and MinGW).

Link error with libCGAL-vc120-mt-sgd-4.5.1.lib and cant seem to find or build it

Hey I'm a bit of a noob when it comes to CGAL and CMake but I've gotten to the point where everything seems to be running except for this link error:
LINK : fatal error LNK1104: cannot open file 'libCGAL-vc120-mt-sgd-4.5.1.lib'
trouble is I cant seem to find a reference to this lib anywhere am I building wrong?
I can see a 'libCGAL-vc120-mt-gd-4.5.1.lib' in my cgal lib dir which links fine. I'm not sure what the difference between gd and sgd is though and how to make it.
Any help is appreciated.
The naming libCGAL-vc120-mt-sgd-4.5.1.lib shows that you are compiling a program, that uses CGAL, using the linker flag /MTd (Debug, and link the C++ runtime statically).
The CMake scripts of CGAL do not support linking with the static runtime. They only support /MD or /MDd. I suggest you change that linker flag in your setup.
Alternately, you can try to change the CMake scripts of CGAL, but I do not recommend that solution.