How to tell ImageMagick's configure where to find Libpng and Zlib? - imagemagick

I was going through this old post Compile ImageMagick from source with PNG support on OSX.
I did mostly all of what it says with minor changes. Libpng and Zlib are in the following paths
/usr/local/libpng
/usr/local/zlib
When trying to configure ImageMagick 7.0.5-7 I do it like
./configure --prefix=/usr/local/imagemagick
CPPFLAGS='-I/usr/local/libpng/include -I/usr/local/zlib/include'
LDFLAGS='-L/usr/local/libpng/lib -L/usr/local/zlib/lib'
--enable-shared --enable-delegate-build
But still png and zlib are marked as
ZLIB --with-zlib=yes no
PNG --with-png=yes no
In some other website I read that I should add to the system variable PKG_CONFIG_PATH the path to the .pc files. So before running configure I tried also
export PKG_CONFIG_PATH=/usr/local/libpng/lib/pkgconfig:/usr/local/zlib/share/pkgconfig/
but still the libraries are not recognized.
Anyone around that knows how to tell the configure script where to look for the libraries?

I got it working !
After exploring the configure file I figured out that what was missing was pkg-config tool.
I just download it from this site installed it.
Run the command above and it works fine now.

Related

GraphicsMagick with LIBPNG library

How should ./configure args look like in order to make install to build graphicsmagick with support of JPG conversion?
This is what I've been doing so far (which not working out):
./configure LDFLAGS="-L/Users/my_user/Downloads/libpng-1.6.10" LIBS="-libpng"
You need to install all the external libraries that you want to support before running the configure command.
At the moment, you've got only PNG support. If you want to support JPEGs, you need to install libjpeg. There are different ways to do so depending on your operating system (Mac or Linux?), or you can grab the sources and compile it yourself with the same commands (./configure, make, sudo make install).
Of course, if you want to support JPEG 2000, TIFF, etc you need to install the corresponding libraries too. See README.txt for more info and link on what libraries are needed to read what format.
I don't think you need to pass the LIBS="-libpng" to configure, GraphicsMagick should add it by default as long as it's being built with PNG support. You still need the LDFLAGS though as libpng is not "installed" and in a standard path. GraphicsMagick looks into /usr/local/lib by default so if you install the library it should be picked up without you having to do anything.
You can have a look at the text files at the root of GraphicsMagick's archive, there is a README.TXT and INSTALL-unix.txt, they might prove handy.

Where is OpenCV source code (.cpp) on Ubuntu?

I did not download and unzip OpenCV manually. Instead I relied on apt-get to install OpenCV.
The only place I can find are header files in /usr/include/opencv2
No link to OpenCV GitHub link please. It would be a pain later if it turns out that the code I am using on my PC is different from the one in GitHub.
I have looked at this post but I am not sure where OPENCV_HOME is.
If you do a pkg-config:
pkg-config --cflags opencv
You will find the include files, header files like you give above. I think you are referring to cpp files. Since you downloaded with apt-get you dont have cpp files on your disk. You are going to face the github reality in this case. Just get the same version source code from github. But I dont think of any usage of source code besides compiling. If you want to search the source of a function just use the github web interface, it is easier and a lot helpful

Build VLC for iOS, get the "FFTW3 lib not found. Set FFTW3_DIR to find it." error

I want to build vlc for iOS.
My environment is MacOS 10.8.3, Xcode4.6.2 with iOS6.1 SDK.
I cloned the vlc lib form https://github.com/videolan/vlc.git, cd into the /extras/package/ios, and run the build.sh in terminal, everything goes okay except when I start making the chromaprint, I got this error:
FFTW3 lib not found. Set FFTW3_DIR to find it.
CMake Error at CMakeLists.txt:114 (message):
Neither FFmpeg with avfft.h nor FFTW3 found
This is because chromaprint needs the fft library, it will find FFMPEG and also FFTW3.
I want to use the FFMPEG for an fft calculation, so I have download a copy of ffmpeg source code and complied it,the libs and headers are in the directories: /Users/king/ffmpeg/complied/include and /Users/king/ffmpeg/complied/lib,
then I set the FFMPEG_ROOT as /Users/king/ffmpeg/complied in the cmake/modules/FindFFmpeg.cmake, just before the FIND_PATH() function.
something like : set(${FFMPEG_ROOT} /Users/king/ffmpeg/complied)
,I hope the FIND_PATH() can find the releated libs and headers, this doesn't work.
So my question is, How do i set the FFMPEG path or FFTW3_DIR for chromaprint?
Thanks in advance, I am really run out of my head!
I have same problem on VLC Windows cross build.
After I upgrade cmake to 3.22.0, this problem is fixed.
I download latest cmake source code and build.
I also download fftw3 package and extracted under /home/[username]/fftw3.
Set FFTW3_DIR to ~/fftw3 by
export FFTW3_DIR=/home/[username]/fftw3

OpenCV compliation on linux: how to feed to it specific zlib lib?

I want to compile OpenCV with same zlib as I use for compilation of Boost Iostreams (not system default one). I want to compile OpenCV as static lib, having zlib compiled as static lib. Currently I use something like :
../$CMAKE_PATH -DCMAKE_INSTALL_PREFIX=./$OPENCV_INSTALL_SUBDIR -DBUILD_WITH_STATIC_CRT=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_PYTHON_SUPPORT=OFF -DOPENCV_EXTRA_C_FLAGS=-fPIC -DOPENCV_BUILD_3RDPARTY_LIBS=TRUE
make
make install
echo Done!
I wonder: having some $ZLIB_HEADERS and $ZLIB_LIB_FILES_FOLDER path strings how to feed them into cmake to get OpenCV compiled with built by me zlib?
Please try cmake-gui or ccmake. Make sure to toggle advanced mode On (press t in ccmake).
You will find ZLIB_LIBRARY and ZLIB_INCLUDE_DIR.

CMake can't find FFMPEG in custom install path

I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.
I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so
cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local
but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.
Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...
I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.
Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.
So that CMake could find these files, I had to add the following environment variable:
export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig
After which point, OpenCV built against FFMPEG as expected.

Resources