osm2pgrouting (#24) - Compiling error (#293) - Message List

Compiling error

Hi everyone. I'm trying to compile osm2pgrotuing and i'm receiving this error:

g++ -o osm2pgrouting src/osm2pgrouting.cpp *.o -I./ -Isrc -I/usr/include/pgsql -I/usr/include/postgresql -lexpat -ggdb3 -lpq
/usr/bin/ld: can't find -lpq
collect2: ld returned 1 exit status
make: *** [all] Error 1

Could someone help me?. Thank you.

  • Message #1045

    Can you give us a bit more information for example about the OS you use?

  • Message #1047

    Ok, i've finally compiled the sources. I'm using Debian.

    1.- Modifying Makefile instruction

     g++ -o osm2pgrouting src/osm2pgrouting.cpp *.o -I./ -Isrc -I/usr/include/pgsql   -I/usr/include/postgresql -lexpat -ggdb3 -lpq
    

    adding the directory where libpq is installed like this

     g++ -o osm2pgrouting src/osm2pgrouting.cpp *.o -I./ -Isrc -I/usr/include/pgsql   -I/usr/include/postgresql -lexpat -ggdb3 -L/usr/lib/postgresql8/lib -lpq
    

    2.- It compiled correctly, but then when i executed osm2pgrouting i received this error:

     /osm2pgrouting: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
    

    What i did was adding the directory where libpq is installed to the file /etc/ld.so.conf, and after that executed ldconfig

    Now application runs correctly. But i'm having another problem, i'm reciving

    host=127.0.0.1 user=postgres dbname=demo port=5432
    connection failed
    

    where i really have database created. Please,could you help me?. Thank you.

    • Message #1052

      Maybe you're not allowed to connect to 127.0.0.1. You can check your pg_hba.conf file and set parameter "trust" where you need. Or try host=localhost ... that's sometimes allowed.