2

I'm trying to install osm2pgrouting. I have installed all the required packages and I also have changed the #include "libpq-fe.h" to #include postgresql/libpq-fe.h" in the src/Export2DB.h. However when I'm trying to do "make", I get this error:

Linking CXX executable osm2pgrouting
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::~Export2DB()':
Export2DB.cpp:(.text+0x2ea): undefined reference to `PQfinish'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::connect()':
Export2DB.cpp:(.text+0x38c): undefined reference to `PQconnectdb'
Export2DB.cpp:(.text+0x3a2): undefined reference to `PQstatus'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::createTables()':
Export2DB.cpp:(.text+0x46f): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x47f): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x49b): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x4d1): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x5f2): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x602): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x618): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x636): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x66c): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x6fd): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x70d): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x729): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x75f): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x7e7): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x7f7): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x813): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x849): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x8cb): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x8db): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x8f7): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x92d): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x9af): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x9bf): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x9db): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0xa11): undefined reference to `PQclear'
Export2DB.cpp:(.text+0xa93): undefined reference to `PQexec'
Export2DB.cpp:(.text+0xaa3): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0xabf): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0xaf5): undefined reference to `PQclear'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::dropTables()':
Export2DB.cpp:(.text+0x117a): undefined reference to `PQexec'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::exportNodes(std::map<long long, osm::Node*, std::less<long long>, std::allocator<std::pair<long long const, osm::Node*> > >&)':
Export2DB.cpp:(.text+0x1563): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x1573): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x16c5): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1706): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1718): undefined reference to `PQendcopy'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::exportRelations(std::vector<osm::Relation*, std::allocator<osm::Relation*> >&, osm::Configuration*)':
Export2DB.cpp:(.text+0x187d): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x188d): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x1b19): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1b84): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1b96): undefined reference to `PQendcopy'
Export2DB.cpp:(.text+0x1c10): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x1c20): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x1d30): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1d8f): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x1da1): undefined reference to `PQendcopy'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::exportWays(std::vector<osm::Way*, std::allocator<osm::Way*> >&, osm::Configuration*)':
Export2DB.cpp:(.text+0x1fbf): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x1fcf): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x21f4): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x225f): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x2271): undefined reference to `PQendcopy'
Export2DB.cpp:(.text+0x22fa): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x2a2d): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x2a74): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x2a86): undefined reference to `PQendcopy'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::exportTypesWithClasses(std::map<std::string, osm::Type*, std::less<std::string>, std::allocator<std::pair<std::string const, osm::Type*> > >&)':
Export2DB.cpp:(.text+0x2e40): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x2e50): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x2ef5): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x2f39): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x2f4b): undefined reference to `PQendcopy'
Export2DB.cpp:(.text+0x2fcb): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x2fdb): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x31ad): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x320f): undefined reference to `PQputline'
Export2DB.cpp:(.text+0x3221): undefined reference to `PQendcopy'
CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o: In function `Export2DB::createTopology()':
Export2DB.cpp:(.text+0x33b8): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x33c8): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x33e4): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x341a): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x3494): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x34a4): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x34c0): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x34f6): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x35d3): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x35e3): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x35ff): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x3635): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x3712): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x3722): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x373e): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x3774): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x3848): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x3858): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x3874): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x38aa): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x3966): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x3976): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x3992): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x39c8): undefined reference to `PQclear'
Export2DB.cpp:(.text+0x3a33): undefined reference to `PQexec'
Export2DB.cpp:(.text+0x3a43): undefined reference to `PQresultStatus'
Export2DB.cpp:(.text+0x3a5f): undefined reference to `PQerrorMessage'
Export2DB.cpp:(.text+0x3a95): undefined reference to `PQclear'
collect2: error: ld returned 1 exit status
make[2]: *** [osm2pgrouting] Error 1
make[1]: *** [CMakeFiles/osm2pgrouting.dir/all] Error 2
make: *** [all] Error 2

Any help?

3
  • Did you resolve that problem? I have the same problem
    – user55122
    Commented Jul 13, 2015 at 14:42
  • no, i still haven't figured it out
    – vagvaf
    Commented Jul 15, 2015 at 23:09
  • I am having the same problem I opened an issue in osm2pgrouting github.com/pgRouting/osm2pgrouting/issues/74
    – Vicky
    Commented Jul 17, 2015 at 10:26

1 Answer 1

1

I had this error on a Linux machine that did not have postgresql installed.

The solution was to simply install libpq-dev via the following command:

sudo apt-get install libpq-dev

The /user/include/postgresql/ directory and libpq-fe.h were created just fine, and when I did the make / make install, there were no issues.

Here's the thread I found the solution on: https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem

Not the answer you're looking for? Browse other questions tagged or ask your own question.