PDA

View Full Version : how to use export CXXFLAGS in spec file?


icyboy
10th April 2012, 10:44 AM
i need to mock rebuild a rb_libtorrent RPM for EL5.8 but here comes the problem,rb_libtorrent requires boost version greater than 1.39 so i get boost1.41 installed in /usr/include/boost141 & boost libs in /usr/lib.

the official rb_libtorrent manual wrote:
Step 2: Running configure

In your shell, change directory to the libtorrent directory and run ./configure. This will look for libraries and C++ features that libtorrent is dependent on. If something is missing or can't be found it will print an error telling you what failed.

The most likely problem you may encounter is that the configure script won't find the boost libraries. Make sure you have boost installed on your system. The easiest way to install boost is usually to use the preferred package system on your platform. Usually libraries and headers are installed in standard directories where the compiler will find them, but sometimes that may not be the case. For example when installing boost on darwin using darwinports (the package system based on BSD ports) all libraries are installed to /opt/local/lib and headers are installed to /opt/local/include. By default the compiler will not look in these directories. You have to set the enviornment variables LDFLAGS and CXXFLAGS in order to make the compiler find those libs. In this example you'd set them like this:

export LDFLAGS=-L/opt/local/lib
export CXXFLAGS=-I/opt/local/include

so how do i add"export CXXFLAGS=-I/usr/include/boost141" in my rb_libtorrent.spec

due to lack of basic linux knowledge and afer reading some docs i finally get this solved

just add these lines in the spec file
%configure \
CPPFLAGS=-I/usr/include/boost141 \
CXXFLAGS=-I/usr/include/boost141 \
LDFLAGS=-L/usr/lib/boost141 \

or like this
export CXXFLAGS="%{optflags} -I/usr/include/boost141"