← 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!

On Dec 10, grantksupport@xxxxxxxxxxxxx wrote:
> building mariadb 10.0.15 on linux/64
> 
> i have a non-system instance of (lib)pcre, installed in
> /usr/local/test/pcre, that i need to build/link against
... 
> 	cmake ..  \
> 	 ...
> 	 -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 -lpcre" \
> 	 ...
> 
> but id both cases, the resultant binary still links against system pcre libs
> 
> 	ldd sql/mysqld | egrep -i "pcre"
> 		libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f6165a5e000)
> 
> what's the correct method for linking against a specified, non-system
> path'd lib?  specifically, here, libpcre?

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.

Regards,
Sergei



Follow ups

References