Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482894 - net-analyzer/ipaudit-1.0_beta2 USE=mysql - ld: cannot find -lmysqlclient
Summary: net-analyzer/ipaudit-1.0_beta2 USE=mysql - ld: cannot find -lmysqlclient
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-08-29 09:05 UTC by Andrew Savchenko
Modified: 2016-05-21 12:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
config.log (config.log,22.92 KB, text/x-log)
2013-08-29 09:05 UTC, Andrew Savchenko
Details
build.log (build.log,3.93 KB, text/x-log)
2013-08-29 09:05 UTC, Andrew Savchenko
Details
emerge --info (emerge.info,8.43 KB, text/plain)
2013-08-29 09:06 UTC, Andrew Savchenko
Details
ipaudit-1.0_beta2.ebuild (ipaudit-1.0_beta2.ebuild,758 bytes, text/plain)
2013-08-29 09:46 UTC, Andrew Savchenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2013-08-29 09:05:21 UTC
Hello,

ipaudit fails to build with mysql support (I use mariadb-5.5.31-r1):

checking for mysql_init in -lmysqlclient... no

  ***************************************************************
    FATAL ERROR: you specified the option "--with-mysql" for
    mysql support, but the mysql *library* was not found.
    You can re-run "./configure" without the option
    "--with-mysql" to create the non-mysql version of ipaudit.
  ***************************************************************

config.log shows that configure tries to locate libmysqlclient in standard library path while it is now located at $(libdir)/mysql:

configure:3832: checking for mysql_init in -lmysqlclient
configure:3862: i686-pc-linux-gnu-gcc -o conftest -march=native -m32 -O2 -funswitch-loops -fpredictive-commoning  -fgcse-after-reload -ftree-loop-im -fweb -frename-registers -fomit-frame-pointer -mfpmath=sse -pipe -frecord-gcc-switches  -march=native -m32 -O2 -funswitch-loops -fpredictive-commoning -Wl,-O1,--as-needed -pipe conftest.c -lmysqlclient  -lpcap -lnsl -lm  >&5
/usr/lib/gcc/i686-pc-linux-gnu/4.7.3/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
Comment 1 Andrew Savchenko gentoo-dev 2013-08-29 09:05:39 UTC
Created attachment 357308 [details]
config.log
Comment 2 Andrew Savchenko gentoo-dev 2013-08-29 09:05:55 UTC
Created attachment 357310 [details]
build.log
Comment 3 Andrew Savchenko gentoo-dev 2013-08-29 09:06:05 UTC
Created attachment 357312 [details]
emerge --info
Comment 4 Andrew Savchenko gentoo-dev 2013-08-29 09:46:46 UTC
Created attachment 357314 [details]
ipaudit-1.0_beta2.ebuild

New EAPI 5 ebuild.
It appends needed LDFLAGS thus both fixing the problem and maintaining support for older mysql setups.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-08-29 13:45:28 UTC
Comment on attachment 357314 [details]
ipaudit-1.0_beta2.ebuild

--- ipaudit-1.0_beta2.ebuild    2011-04-05 17:20:45.000000000 +0200
+++ -   2013-08-29 15:45:19.829501284 +0200
@@ -2,26 +2,27 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipaudit/ipaudit-1.0_beta2.ebuild,v 1.7 2011/04/02 12:53:39 ssuominen Exp $
 
-inherit eutils
+EAPI=5
+
+inherit eutils flag-o-matic multilib
+
 DESCRIPTION="IPAudit monitors network activity on a network by host, protocol and port."
 HOMEPAGE="http://ipaudit.sourceforge.net/"
 MY_P="${PN}-${PV/_beta/BETA}"
 SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
 LICENSE="GPL-2"
 SLOT="0"
+
 KEYWORDS="~amd64 ppc x86"
 IUSE="mysql"
+
 DEPEND="net-libs/libpcap
                mysql? ( virtual/mysql )"
-#RDEPEND=""
-S="${WORKDIR}/${MY_P}"
+RDEPEND="${DEPEND}"
 
-src_compile() {
-       econf `use_with mysql` || die
-       emake || die "emake failed"
-}
+S="${WORKDIR}/${MY_P}"
 
-src_install() {
-       make DESTDIR=${D} install || die
-       dodoc AUTHORS README
+src_configure() {
+       use mysql && append-ldflags "-L/usr/$(get_libdir)/mysql"
+       econf $(use_with mysql)
 }
Comment 6 Brian Evans (RETIRED) gentoo-dev 2014-07-16 17:18:53 UTC
Recent changes to dev-db/{mariadb,mysql} 5.5 may make it easier for libraries to be found.

This bug may be obsolete with mariadb-5.5.38.  Please retest.

Also, please never assume a path and use the output from mysql_config as a source.  In this case, `append-ldflags "$(mysql_config --libs)"` or `append-ldflags "-L$(mysql_config --variable=pkglibdir)"`
Comment 7 Andrew Savchenko gentoo-dev 2016-05-21 12:26:04 UTC
Hi,

with mariadb-10.1.14 build is fine here.