Bug 252249 - Need pkgconfig file for -devel package
Need pkgconfig file for -devel package
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Server - Plugins (Show other bugs)
1.1.0beta
All Linux
high Severity low
: ---
: ---
Assigned To: Nathan Kinder
Chandrasekar Kannan
:
: 659776 (view as bug list)
Depends On:
Blocks: 639035 389_1.2.8
  Show dependency treegraph
 
Reported: 2007-08-14 17:41 EDT by Rich Megginson
Modified: 2015-01-04 18:28 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-16 12:24:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch (16.25 KB, patch)
2011-01-21 14:13 EST, Nathan Kinder
nhosoi: review+
Details | Diff
Revised Patch (19.08 KB, patch)
2011-01-24 13:19 EST, Nathan Kinder
nhosoi: review+
Details | Diff
Revised Patch (19.06 KB, patch)
2011-01-24 14:12 EST, Nathan Kinder
nkinder: review?
rmeggins: review+
Details | Diff

  None (edit)
Description Rich Megginson 2007-08-14 17:41:48 EDT
One problem is that openldap will install /usr/include/slapi-plugin.h which
plugin writers will find and be confused by.  We need to provide the standard
include/lib directives for plugins to use.
Comment 5 Rich Megginson 2009-04-09 13:05:30 EDT
We should also add the sample code to the -devel package
Comment 7 Rich Megginson 2011-01-04 12:20:36 EST
*** Bug 659776 has been marked as a duplicate of this bug. ***
Comment 8 Nathan Kinder 2011-01-21 14:13:11 EST
Created attachment 474667 [details]
Patch
Comment 9 Rich Megginson 2011-01-21 15:09:12 EST
ipa needs the ability to determine if slapi uses mozldap or openldap and, if so, what compiler switches to add (e.g. -DUSE_OPENLDAP=1)
Comment 10 Nathan Kinder 2011-01-21 16:57:40 EST
(In reply to comment #9)
> ipa needs the ability to determine if slapi uses mozldap or openldap and, if
> so, what compiler switches to add (e.g. -DUSE_OPENLDAP=1)

Would it be OK to just add "-DUSE_OPENLDAP=1" to cflags if the openldap client libraries are used?
Comment 11 Rich Megginson 2011-01-21 17:09:23 EST
(In reply to comment #10)
> (In reply to comment #9)
> > ipa needs the ability to determine if slapi uses mozldap or openldap and, if
> > so, what compiler switches to add (e.g. -DUSE_OPENLDAP=1)
> 
> Would it be OK to just add "-DUSE_OPENLDAP=1" to cflags if the openldap client
> libraries are used?

I think so - Simo?
Comment 12 Simo Sorce 2011-01-21 17:21:50 EST
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > ipa needs the ability to determine if slapi uses mozldap or openldap and, if
> > > so, what compiler switches to add (e.g. -DUSE_OPENLDAP=1)
> > 
> > Would it be OK to just add "-DUSE_OPENLDAP=1" to cflags if the openldap client
> > libraries are used?
> 
> I think so - Simo?

It would probably be better to return the right include path in cflags and the right libraries in lflags, this way plugin writers do not even need to do their own checks for these libs. They will just pick the pkgflags values.
Comment 13 Nathan Kinder 2011-01-21 17:46:41 EST
One problem with simply returning the compiler include flags and linker flags is that the mozldap and openldap APIs are not 100% compatible.  I think it is better to expose a custom variable via our pkgconfig file to define which ldap library we are using.  This way a plug-in that needs to know which ldap client library was used by the server can get that information and use whatever define they want internally.  I'm thinking something like this:

    # pkg-config --variable=ldaplib dirsrv
    openldap

    OR

    # pkg-config --variable=ldaplib dirsrv
    mozldap
Comment 14 Rich Megginson 2011-01-21 17:54:05 EST
If you need to know which sdk to use outside of C code, you would need something like that.  But I don't think it is needed.  As long as plugin writers know that they can use

#if defined(USE_OPENLDAP)
... use openldap specific api ...
#else
... use mozldap specific api ...
#endif

and as long as pkg-config --cflags dirsrv returns "... -DUSE_OPENLDAP=1 ..." I think that will suffice.
Comment 15 Nathan Kinder 2011-01-24 13:19:32 EST
Created attachment 475007 [details]
Revised Patch

This patch is a revised version of the previous patch.  This adds "-DUSE_OPENLDAP" to cflags in addition to adding a variable named "ldaplib" to the pkg-config file that will be set to either "mozldap" or "openldap" depending on which library is used by dirsrv.
Comment 16 Rich Megginson 2011-01-24 13:48:01 EST
Comment on attachment 475007 [details]
Revised Patch

This line is incorrect:
+Cflags: @ldaplib_defs@ -I@serverincdir@/slapi-plugin.h

Should just be the path, not the path and filename.
Comment 17 Nathan Kinder 2011-01-24 14:11:24 EST
(In reply to comment #16)
> Comment on attachment 475007 [details]
> Revised Patch
> 
> This line is incorrect:
> +Cflags: @ldaplib_defs@ -I@serverincdir@/slapi-plugin.h
> 
> Should just be the path, not the path and filename.

Good catch.  New patch coming.
Comment 18 Nathan Kinder 2011-01-24 14:12:24 EST
Created attachment 475025 [details]
Revised Patch

This fixes the include flag to not contain the header filename.  Thanks to Rich for catching this issue!
Comment 19 Nathan Kinder 2011-01-24 15:52:00 EST
Pushed patch to master.  Thanks to Rich for his review!

Counting objects: 12, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 2.31 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   9f1160c..c9839b3  master -> master
Comment 20 Amita Sharma 2011-05-25 09:16:18 EDT
Hi Rich/Nathan,

Request you to please add the verification steps.

Thanks,
Amita
Comment 21 Nathan Kinder 2011-05-25 11:19:01 EDT
(In reply to comment #20)
> Hi Rich/Nathan,
> 
> Request you to please add the verification steps.
> 
> Thanks,
> Amita

Install the 389-ds-base-devel pacakge, then attempt to run the following command:

  pkg-config --libs dirsrv

If this returns something similar to the following, you can consider it verified:

  -L/usr/lib64/dirsrv -lslapd
Comment 22 Amita Sharma 2011-05-27 04:57:44 EDT
Installed:
  389-ds-base-devel.x86_64 0:1.2.8.2-1.el6                                                                                                                   

Dependency Installed:
  389-ds-base-libs.x86_64 0:1.2.8.2-1.el6          cyrus-sasl-devel.x86_64 0:2.1.23-8.el6           nspr-devel.x86_64 0:4.8.7-1.el6                        
  nss-devel.x86_64 0:3.12.9-9.el6                  nss-softokn-devel.x86_64 0:3.12.9-3.el6          nss-softokn-freebl-devel.x86_64 0:3.12.9-3.el6         
  nss-util-devel.x86_64 0:3.12.9-1.el6             openldap-devel.x86_64 0:2.4.23-15.el6            pkgconfig.x86_64 1:0.23-9.1.el6                        
  svrcore.x86_64 0:4.0.4-5.1.el6                   svrcore-devel.x86_64 0:4.0.4-5.1.el6            

Complete!
[root@rhel6 yum.repos.d]# pkg-config --libs dirsrv
-L/usr/lib64/dirsrv -lslapd  
[root@rhel6 yum.repos.d]# 
[root@rhel6 yum.repos.d]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.1 (Santiago)
Comment 23 Rich Megginson 2014-06-16 09:38:34 EDT
should be marked CLOSED

Note You need to log in before you can comment on or make changes to this bug.