[Buildroot] [PATCH v1] motion: fix static linking of mysql with enabled libz library

Peter Seiderer ps.report at gmx.net
Tue Oct 25 20:38:52 UTC 2016


Hello Thomas,

On Tue, 25 Oct 2016 22:03:56 +0200, Thomas Petazzoni <thomas.petazzoni at free-electrons.com> wrote:

> Hello,
> 
> On Tue, 25 Oct 2016 21:37:20 +0200, Peter Seiderer wrote:
> > Fixes ([1]):
> > 
> >   checking for mysql_init in -lmysqlclient... no
> >   configure: error: MySQL support can't build without MySQL libraries
> > 
> > [1] http://autobuild.buildroot.net/results/6cf/6cf38698a2a9a041ff375c01ae8898eace17cfb2
> > 
> > Signed-off-by: Peter Seiderer <ps.report at gmx.net>
> 
> Can I say how much I hate when packages don't use pkg-config ? :-)
> 
> 
> > +diff --git a/configure.ac b/configure.ac
> > +index 5782fd6..aa5d9dd 100644
> > +--- a/configure.ac
> > ++++ b/configure.ac
> > +@@ -618,8 +618,8 @@ else
> > + 		#LDFLAGS="-L$MYSQL_LIBDIR"
> > + 		saved_CFLAGS=$CFLAGS
> > + 		saved_LIBS=$LIBS
> > +-		CFLAGS="-I$MYSQL_INCDIR"
> > +-		LIBS="-L$MYSQL_LIBDIR"
> > ++		CFLAGS="-I$MYSQL_INCDIR $CFLAGS"
> > ++		LIBS="-L$MYSQL_LIBDIR $LIBS"
> > + 		AC_CHECK_LIB(mysqlclient,mysql_init,[
> > + 					TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz"
> 
> Isn't it already linking with -lz here ?
> 
> Why is an additional -lz needed ?

No, the third argument of AC_CHECK_LIB is 'action-if-found', an additional library should be given as
fifth argument (see[2]:

  AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries])

This -lz is only evaluated after the check (succeeds)...

Regards,
Peter

[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Libraries.html

> 
> Thanks,
> 
> Thomas




More information about the buildroot mailing list