opencv library installation on windows - windows

I found this project on github that requires the opencv library. The author has given the following instruction for linux and osx but none for windows:
I tried using the linux commands on windows but it gave me an error at cmake, saying
cmake command not found. So i downloaded cmake and tried running it again it still continues to give the same error.
Can someone advise on how to get this working? Or point me to some other way to install the library?
OSX
cd ~
git clone git://code.opencv.org/opencv.git
cd opencv
git checkout 2.4.5
mkdir build
cd build
cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=x86_64 ..
make -j8
sudo make install
Linux (Tested on Ubuntu 12.04)
cd ~
git clone git://code.opencv.org/opencv.git
cd opencv
git checkout 2.4.5
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make -j8
sudo make install
Compiling PuzzleSolver
Once the opencv library has been installed, you can try to open the xcodeproject, or on linux or mac run this from the PuzzleSolver directory (with the source files):
g++ -O3 `pkg-config --cflags opencv` -o PuzzleSolver *.cpp `pkg-config --libs opencv`
This will result in an executable called PuzzleSolver.

just get the binary pack [~400mb]

Related

How to fix ./configure in MSYS2?

I'm trying to build libxc-4.3.4 in an MSYS2 shell on Windows 10. I've installed the latest version of MSYS2 (msys2-x86_64-20220319.exe) and followed the installation instructions. I've installed build tools using
pacman -S --needed base-devel mingw-w64-x86_64-toolchain autoconf
I've installed libxc dozens of time on Linux machines. The first step is
./configure --prefix /somewhere
But in MSYS2 I get
$ ./configure --prefix $PWD/../libxc
bash: ./configure: No such file or directory
How can I make this work?
MSYS2 prerequisites
First of all make sure MSYS2 has all programs that are needed.
In the MSYS2 shell first update the package manager information:
pacman -Syu --noconfirm
Then install the packages you need. I would recommend at least these:
pacman -S --noconfirm autoconf autoconf-archive automake make libtool pkg-config
Project sources
Next you should make sure the folder you are in actually has a configure script:
ls -l configure
A lot of projects these days are switching to more efficient build systems like CMake or Meson.
I usually use the following command in the projects source folder to check for several build systems:
ls -ld configure* m4 CMakeLists.txt cmake Makefile GNUmakefile setup.py scons SConscript SConstruct meson.build meson_options.txt *.pro *.proj *.sln BUILD.gn .gn 2> /dev/null
building libxc
For the libxc project I see there is a CMakeLists.txt file and also a configure.ac file.
So either you should look into using CMake or generate the configure file with:
touch README ChangeLog
autoreconf -f -i -I m4
I have just tried to build libxc in MSYS2 with CMake and Ninja and this worked:
# set the line below to the desired install location
INSTALLPREFIX=D:\Prog\changeme
# build static library
cmake -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DENABLE_PYTHON:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -S. -Bbuild_static &&
ninja -Cbuild_static install/strip &&
echo SUCCESS
# build shared library
cmake -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DENABLE_PYTHON:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -S. -Bbuild_shared &&
ninja -Cbuild_shared install/strip &&
echo SUCCESS

LLVM opt doesn't work on macOS Big Sur: -bash: opt: command not found

I downloaded LLVM from the repository with git clone https://github.com/llvm/llvm-project.git and installed it on macOS Big Sur using the following commands:
$ cmake ../llvm -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=~/llvm-project/build \
-DBUILD_SHARED_LIBS=on \
-DLLVM_ENABLE_PROJECTS=clang
The installation went well and I can compile my foo.c program using clang -c -emit-llvm foo.c -o foo.bc obtaining foo.bc.
However, when I use opt -dot-cfg foo.bc to obtain the CFG, I have this error: -bash: opt: command not found.
Has anyone had this error? The solutions for previous versions of O.S. did not work!
when you clone a git project, you do not need to include the file. You just need to type
git clone https://github.com/llvm
You use two dots when calling the command.
../llvm
this tells bash "move up one directory level" and llvm is not one directory level up. this will work:
cmake ./llvm -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=~/llvm-project/build \
-DBUILD_SHARED_LIBS=on \
-DLLVM_ENABLE_PROJECTS=clang
The tool opt is installed in $HOME/llvm-project/build/bin.
You need to add $HOME/llvm-project/build/bin in your $PATH
"I can compile my foo.c program using clang" - Are you sure you are using your newly built clang and not the one shipped with XCode? opt should be inside ~/llvm-project/build/bin alongside clang. – Solved by #mcilloni in May 2 at 17:38

installation and test of GTK-fortran on Windows 10

I tried to follow the steps here : https://cyber.dabamos.de/programming/modernfortran/gtk.html
We first have to build the Fortran interface library gtk-fortran.
Create a directory build/, run CMake to output a Makefile, and then
compile the libraries:
$ git clone https://github.com/vmagnin/gtk-fortran
$ cd gtk-fortran/
$ mkdir build && cd build/
$ cmake ..
Here what happened when I tried to run "cmake .." :
My Fortran compilator has been installed by MSYS (pacman) AND by using MINGW. I can compile and execute my Fortran program from the CMD.
If you have an idea what happened... It will be very helpful. I'm not an expert in the use of those tools but I'll try anything...
The Windows gtk-fortran instructions states that you should generate make files with the command $ cmake -G "MSYS Makefiles" .. (default on MSYS or MINGW is "NMake Makefiles"). It works form the MINGW terminal window. From the CMD window, I don't know.

Why Clang and LLVM is giving math.h error in Mac OS/Xcode

I am trying to build clang and LLVM 9.X on MacOS using source files. I am doing following steps on terminal:
git checkout origin/release/9.x
cd llvm-project
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Xcode" ../llvm
cmake --build .
sudo cmake --build . --target install
However, when I am enabling CC flag in Xcode, and giving path to clang binary inside build folder, and building code, it is giving me following error:
cmath.h not found
could not build simd.h
Please help, i think I am missing some steps.
enter image description here

Cant build V8 with GYP successfully on Mac OSX

I followed V8 Build Instructions from here
Here are the steps that I'm following to build V8 on Mac OSX.
1. git clone git://github.com/v8/v8.git v8-src && cd v8-src
2. make dependencies
3. make x64 -j8 library=shared snapshot=on console=readline
But I do not see out/x64.release/obj.target/tools/gyp/libv8_base.x64.a (or snapshot.a)
The Folder only contains js2c.stamp
Here is the Gist: Build Output
What am I doing wrong ..
Ok, the documentation specifies the location for Linux Machines. For Mac OSX, these files are here :
out/x64.release/libv8_base.x64.a (& snapshot.a)
Finally, compile your C++ Module, by linking V8, as below:
g++ -Iinclude test.cc -o test out/x64.release/libv8_{base.x64,snapshot}.a -lpthread

Resources