Discussion:
pkg-config doesn't find stuff when trying to create my own pkgsrc lldpd package
Bartek Krawczyk
2013-04-27 13:45:19 UTC
Permalink
Hi, I want to make a pkgsrc package of lldpd
(http://vincentbernat.github.io/lldpd/index.html) because there seems
to be no suitable LLDP implementation in pkgsrc.

I have a problem with the configure phase. pkg-tool doesn't see
libevent and check from configure script:
configure:20350: $PKG_CONFIG --exists --print-errors "check >= 0.9.4"
Package check was not found in the pkg-config search path.
Perhaps you should add the directory containing `check.pc'
to the PKG_CONFIG_PATH environment variable
No package 'check' found

configure:20410: $PKG_CONFIG --exists --print-errors "libevent >= 2.0.5"
Package libevent was not found in the pkg-config search path.
Perhaps you should add the directory containing `libevent.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libevent' found

in config.log I see these variables are set correctly:

ac_cv_env_PKG_CONFIG_value=/usr/pkgsrc/net/lldpd/work/.tools/bin/pkg-config
ac_cv_env_PKG_CONFIG_LIBDIR_value=/usr/pkgsrc/net/lldpd/work/.buildlink/lib/pkgconfig:/usr/pkgsrc/net/lldpd/work/.buildlink/share/pkgconfig

but these are not:
ac_cv_env_PKG_CONFIG_PATH_set=set
ac_cv_env_PKG_CONFIG_PATH_value=

And thus the pkg-config from tools in work doesn't see check and
libevent. There's also a problem with libreadline:
ld: cannot find -lreadline

Any hints are appreciated, this is my first pkgsrc package.
I've attached my Makefile.

Regards,
--
Bartek Krawczyk
network and system administrator
Terho Uotila
2013-04-27 17:17:49 UTC
Permalink
On Sat, 27 Apr 2013 15:45:19 +0200
Post by Bartek Krawczyk
Any hints are appreciated, this is my first pkgsrc package.
I've attached my Makefile.
My small stab at this, since no one has yet commented:

Your makefile has:
.include "../../mk/bsd.pkg.mk"
.include "../../mk/tools/pkg-config.mk"
.include "../../devel/libevent/buildlink3.mk"
.include "../../devel/readline/buildlink3.mk"

The pkgsrc developer's guide tells to add buildlink "just before the
last line", and comparing to some existing packages, bsd.pkg.mk is
indeed after buildlinks in those. I guess guide would be clearer if it
said "just before line containing mk/bsd.pkg.mk" or something like that.

Also, I don't know if it's significant, but I didn't find any other
packages that include pkg-config.mk like you do.
Bartek Krawczyk
2013-04-28 02:39:51 UTC
Permalink
After correcting buildlink order now configure correctly detects
readline, That's progress. But it still doesn't detect libevent and
check.
When i use pkg-tool from work/.tools/bin I get:
/pkg-config --libs libevent
Package libevent was not found in the pkg-config search path.
Perhaps you should add the directory containing `libevent.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libevent' found

but when I use pkg-config from /usr/pkg/bin:
pkg-config --libs libevent
-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -levent

strange...

Also, what does PKGCONFIG_OVERRIDE variable mean? url2pkg sets these:

PKGCONFIG_OVERRIDE+= libevent/libevent.pc.in
PKGCONFIG_OVERRIDE+= libevent/libevent_openssl.pc.in
PKGCONFIG_OVERRIDE+= libevent/libevent_pthreads.pc.in
PKGCONFIG_OVERRIDE+= src/lib/lldpctl.pc.in

but it doesn't change anything.

So now my Makefile is as attached but I still get:
checking pkg-config is at least version 0.9.0... yes
checking for CHECK... no
checking for LIBEVENT... no
configure: using shipped libevent

PS. Is it better to use buildlink or BUILD_DEPENDS or DEPENDS ?
Regards,
--
Bartek Krawczyk
network and system administrator
Bartek Krawczyk
2013-04-28 11:56:47 UTC
Permalink
make clean and try again? (Guessing that you edited the Makefile and typed
make?)
You should see /usr/pkg/lib/pkgconfig/libevent.pc
Cheers,
Patrick
I always do make clean after doing any changes to the Makefile.

this is from config.log from work/lldpd-0.7.2:

ac_cv_env_PKG_CONFIG_LIBDIR_
set=set
ac_cv_env_PKG_CONFIG_LIBDIR_value=/usr/pkgsrc/net/lldpd/work/.buildlink/lib/pkgconfig:/usr/pkgsrc/net/lldpd/work/.buildlink/share/pkgconfig
ac_cv_env_PKG_CONFIG_PATH_set=set
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=set
ac_cv_env_PKG_CONFIG_value=/usr/pkgsrc/net/lldpd/work/.tools/bin/pkg-config

seems like even though I have added needed buildlinks for libevent and
BUILD_DEPENDS for "check" PKG_CONFIG_PATH is not set. ALso can someone
clarify what does PKGCONFIG_OVERRIDE do (it's set by url2pkg but I'm
not using it atm).


Regards,
--
Bartek Krawczyk
network and system administrator
make clean and try again? (Guessing that you edited the Makefile and typed
make?)
You should see /usr/pkg/lib/pkgconfig/libevent.pc
Cheers,
Patrick
I always do make clean after doing any changes to the Makefile.
ac_cv_env_PKG_CONFIG_LIBDIR_set=set
ac_cv_env_PKG_CONFIG_LIBDIR_value=/usr/pkgsrc/net/lldpd/work/.buildlink/lib/pkgconfig:/usr/pkgsrc/net/lldpd/work/.buildlink/share/pkgconfig
ac_cv_env_PKG_CONFIG_PATH_set=set
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=set
ac_cv_env_PKG_CONFIG_value=/usr/pkgsrc/net/lldpd/work/.tools/bin/pkg-config
seems like even though I have added needed buildlinks for libevent and
BUILD_DEPENDS for "check" PKG_CONFIG_PATH is not set. ALso can someone
clarify what does PKGCONFIG_OVERRIDE do (it's set by url2pkg but I'm
not using it atm).
Regards,
--
Bartek Krawczyk
network and system administrator
--
Bartek Krawczyk
network and system administrator
Greg Troxel
2013-04-28 12:10:04 UTC
Permalink
You should be using libevent's buildlink3.mk, but it looks like you did.
It's possible that the pkgconfig file isn't getting included. Look in
your work directory at the buildlink3 shadow tree. You will also find a
bunch of log files about which files from which package were included.
Basically, I mean to look at *everything* under work/ (including files
starting with .) and try to understand them, at least for a minute
each. Also, set PKG_DEBUG_LEVEL (to 1, 2, or maybe even 3) and save the
log and look over it.

Also, you may want to put your package in wip; I find it easier to look
at things there than via email.
Bartek Krawczyk
2013-04-29 07:34:54 UTC
Permalink
Post by Greg Troxel
You should be using libevent's buildlink3.mk, but it looks like you did.
It's possible that the pkgconfig file isn't getting included. Look in
your work directory at the buildlink3 shadow tree. You will also find a
bunch of log files about which files from which package were included.
Basically, I mean to look at *everything* under work/ (including files
starting with .) and try to understand them, at least for a minute
each. Also, set PKG_DEBUG_LEVEL (to 1, 2, or maybe even 3) and save the
log and look over it.
Also, you may want to put your package in wip; I find it easier to look
at things there than via email.
I contacted Thomas Klausner and I am waiting for commit right to
pkgsrc-wip so I can put my package in there.
Thanks for your suggestions.

Regards,
--
Bartek Krawczyk
network and system administrator

Loading...