Peter Eisentraut wrote:
I have reworked your build rules so they look more like the idioms that we already use for other similar cases. This should fix the troubles you describe and others.
There are a couple of problems with your updated patch:

1) utils/probes.h needs to be generated before any file is compiled since it's used in c.h and a lot of files include c.h. That's why in my previous patch, I had a rule to call "$(DTRACE) -h -s $< -o $@" in src/Makefile, and I don't think it will work putting it in src/backend/utils/Makefile. If utils/probes.h doesn't exist, you get compilation errors right of the bat.

...
gmake -C port all
gmake[2]: Entering directory `/export/home/pgs/src/pgsql/src/port'
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -I../../src/port -DFRONTEND -I../../src/include -c -o isinf.o isinf.c -MMD -MP -MF .deps/isinf.Po
In file included from isinf.c:15:
../../src/include/c.h:60:26: utils/probes.h: No such file or directory
gmake[2]: *** [isinf.o] Error 1
gmake[2]: Leaving directory `/export/home/pgs/src/pgsql/src/port'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/export/home/pgs/src/pgsql/src'
gmake: *** [all] Error 2

It there a simple way to link to src/backend/utils/probes.d from a build tree and put the generated probes.h in src/include/utils instead of generate probes.h in src/backend/utils and link to in from src/include/utils?

2) c.h needs to have an ifdef like below. probes_null.h is attached, and this file is static and is used in the case Dtrace is not enabled.

#ifdef ENABLE_DTRACE
#include "utils/probes.h"
#else
#include "utils/probes_null.h"
#endif


Regards,
-Robert
/* ----------
 *      probes_null.h
 *
 *      Definitions of probe macros used when DTrace is not enabled.
 *
 *      Copyright (c) 2006-2008, PostgreSQL Global Development Group
 *
 * ----------
 */

#ifndef _PROBES_NULL_H
#define _PROBES_NULL_H

#define POSTGRESQL_LOCK_ENDWAIT(arg0, arg1)
#define POSTGRESQL_LOCK_ENDWAIT_ENABLED()

#define POSTGRESQL_LOCK_STARTWAIT(arg0, arg1)
#define POSTGRESQL_LOCK_STARTWAIT_ENABLED()

#define POSTGRESQL_LWLOCK_ACQUIRE(arg0, arg1)
#define POSTGRESQL_LWLOCK_ACQUIRE_ENABLED()

#define POSTGRESQL_LWLOCK_CONDACQUIRE(arg0, arg1)
#define POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED()

#define POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(arg0, arg1)
#define POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED()

#define POSTGRESQL_LWLOCK_ENDWAIT(arg0, arg1)
#define POSTGRESQL_LWLOCK_ENDWAIT_ENABLED()

#define POSTGRESQL_LWLOCK_RELEASE(arg0)
#define POSTGRESQL_LWLOCK_RELEASE_ENABLED()

#define POSTGRESQL_LWLOCK_STARTWAIT(arg0, arg1)
#define POSTGRESQL_LWLOCK_STARTWAIT_ENABLED()

#define POSTGRESQL_TRANSACTION_ABORT(arg0)
#define POSTGRESQL_TRANSACTION_ABORT_ENABLED()

#define POSTGRESQL_TRANSACTION_COMMIT(arg0)
#define POSTGRESQL_TRANSACTION_COMMIT_ENABLED()

#define POSTGRESQL_TRANSACTION_START(arg0)
#define POSTGRESQL_TRANSACTION_START_ENABLED()

#endif  /* _PROBES_NULL_H */
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to