How to specify ./configure's parameters '--includedir' and '--libdir' to cmake - makefile

Question about installing log4cplus.
log4cplus has two way to make & install.
./configure && make && make install
cmake xxx && make && make install
When I use the 1st one, parameters --includedir=PATH and --libdir=PATH can be specified to configure, because I want to install them into different paths.
How can I specify the two equivalent parameters to cmake?
Thanks!

Since package log4cplus uses CMake module GNUInstallDirs, you may use variables CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR for adjust installation paths for libraries and headers correspondingly:
cmake -DCMAKE_INSTALL_LIBDIR=<libdir-path> -DCMAKE_INSTALL_INCLUDEDIR=<includedir-path>
For more info see that question.

Related

How to add multiple directories in ./configure --libdir?

In a Makefile, there is the following:
./configure --prefix=$(ROOTPATH) --libdir=$(MJSONLIBDIR)
How can I include multiple directories in --libdir?
This issue can be closed. I confuse the role of --libdir, it is to install the libraries generated in the $./configure && make process, not the libraries to include for the proper execution of $./configure && make command.

How to tell tell the ./configure file where to take the dependencies from?

I want to install Libav locally in a folder and for that I have to install yasm (I can disable the dependency but I don't want to just for the sake of the argument). The installation of the package is done in the terminal via "./configure" and "make" (when I run "./configure" I receive the message, that yasm is missing). How can I tell to "./configure" to take it's yasm dependencies from the path "./libs" (there is a folder with libraries in the parent folder). Should I modify the makefile (and if yes should I change only the LDflags? to what?) or add the " --extra-ldflags="-L./libs" " to the ./configure command? What would be the use of cflags here?
To have autotools' configure use dependencies from a specific directory, the following may or may not work, as the configure script can be written differently:
--extra-ldflags (there should be --extra-cflags too) is fine, if it's there;
for library dependencies, you can add CFLAGS="-I<path>" CXXFLAGS="<same>" LDFLAGS="-L<path>" to ./configure's environment or to its command line arguments;
cleaner approach: if you have pkg-config configuration generated and installed for your dependencies, you can specify a PKG_CONFIG_PATH instead. In special cases of cross-compilation, one can use PKG_CONFIG_SYSROOT_DIR.
for local host executables, append/prepend to PATH.
Related question: https://unix.stackexchange.com/questions/19663/how-to-change-the-compiler-settings-with-automake

./configure to use specific compiler

My linux environment is based off of a high compute cluster that does not allow users to install to /usr/bin/ or use sudo. I'm trying to use ./configure (made from protocol buffers) to install to my home. When configure searches for the CXX files it is not finding the compilers that are located in the bin because they are named things like 'g++34' instead of 'g++'. I want to point the configure file at this specific compiler, but can't seem to get the command right to do so. Again the directory where the compiler is gets searched, it is just named funny (using an alias hasn't worked either).
How do you use a arguments in a configure file to point at a specific compiler?
Just use:
./configure CC=gcc34 CXX=g++34
etc. If you have a really old version of configure you might have to do it via the environment instead:
CC=gcc34 CXX=g++34 ./configure

Trouble installing OpenCV with Cmake

I am trying to install the openCV library for Python however I am new to CMake and have run into some trouble after having cloned the repository in ~/opencv.
I've made a build directory in it with the mkdir command however once inside it when trying to set CMake options in it.
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local
I get prompted with the following error:
CMake Error: The source directory "/Users/eDen/opencv/build/CMAKE_INSTALL_PREFIX=/usr/local" does not exist.
It seems you aren't making the right directory, some Mac OS X installations doesn't include /usr/local/. You can make the directory using, if it's not already created, with:
sudo mkdir /usr/local/
But you say you want to use OpenCV with Python. I recommend you to obtain an already compiled copy unless you need some advanced features not available in the compiled version, like Qt integration or CUDA programming. But these features are included in the arguments of the cmake command.
Instructions on how to obtain OpenCV from Homebrew repository, this page explains the process. Basically, you install Homebrew, then Python, configure it and install some dependencies.
As Tsyvarev mentioned in the comments, you need to specify the path to source directory (i.e. where the main CMakeLists.txt file exists) at the end of your command. So, supposing you are now in the build directory, the final cmake command would be as follows:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
I have the last argument as .. but still get the error.
In my case, there is a bad whitespace in the above arguments. So the last .. is ignored.

Numba installation and "make check-all"

I have been trying to install numba in a virtual environment. Numba requires llvm and what seems to be a Python wrapper of llvmpy. I successfully installed it using the following steps:
wget http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
tar zxvf llvm-3.2.src.tar.gz
cd llvm-3.2.src
./configure --enable-optimized --prefix=/opt
REQUIRES_RTTI=1 make
make check-all
sudo REQUIRES_RTTI=1 make install
git clone git://github.com/llvmpy/llvmpy.git
cd llvmpy
sudo LLVM_CONFIG_PATH=/opt/bin/llvm-config /path/to/environment/bin/python setup.py install
python -c "import llvm; llvm.test()"
However, I would like to know what is the correct procedure. For example, in the line REQUIRES_RTTI=1 make and sudo REQUIRES_RTTI=1 make install, the variable REQUIRES_RTTI is repeated. Is it necessary?
According to the documentation of numba, it recommends to execute REQUIRES_RTTI=1 make install and llvmpy recommends REQUIRES_RTTI=1 make, so there are slight differences. I don't really know what each step is doing so I would appreciate a general explanation of what is going on and if all these steps are strictly necessary.
Furthermore, what is make check-all? I have seen it is particularly relevant in questions related to llvm but I don't know what is its purpose.
Another suggestion from llvmpy's documentation is to install using a different directory (--prefix) Why is that the recommended approach?
Thanks a lot
The following lines
REQUIRES_RTTI=1 make
sudo REQUIRES_RTTI=1 make install
use the way of setting up environment of the called process without modifying the environment of the calee (like in case of export REQUIRES_RTTI=1); from bash manual:
The environment for any simple command or function may be augmented
temporarily by prefixing it with parameter assignments. These assignment statements affect only the
environment seen by that command.
This setting is recommended because from LLVM docs:
Add REQUIRES_RTTI=1 to your environment
while running make to re-enable it. This will allow users to build
with RTTI enabled and still inherit from LLVM classes.
and according to llvmpy docs, RTTI is required.
So, forgetting this "complication" and standard requirement to use "sudo" for installing, the steps are standard:
### generating makefile:
./configure --enable-optimized --prefix=/opt
### building core libraries (make without target is the same as "make all")
make
### check-all is a makefile target that is used to run regression tests (according to LLVM docs)
make check-all
### installing the libraries to the place where other tools / libraries can find them:
make install

Resources