[pgrouting-users] Error compiling pgRouting 2.0 on Ubuntu 10.04

Stephen Woodbridge woodbri at swoodbridge.com
Thu Dec 5 06:34:53 PST 2013

On 12/5/2013 4:21 AM, Luís de Sousa wrote:
> Thanks.
> Stephen Woodbridge wrote
>> Does this help you?
>> http://comments.gmane.org/gmane.comp.db.postgresql.general/146579
> Not really. There is too much stuff depending on that Postgres instance to
> allow for hand made changes, even if to header files.
> The question perhaps should be: is pgRounting supposed to compile against
> Postgres 8.4? If yes, with exactly which software versions (gcc, cmake, bgl,
> cgal)?

Hi Luís,

I think the "official" position is that we do not support pg8.4. I 
understand your problem because my main server had 100+ databases and 
was pg8.3 and I had to setup a new server just for development of 
pgRouting 2.0. I'm now going through the painful process of migrating 
the old databases to the new server one at a time.

Regarding your problem, the change recommended in the article is not to 
the postgresql headers, but to the pgRouting source code. So for each 
pgRouting C++ file that includes a postgresql header file (and there 
should only be 1-3 files) that are throwing these errors, edit the 
pgRouting file and modify the includes to something similar to:

extern "C" {
	#include <postgres.h>
	#include <fmgr.h>
	#define using _using
	#define typeid _typeid
	#define typename _typename
	#include <funcapi.h>
	#undef using
	#undef typeid
	#undef typename


and try recompiling it. Do one file at a time to make sure that you are 
actually solving the problem. If you can get them all to compile, then 
you can run tools/test-runner.pl which runs the automated test and 
should give you some idea if the build is working ok, or where there 
might be some problems. It might have heartburn on 8.4 because we have 
not been running it there but it may still be helpful.

I don't have a postgresql 8.4 anywhere and my 8.3 box has been upgraded, 
so I can not test this myself.

If you fork pgRouting and do you work in a clone and you can get this to 
work, you can generate a pull request. Or we can just add to the support 
page that you have fixes for pg8.4 and point to your fork.

For example, here is a diff for the KSPGraph.cpp issue, see if that works:

diff --git a/src/ksp/src/KSPGraph.cpp b/src/ksp/src/KSPGraph.cpp
index f5b9858..44264b7 100644
--- a/src/ksp/src/KSPGraph.cpp
+++ b/src/ksp/src/KSPGraph.cpp
@@ -13,10 +13,16 @@
  #include "YenTopKShortestPathsAlg.h"
  extern "C" {
  #include "postgres.h"
+#include "fmgr.h"
  #include "executor/spi.h"
-#include "funcapi.h"
  #include "catalog/pg_type.h"
-#include "fmgr.h"
+#define using _using
+#define typeid _typeid
+#define typename _typename
+#include "funcapi.h"
+#undef using
+#undef typeid
+#undef typename
  #include "ksp.h"
         extern void DBG(const char *format, ...);


More information about the Pgrouting-users mailing list