Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: 'libpq-fe.h' file not found #59

Open
aj07mm opened this issue May 25, 2015 · 12 comments
Open

fatal error: 'libpq-fe.h' file not found #59

aj07mm opened this issue May 25, 2015 · 12 comments

Comments

@aj07mm
Copy link

aj07mm commented May 25, 2015

Anyone had this problem on mac osx at

$ make

inside the build folder?

@woodbri
Copy link

woodbri commented May 25, 2015

you need to make sure you have install the postgresql server devel package for you system

@aj07mm
Copy link
Author

aj07mm commented May 25, 2015

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

@aj07mm
Copy link
Author

aj07mm commented May 25, 2015

Nevermind, i ended up using https://github.com/zzolo/osm2pgrouting-mac
a fork for mac. Thks for the feedback.

@aj07mm aj07mm closed this as completed May 25, 2015
@dkastl
Copy link
Member

dkastl commented May 26, 2015

Probably this small change will solve the problem, but we need to see, if this affects other operating systems: zzolo@dc7fdce

@aj07mm
Copy link
Author

aj07mm commented May 27, 2015

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

@sanak
Copy link
Member

sanak commented May 27, 2015

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.

@cvvergara
Copy link
Member

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)

@Yetzederixx
Copy link

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

@dkastl
Copy link
Member

dkastl commented Jun 5, 2015

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.

@dkastl dkastl modified the milestone: osm2pgrouting 2.1.0 Jun 5, 2015
@aj07mm
Copy link
Author

aj07mm commented Jun 5, 2015

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

@woodbri
Copy link

woodbri commented Jun 5, 2015

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,

@aj07mm
Copy link
Author

aj07mm commented Jun 5, 2015

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants