Merge lp:~flameeyes/gearmand/gentoo-fixes into lp:gearmand/1.0

Proposed by Diego Elio Pettenò
Status: Work in progress
Proposed branch: lp:~flameeyes/gearmand/gentoo-fixes
Merge into: lp:gearmand/1.0
Diff against target: 96 lines (+32/-21)
3 files modified
libgearman-server/include.am (+2/-0)
libgearman-server/queue_libpq.c (+10/-8)
m4/pandora_have_libpq.m4 (+20/-13)
To merge this branch: bzr merge lp:~flameeyes/gearmand/gentoo-fixes
Reviewer Review Type Date Requested Status
Brian Aker Needs Information
Monty Taylor Pending
Review via email: mp+22991@code.launchpad.net

Description of the change

Fix building of the libpq-based queue manager for gearmand, which has been disabled in Gentoo since start of packaging.

In our system, libpq-fe.h is available in /usr/include, but pg_config_manual is only available in, e.g. /usr/include/postgresql-8.4 (we may have multiple postgresql installs available at the same time), so we have to use pg_config to discover the right place for it.

HTH!
Diego

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote :
Download full text (3.6 KiB)

Monty, is this something you want for Pandora?

On Apr 7, 2010, at 6:16 PM, Diego E. Flameeyes Pettenò wrote:

> Diego E. "Flameeyes" Pettenò has proposed merging lp:~flameeyes/
> gearmand/gentoo-fixes into lp:gearmand.
>
> Requested reviews:
> Gearman-developers (gearman-developers)
>
>
> Fix building of the libpq-based queue manager for gearmand, which
> has been disabled in Gentoo since start of packaging.
>
> In our system, libpq-fe.h is available in /usr/include, but
> pg_config_manual is only available in, e.g. /usr/include/
> postgresql-8.4 (we may have multiple postgresql installs available
> at the same time), so we have to use pg_config to discover the right
> place for it.
>
> HTH!
> Diego
> --
> https://code.launchpad.net/~flameeyes/gearmand/gentoo-fixes/+merge/22991
> Your team Gearman-developers is subscribed to branch lp:gearmand.
> === modified file 'libgearman-server/include.am'
> --- libgearman-server/include.am 2010-04-02 02:04:04 +0000
> +++ libgearman-server/include.am 2010-04-08 01:16:15 +0000
> @@ -88,6 +88,7 @@
>
> libgearman_server_libgearman_server_la_CFLAGS= \
> ${AM_CFLAGS} \
> + $(POSTGRESQL_CFLAGS) \
> -DBUILDING_LIBGEARMAN
>
> libgearman_server_libgearman_server_la_LIBADD= \
> @@ -97,5 +98,6 @@
> $(LTLIBPQ) \
> $(LTLIBSQLITE3) \
> $(LTLIBTOKYOCABINET) \
> + $(POSTGRESQL_LIBS) \
> libgearman/libgearman.la \
> libgearman/libgearmancore.la
>
> === modified file 'libgearman-server/queue_libpq.c'
> --- libgearman-server/queue_libpq.c 2010-04-02 02:04:04 +0000
> +++ libgearman-server/queue_libpq.c 2010-04-08 01:16:15 +0000
> @@ -11,18 +11,20 @@
> * @brief libpq Queue Storage Definitions
> */
>
> +#include <libpq-fe.h>
> +#include <pg_config.h>
> +#include <pg_config_manual.h>
> +
> +#undef PACKAGE_BUGREPORT
> +#undef PACKAGE_NAME
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +#undef PACKAGE_VERSION
> +
> #include "common.h"
>
> #include <libgearman-server/queue_libpq.h>
>
> -#if defined(HAVE_LIBPQ_FE_H)
> -# include <libpq-fe.h>
> -# include <pg_config_manual.h>
> -#else
> -# include <postgresql/libpq-fe.h>
> -# include <postgresql/pg_config_manual.h>
> -#endif
> -
> /**
> * @addtogroup gearman_queue_libpq_static Static libpq Queue Storage
> Definitions
> * @ingroup gearman_queue_libpq
>
> === modified file 'm4/pandora_have_libpq.m4'
> --- m4/pandora_have_libpq.m4 2009-07-29 18:13:26 +0000
> +++ m4/pandora_have_libpq.m4 2010-04-08 01:16:15 +0000
> @@ -17,21 +17,28 @@
> [ac_enable_libpq="yes"])
>
> AS_IF([test "x$ac_enable_libpq" = "xyes"],[
> - AC_CHECK_HEADERS([libpq-fe.h])
> - AC_LIB_HAVE_LINKFLAGS(pq,,[
> - #ifdef HAVE_LIBPQ_FE_H
> - # include <libpq-fe.h>
> - #else
> - # include <postgresql/libpq-fe.h>
> - #endif
> + AS_IF([test -z "$PG_CONFIG"], [
> + AC_PATH_PROG([PG_CONFIG], [pg_config], [])
> + ])
> +
> + AS_IF([test ! -x "$PG_CONFIG"], [
> + AC_MSG_WARN([$PG_CONFIG does not exist or it is not an
> exectuable file])
> + PG_CONFIG="no"
> + ac_cv_libpq="no"
> ], [
> - PGconn *conn;
> - conn = PQconnectd...

Read more...

Revision history for this message
Brian Aker (brianaker) wrote :

I am marking this as Needs Information, since Monty will need to be the person to fix this.

review: Needs Information
Revision history for this message
Monty Taylor (mordred) wrote :

Yeah - so I see what you're doing, but I'm going to need to poke at this some on the other platforms. I _really_ don't like trusting things like pg_config.

Also- why did you add and include of the pg_config.h include? That's going to have values from their run of configure which we do not care about?

Revision history for this message
Diego Elio Pettenò (flameeyes) wrote :

Il giorno lun, 05/07/2010 alle 16.44 +0000, Monty Taylor ha scritto:
>
> Yeah - so I see what you're doing, but I'm going to need to poke at
> this some on the other platforms. I _really_ don't like trusting
> things like pg_config.

Not sure on Ubuntu but Gentoo tries to keep these scripts valid because
they _are_ the only way upstream has to signal them..
>
> Also- why did you add and include of the pg_config.h include? That's
> going to have values from their run of configure which we do not care
> about?

That's how most other projects get the correct build parameters, without
this it fails here ... I sincerely forgot the error message right now.

--
Diego Elio Pettenò — “Flameeyes”
http://blog.flameeyes.eu/

If you found a .asc file in this mail and know not what it is,
it's a GnuPG digital signature: http://www.gnupg.org/

Revision history for this message
Monty Taylor (mordred) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/05/2010 09:55 AM, Diego E. "Flameeyes" Pettenò wrote:
> Il giorno lun, 05/07/2010 alle 16.44 +0000, Monty Taylor ha scritto:
>>
>> Yeah - so I see what you're doing, but I'm going to need to poke at
>> this some on the other platforms. I _really_ don't like trusting
>> things like pg_config.
>
> Not sure on Ubuntu but Gentoo tries to keep these scripts valid because
> they _are_ the only way upstream has to signal them..

Sure - the problem is that using autoconf at all is about making sure
that I can also build on broken platforms like OSX and Solaris... so
trusting that a script or a system config has been properly maintained
is just asking for failure. (This is the reason I hate pkg-config,
too... did they learn nothing from imake?)

It works _great_ when it works, but I _still_ need to test that it's not
lying or broken, which is why I'd prefer to just actually test the files
in the first place.

I'll see if I can merge the approaches though...

>> Also- why did you add and include of the pg_config.h include? That's
>> going to have values from their run of configure which we do not care
>> about?
>
> That's how most other projects get the correct build parameters, without
> this it fails here ... I sincerely forgot the error message right now.

I really need to blog more about this. It's so fundamentally wrong to do
that. Every project that does it is completely breaking everything.
MySQL does it - it was the first thing I fixed in Drizzle.

I guess it's time to go make a patch to postgres. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwyECAACgkQ2Jv7/VK1RgErngCgvcFuXpV9ymns8Ya4fPphgTY7
uLsAn3BRXSCCwiu6Vg+ak2VbhRZxYFZM
=YhS+
-----END PGP SIGNATURE-----

Revision history for this message
Diego Elio Pettenò (flameeyes) wrote :

Il giorno lun, 05/07/2010 alle 17.04 +0000, Monty Taylor ha scritto:
>
> I really need to blog more about this. It's so fundamentally wrong to
> do
> that. Every project that does it is completely breaking everything.
> MySQL does it - it was the first thing I fixed in Drizzle.

You have no idea how much I know it's wrong... sigh.

Revision history for this message
Olaf van der Spek (olafvdspek) wrote :

> (we may have multiple postgresql installs available at the same time), so we have to use pg_config to discover the right place for it.

Can't the pkg system use the build dependencies to ensure the compiler paths include all necessary includes and libs?

Unmerged revisions

352. By Diego Elio Pettenò

Fix PostgreSQL queue manager building on Gentoo and other platforms.

When the includes are installed in non-standard positions, and especially
when libpq-fe.h is available without -I directives, but pg_config_manual.h
isn't, you cannot rely on just finding one to get the other.

What you have to do in this case is use the pg_config script shipped with
PostgreSQL to get the right include directory, and use the simple basename
for the include headers.

Also, on modern (glibc-2.10) systems, using simply pg_config_manual.h
without pg_config.h or without adding further checks in configure, the
build will fail with this error:

In file included from libgearman-server/queue_libpq.c:19:
/usr/include/postgresql-8.4/pg_config_manual.h:128:5: error: "HAVE_DECL_POSIX_FADVISE" is not defined
make[1]: *** [libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo] Error 1

So include the PostgreSQL headers first thing, undefine package-specific
entries, and proceed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libgearman-server/include.am'
--- libgearman-server/include.am 2010-04-02 02:04:04 +0000
+++ libgearman-server/include.am 2010-04-08 01:16:15 +0000
@@ -88,6 +88,7 @@
8888
89libgearman_server_libgearman_server_la_CFLAGS= \89libgearman_server_libgearman_server_la_CFLAGS= \
90 ${AM_CFLAGS} \90 ${AM_CFLAGS} \
91 $(POSTGRESQL_CFLAGS) \
91 -DBUILDING_LIBGEARMAN92 -DBUILDING_LIBGEARMAN
9293
93libgearman_server_libgearman_server_la_LIBADD= \94libgearman_server_libgearman_server_la_LIBADD= \
@@ -97,5 +98,6 @@
97 $(LTLIBPQ) \98 $(LTLIBPQ) \
98 $(LTLIBSQLITE3) \99 $(LTLIBSQLITE3) \
99 $(LTLIBTOKYOCABINET) \100 $(LTLIBTOKYOCABINET) \
101 $(POSTGRESQL_LIBS) \
100 libgearman/libgearman.la \102 libgearman/libgearman.la \
101 libgearman/libgearmancore.la103 libgearman/libgearmancore.la
102104
=== modified file 'libgearman-server/queue_libpq.c'
--- libgearman-server/queue_libpq.c 2010-04-02 02:04:04 +0000
+++ libgearman-server/queue_libpq.c 2010-04-08 01:16:15 +0000
@@ -11,18 +11,20 @@
11 * @brief libpq Queue Storage Definitions11 * @brief libpq Queue Storage Definitions
12 */12 */
1313
14#include <libpq-fe.h>
15#include <pg_config.h>
16#include <pg_config_manual.h>
17
18#undef PACKAGE_BUGREPORT
19#undef PACKAGE_NAME
20#undef PACKAGE_STRING
21#undef PACKAGE_TARNAME
22#undef PACKAGE_VERSION
23
14#include "common.h"24#include "common.h"
1525
16#include <libgearman-server/queue_libpq.h>26#include <libgearman-server/queue_libpq.h>
1727
18#if defined(HAVE_LIBPQ_FE_H)
19# include <libpq-fe.h>
20# include <pg_config_manual.h>
21#else
22# include <postgresql/libpq-fe.h>
23# include <postgresql/pg_config_manual.h>
24#endif
25
26/**28/**
27 * @addtogroup gearman_queue_libpq_static Static libpq Queue Storage Definitions29 * @addtogroup gearman_queue_libpq_static Static libpq Queue Storage Definitions
28 * @ingroup gearman_queue_libpq30 * @ingroup gearman_queue_libpq
2931
=== modified file 'm4/pandora_have_libpq.m4'
--- m4/pandora_have_libpq.m4 2009-07-29 18:13:26 +0000
+++ m4/pandora_have_libpq.m4 2010-04-08 01:16:15 +0000
@@ -17,21 +17,28 @@
17 [ac_enable_libpq="yes"])17 [ac_enable_libpq="yes"])
1818
19 AS_IF([test "x$ac_enable_libpq" = "xyes"],[19 AS_IF([test "x$ac_enable_libpq" = "xyes"],[
20 AC_CHECK_HEADERS([libpq-fe.h])20 AS_IF([test -z "$PG_CONFIG"], [
21 AC_LIB_HAVE_LINKFLAGS(pq,,[21 AC_PATH_PROG([PG_CONFIG], [pg_config], [])
22 #ifdef HAVE_LIBPQ_FE_H22 ])
23 # include <libpq-fe.h>23
24 #else24 AS_IF([test ! -x "$PG_CONFIG"], [
25 # include <postgresql/libpq-fe.h>25 AC_MSG_WARN([$PG_CONFIG does not exist or it is not an exectuable file])
26 #endif26 PG_CONFIG="no"
27 ac_cv_libpq="no"
27 ], [28 ], [
28 PGconn *conn;29 AC_MSG_CHECKING([for PostgreSQL libraries])
29 conn = PQconnectdb(NULL);30
31 POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
32 POSTGRESQL_LIBS="-L`$PG_CONFIG --libdir` -lpq"
33 AC_SUBST([POSTGRESQL_CFLAGS])
34 AC_SUBST([POSTGRESQL_LIBS])
35
36 ac_cv_libpq=yes
37 AC_MSG_RESULT([yes])
30 ])38 ])
31 ],[39 ],
32 ac_cv_libpq="no"40 [ac_cv_libpq=no])
33 ])41
34
35 AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])42 AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])
36])43])
3744

Subscribers

People subscribed via source and target branches