How to install LAPACK for MSVS 2010 on windows? - c++

I am using the ITPP library (IT++ library) for one of my projects. For using the eigen_sym() function of this library, it asks for installing the LAPACK. I tried the direct prebuilt libraries for Windows but still get the error. Finally on the following site:
http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries
I found a solution under "Build Instructions to create LAPACK and LAPACKE 3.5.0 dlls for Windows with MinGW" that might work. I did steps 1 to 5 but got stuck 6 onwards.
My destination of the cmake build is E:/LAPACK
I got an error while in the cmd prompt while entering:
cd E:/LAPACK 3.5.0 >Enter
C:/MinGW/bin/mingw32-make.exe >Enter
i'm getting
mingw32-make.exe> No targets specified and no make file found. Stop.
Can someone explain the step 6 onwards in detail and tell me where i'm going wrong?
I finally want to get the .dll and .lib files.

I was able to build LAPACK 3.5 for windows using mingw and pretty much the build guide from the LAPACK page. Using the following steps
Download lapack.tgz from here http://netlib.org/lapack/lapack.tgz
Extract to a folder. I used 7zip file manager to extract the tarball to x:/Other/test
Install mingw32. I used this: http://www.mingw.org/download/installer and I selected and installed mingw32-developer-toolkit + mingw32-base + mingw32-gfortran + mingw32-gcc-g++ + msys-base
Open a command prompt
Append mingw to your path
path=C:/Mingw/bin;%PATH%
change directory to the location you extracted lapack: For me this was X:\Other\Test\lapack-3.5.0 so the command I typed was the following (your path will be different):
C:\Users\jdrescher>x:
X:>cd Other\Test\lapack-3.5.0
X:\Other\Test\lapack-3.5.0>
make a folder for your build. I used build
X:\Other\Test\lapack-3.5.0>mkdir build
then change directory to the build folder
X:\Other\Test\lapack-3.5.0>cd build
X:\Other\Test\lapack-3.5.0\build>
Now configure with CMake
X:\Other\Test\lapack-3.5.0\build>cmake -G "MinGW Makefiles" -D BUILD_SHARED_LIBS=ON -D CMAKE_GNUtoMS=ON ..
Now use gnu make to build LAPACK
X:\Other\Test\lapack-3.5.0\build>c:\MinGW\bin\mingw32-make.exe
Note: This step will take several minutes.
After the above steps completed 100% with no errors, I have the following dlls in the build\bin folder: libblas.dll, liblapack.dll, libtmglib.dll
Also the following libraries, and exp files in the build\lib folder: libblas.exp, libblas.lib, liblapack.exp, liblapack.lib, libtmglib.exp and libtmglib.lib.

Related

"CMakeLists.txt" seems to be missing

I was trying to build SFML in order to start developing 2d-games in c++. I put the source-code directory inside C: (the directory itself is called 'SFML'). while trying to generate .cbp files using CMake, I ran into an error:
"The source directory "C:/SFML" does not appear to contain CMakeLists.txt"
It seems like there is a missing file that CMake didn't create.
I am using Cmake 3.10.1, the installation file can be found in https://cmake.org/download/ under the title:"Windows win32-x86 Installer".
I tried to build SFML 2.4.2, using the generator of Codeblocks - MinGW makefiles. The version of codeblocks used is: codeblocks-16.01mingw-setup.exe, found in http://www.codeblocks.org/downloads/26
Did someone encounter the same problem before and knows how to overcome it? If not -
Is there an already-built, ready to use, libray of this version? (2.4.2)
If not.. do you know about a version of SFML that is usable in visual studio 2017?
And another question (That is the last one, I promise...) - maybe you can recommend me about another library for c++, that is usable to develop 2d-games?
edt:
note: I am completely new to all this building thing
the containments of SFML:
maybe it's the binary version?
lib contains some static libraries, bin contains some .dll s
You probably downloaded something wrong or potentially extracted the SFML source into a sub folder or something like that.
Since you've mentioned Visual Studio: SFML is 100% compatible with Visual Studio and you can build it from source any time without having to worry about dependencies (everything included in the repository).
The steps to compile are pretty easy. I'd recommend you install Git to clone the latest source from the SFML repository. In addition you'll need CMake, which you obviously got already.
Open a Command Prompt and change your directory to C:\SFML.
Clone the official repository using Git: git clone https://github.com/SFML/SFML.git source (note the trailing .)
Wait for the source to be checked out to the source sub directory.
Create a new directory called build: md build && cd build
Now invoke CMake, pointing to the source directory and also defining your install path: cmake -DCMAKE_INSTALL_PREFIX=C:/SFML ../source
Build and install a debug build of SFML: cmake --build . --target install --config debug
Build and install a release build of SFML: cmake --build . --target install --config release
Alternatively you can just open the generated Visual Studio solution and build the INSTALL project on your own.
(You shouldn't have to define a build tool or anything; CMake should notice Visual Studio being installed and pick it up automatically.)
I have experienced this using cmake version 3.10 when using the -S command line option. On cmake version 3.15.4 it behaves as expected - so if you update cmake then it might just work.
Note that the -S command line option was not supported before version 3.13:
https://cmake.org/cmake/help/v3.13/release/3.13.html#command-line
Normally cmake is called from a "build" subdirectory of a project root, the project root contains CMakelists.txt. So you would create a "build" directory, change to it, and submit "cmake ..". This would pull in CMakelists.txt from the project root, and use the "build" subdirectory that you are in as the build directory. We say "build", what it actually does is generate makefiles which can then used by the "native" build system (e.g. "make" or Visual Studio) to perform the actual compilation and linking. This arrangement is not always convenient, hence the introduction of the -S and -B command line options.

OpenCV Contrib Module Installation on Mac

I have searched here on StackOverflow and other sites to figure out how to install OpenCV 3.0 the Contrib Modules. I have downloaded the extra modules and extracted the zip file to the /opt/local/include/opencv2/opencv_contrib/ folder. I've navigated to the /opt/local/include/opencv2 folder and typed the following command in the terminal:
cmake -DOPENCV_EXTRA_MODULES_PATH=/opt/local/include/opencv2/opencv_contrib/modules/ /opt/local/include/opencv2
I get:
-bash: $: command not found
If I just type in cmake -D, I get:
CMake Error: -D must be followed with VAR=VALUE.
CMake Error: Problem processing arguments. Aborting.
So I know it recognizes the cmake command with the -D tag.
Any ideas?
Nobody said that installing OpenCV and their modules was easy.
Just like you, I already had Opencv 3.0.0 installed and running and wanted to add the contrib modules.
Steps:
1st- Delete and download again the OpenCV3.0.0 folder (is not necessary, but after twitching around, I prefer to download a new one) download the openccv_contrib and place them in the same folder.
2nd- Go to the OpenCV3.0.0 and create the build folder.
3rd- Open Cmake gui and follow the steps form https://github.com/itseez/opencv_contrib.
3.1- Fill “Where is the source code” with the rotute of where is openCV3.0.0. (my case /Users/Rafearl/Program/ComputerVision/opencv-3.0.0)
3.2- Fill “Where to build binaries” with the build route(/Users/Rafearl/Program/ComputerVision/opencv-3.0.0/build)
3.3- Press configure
3.4- In the search bar search for “OPENCV_EXTRA_MODULES_PATH” and fill with the Opencv_contrib modules(/Users/Rafearl/Program/ComputerVision/opencv_contrib-master/modules)
3.5- Click configure again and then click generate. By default current generator: Unix makefiles
4th- In terminal go to your build folder
5th- make -j4 (4 is the number of cores of the processor)
6th- sudo make install
Now you can check the lib in the build folder that the contrib libraries are added
If you don´t want to download the OpenCV3.0.0 again just follow the same steps without downloading or deleting anything.
If you already have Opencv in Xcode, everything should work but just as a piece of advise; many of the OpenCV2.4 examples does´t work in the 3.0 version.

How to build Blitz-0.10 library?

I need to use blitz++ 0.10 library in vs2012. Unfortunately, I'm new to c++ and don't have enough experience to know how should I build this library.
Till now, I have been using CMake to build libraries (e.g., VTK). But in case of blitz, as to why there is no "CMakeLists.txt" file, I don't know what should do.
I was wondering If someone could help me in this way (step by step).
(Win 7, 64bit, VS2012)
Here is how I tried. It's fairly simple. Worked for me
Follow the steps -
Download blitz++ from https://github.com/blitzpp/blitz (It will download a zip file)
Unzip the file and save it into a folder.
Install visual studio 2019(the version i used to check)
Install cmake.(ADD it's path to system variable during installation)
Open Powershell with admin priviledge(necessary)
go to directory where you unzipped the blitz++ (You have to go into the directory where cmakelist.txt file is)
Run sequentially
md build
cd build
cmake ..
cmake --build . --config Release
cmake --build . --target install
You will have a blitz folder in program files(x86). include the include lib and include folder in your project properties. Done....

Trouble building the Open Asset Import Library (Assimp)

I have just downloaded the Open Asset Import Library (Assimp) which is an API used to import 3D file formats such as .3DS and .Obj into source code. Doing so allows for much easier rendering of meshes using openGL.
The problem is, I can't get the Library to build. It comes with very vague and cryptic directions on how to build it and connect to a compiler such as XCode (which I am using). It says I should use a program called CMake to build the library. I have downloaded CMake and tried to use it but it has not yet worked for me.
Has anyone here successfully built and installed Assimp using CMake or some other tool?
I totally agree that the documentation for Mac is a bit lacking, but I have managed (after several attempts) to build and install the library.
A few things before starting: make sure you have installed XCode Command Line Tools (that installs the GNU compiler).
These are the steps I followed:
Download the latest release of Assimp and extract it (I got the file
from here, the one with source only:
http://sourceforge.net/projects/assimp/files/assimp-3.0/)
If you don't have it, install CMake (http://www.cmake.org/cmake/resources/software.html; I'm currently using an older version, but the latest one should work fine as well)
Create a build directory (should be outside the source directory)
Open CMake and point it to the folder you created at step 1 (where it says "Where is the source code"); the other folder ("Where to build the binaries") should point to the folder created at step 3
Click "Configure" on the bottom; it will ask you which environment you'd like to use. I picked "Eclipse CDT 4 - Unix Makefiles"
You should get a list of options; the two I selected were "BUILD_STATIC_LIB" and "ENABLE_BOOST_WORKAROUND"
Click "Generate"
Now you should move to the terminal and go to the folder created at step 3
Type "make" and launch it; you should see the build progressing without issues
When the build is finished, type "sudo make install"; it will ask for your password and install the library
After the last step you should be able to include the library in your code:
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
Make sure you also include the library for linking; when linking you should add -lassimp to the list
Let me know if you have any issues with the steps above!
I had a slightly different approach that worked for me building assimp on Mac. Here are the steps that I took if it helps anybody.
Step 1 - Install Libraries with Homebrew
brew install glm glew assimp
Step 2 - Update my CMake with the Following
FIND_PACKAGE(ASSIMP REQUIRED)
LINK_DIRECTORIES(/usr/local/lib)
add_executable(
myExecutable
...
)
TARGET_LINK_LIBRARIES( myExecutable PRIVATE ${ASSIMP_LIBRARIES} )

How do I use CMake?

I am trying to use CMake in order to compile opencv.
I am reading the tutorial but can't understand what is CMakeLists files and how is it connected to the gui of CMake?
Also couldn't understand what are makefiles, are they the same is CMakeLists?
And which file is it which I in the end open with visual-studio?
I don't know about Windows (never used it), but on a Linux system you just have to create a build directory (in the top source directory)
mkdir build-dir
go inside it
cd build-dir
then run cmake and point to the parent directory
cmake ..
and finally run make
make
Notice that make and cmake are different programs. cmake is a Makefile generator, and the make utility is governed by a Makefile textual file. See cmake & make wikipedia pages.
NB: On Windows, cmake might operate so could need to be used differently. You'll need to read the documentation (like I did for Linux)
CMake takes a CMakeList file, and outputs it to a platform-specific build format, e.g. a Makefile, Visual Studio, etc.
You run CMake on the CMakeList first. If you're on Visual Studio, you can then load the output project/solution.
Yes, cmake and make are different programs. cmake is (on Linux) a Makefile generator (and Makefile-s are the files driving the make utility). There are other Makefile generators (in particular configure and autoconf etc...). And you can find other build automation programs (e.g. ninja).
CMake (Cross platform make) is a build system generator. It doesn't build your source, instead, generates what a build system needs: the build scripts. Doing so you don't need to write or maintain platform specific build files. CMake uses relatively high level CMake language which usually written in CMakeLists.txt files. Your general workflow when consuming third party libraries usually boils down the following commands:
cmake -S thelibrary -B build
cmake --build build
cmake --install build
The first line known as configuration step, this generates the build files on your system. -S(ource) is the library source, and -B(uild) folder. CMake falls back to generate build according to your system. it will be MSBuild on Windows, GNU Makefiles on Linux. You can specify the build using -G(enerator) paramater, like:
cmake -G Ninja -S libSource -B build
end of the this step, generates build scripts, like Makefile, *.sln files etc. on build directory.
The second line invokes the actual build command, it's like invoking make on the build folder.
The third line install the library. If you're on Windows, you can quickly open generated project by, cmake --open build.
Now you can use the installed library on your project with configured by CMake, writing your own CMakeLists.txt file. To do so, you'll need to create a your target and find the package you installed using find_package command, which will export the library target names, and link them against your own target.
Cmake from Windows terminal:
mkdir build
cd build/
cmake ..
cmake --build . --config Release
./Release/main.exe
Regarding CMake 3.13.3, platform Windows, and IDE Visual Studio 2017, I suggest this guide. In brief I suggest:
1. Download cmake > unzip it > execute it.
2. As example download GLFW > unzip it > create inside folder Build.
3. In cmake Browse "Source" > Browse "Build" > Configure and Generate.
4. In Visual Studio 2017 Build your Solution.
5. Get the binaries.
Regards.