osm2pgrouting
osm2pgrouting copied to clipboard
fatal error: 'libpq-fe.h' file not found
Anyone had this problem on mac osx at
$ make
inside the build folder?
you need to make sure you have install the postgresql server devel package for you system
yeah, definitely the problem. I installed the postgres 9.4 and it went further, now what happens is:
Linking CXX executable osm2pgrouting
Undefined symbols for architecture x86_64:
"_PQclear", referenced from:
Export2DB::createTables() in Export2DB.cpp.o
Export2DB::exportNodes(std::__1::map<long long, osm::Node*, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, osm::Node*> > >&) in Export2DB.cpp.o
Export2DB::exportRelations(std::__1::vector<osm::Relation*, std::__1::allocator<osm::Relation*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportWays(std::__1::vector<osm::Way*, std::__1::allocator<osm::Way*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportTypesWithClasses(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, osm::Type*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, osm::Type*> > >&) in Export2DB.cpp.o
Export2DB::createTopology() in Export2DB.cpp.o
"_PQconnectdb", referenced from:
Export2DB::connect() in Export2DB.cpp.o
"_PQendcopy", referenced from:
Export2DB::exportNodes(std::__1::map<long long, osm::Node*, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, osm::Node*> > >&) in Export2DB.cpp.o
Export2DB::exportRelations(std::__1::vector<osm::Relation*, std::__1::allocator<osm::Relation*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportWays(std::__1::vector<osm::Way*, std::__1::allocator<osm::Way*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportTypesWithClasses(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, osm::Type*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, osm::Type*> > >&) in Export2DB.cpp.o
"_PQerrorMessage", referenced from:
Export2DB::createTables() in Export2DB.cpp.o
Export2DB::createTopology() in Export2DB.cpp.o
"_PQexec", referenced from:
Export2DB::createTables() in Export2DB.cpp.o
Export2DB::dropTables() in Export2DB.cpp.o
Export2DB::exportNodes(std::__1::map<long long, osm::Node*, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, osm::Node*> > >&) in Export2DB.cpp.o
Export2DB::exportRelations(std::__1::vector<osm::Relation*, std::__1::allocator<osm::Relation*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportWays(std::__1::vector<osm::Way*, std::__1::allocator<osm::Way*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportTypesWithClasses(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, osm::Type*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, osm::Type*> > >&) in Export2DB.cpp.o
Export2DB::createTopology() in Export2DB.cpp.o
...
"_PQfinish", referenced from:
Export2DB::~Export2DB() in Export2DB.cpp.o
"_PQputline", referenced from:
Export2DB::exportNodes(std::__1::map<long long, osm::Node*, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, osm::Node*> > >&) in Export2DB.cpp.o
Export2DB::exportRelations(std::__1::vector<osm::Relation*, std::__1::allocator<osm::Relation*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportWays(std::__1::vector<osm::Way*, std::__1::allocator<osm::Way*> >&, osm::Configuration*) in Export2DB.cpp.o
Export2DB::exportTypesWithClasses(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, osm::Type*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, osm::Type*> > >&) in Export2DB.cpp.o
"_PQresultStatus", referenced from:
Export2DB::createTables() in Export2DB.cpp.o
Export2DB::createTopology() in Export2DB.cpp.o
"_PQstatus", referenced from:
Export2DB::connect() in Export2DB.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [osm2pgrouting] Error 1
make[1]: *** [CMakeFiles/osm2pgrouting.dir/all] Error 2
make: *** [all] Error 2
Nevermind, i ended up using https://github.com/zzolo/osm2pgrouting-mac a fork for mac. Thks for the feedback.
Probably this small change will solve the problem, but we need to see, if this affects other operating systems: https://github.com/zzolo/osm2pgrouting-mac/commit/dc7fdce3c769d265fb334cfebac24c06e89de405
One thing that i don't know is worth the attention here is an error that i had in the load with the mac version:
ERROR: value "2171617416" is out of range for type integer
I confirmed this issue on my macports environment.
The direct cause was that cmake/FindPostgreSQL.cmake
can't find /opt/local/include/postgresql93/libpq-fe.h
.
I tried to replace cmake/FindPostgreSQL.cmake
to latest official cmake module (http://www.cmake.org/cmake/help/v3.2/module/FindPostgreSQL.html?#module:FindPostgreSQL ),
but it still fails with another error.
So, copying from pgrouting cmake/FindPostgreSQL.cmake
, then adjusting it to search client header/library may be better to fix this issue.
Osm data indices are bigint, maybe the code is storing them on int variables?. so the value 2171617416 is an ID and its out of range of integers but fit on int64_t. (aka long)
On Ubuntu 14.04 installing libpq-dev and changing the include in Export2DB.h worked, but now I, and at least one other person on Gis Stack Exchange, get a bunch of linking errors. Apparently the solution is to add a -lpq somewhere, but I can't figure out where. The make output is very long so I dumped it into pastebin: http://pastebin.com/7ukNB3yn
Well, I had no problems to create Ubuntu packages for 14.04, so it shouldn't be a problem to compile at least with Debian based distributions. You can find the package related configuration here: https://github.com/pgRouting/osm2pgrouting-build/tree/master/debian
Debian rules
file just makaes use of CMake helper, so the important information about dependencies is in the control
file:
Build-Depends: debhelper (>= 7), cdbs, cmake, libboost-graph-dev, libpq-dev, libexpat1-dev
So libboost-graph-dev, libpq-dev, libexpat1-dev
should be all you need beside a the compiler and build tools.
I think the problem is due to the postgre version. I have this one installed: postgres (PostgreSQL) 9.3.6 The thing thou is that if i update my version it works for the osm2pgrouting, although the other softwares to run the "geosuite" maybe be compromised by the postgre version.
PS: Im using mac OSX 10.9.5
Try doing locate libpq-fe.h
and then symlink that to the directory where it expects to find it. This is probably the easiest way to temporarily fix the issue on your system. If you don't have a copy installed then you should try to locate what package is missing. On Ubuntu it is packaged in libpq-dev,
aj07mms-MacBook-Air-8:frontend aj07mm$ locate libpq-fe.h
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
this message is displayed even after i run the command "sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist"