← Back to team overview

maria-discuss team mailing list archive

Re: mariadb 10 build/link ignores specified linker path to specified lib (pcre). correct method?

 

Hi, grantksupport!

On Dec 13, grantksupport@xxxxxxxxxxxxx wrote:
> 
> 
> On Sat, Dec 13, 2014, at 12:45 PM, Sergei Golubchik wrote:
> > Your command is almost correct.  You only need to set
> > CMAKE_EXE_LINKER_FLAGS, because CMAKE_SHARED_LINKER_FLAGS is used for
> > linking shared libraries.
> > 
> > Or you need to set both if you plan to use a shared library that needs
> > pcre (like ha_mroonga.so or libmysqld.so).
> > 
> > And you don't need to specify -lpcre, cmake adds it automatically and as
> > necessary.
> 
> building with
> 
> 	cmake ..  \
> 	...
> 	 -DWITH_PCRE="auto" \
> 	 -DBUILD_SHARED_LIBS=1 \
> 	 -DCMAKE_SKIP_BUILD_RPATH=0 \
> 	 -DCMAKE_BUILD_WITH_INSTALL_RPATH=0 \
> 	 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=1 \
> 	 -DCMAKE_INSTALL_RPATH="/usr/local/pcre/lib64" \
> 	 -DCMAKE_C_FLAGS="-I/usr/local/test/pcre/includes" \
> 	 -DCMAKE_CXX_FLAGS="-I/usr/local/test/pcre/includes" \
> 	 -DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/test/pcre/lib64 -Wl,-rpath,/usr/local/test/pcre/lib64" \
> 	 -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/test/pcre/lib64 -Wl,-rpath,/usr/local/test/pcre/lib64" \
> 	...
> 	make
> 
> still results in
> 
> 	ldd sql/mysqld | egrep -i "pcre"
> 		libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f5153b76000)
> 
> something else missing? need changing?

Perhaps you're specifying all possible options and they affect each
other. I didn't try all that, I only used

cmake .. -DCMAKE_C_FLAGS="-I$HOME/pcre-local/include" \
         -DCMAKE_CXX_FLAGS="-I$HOME/pcre-local/include" \
         -DCMAKE_EXE_LINKER_FLAGS="-L$HOME/pcre-local/lib -Wl,-rpath,$HOME/pcre-local/lib"

and that worked for me.

Regards,
Sergei


References