Can't find the 'libpq-fe.h header when trying to install pg gem

前端 未结 30 2072
深忆病人
深忆病人 2020-11-22 07:47

I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg gem. It gives me the following error:



        
30条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 08:14

    A more general answer for any Debian-based distribution (which includes Ubuntu) is the following. First, install the apt-file package running as root:

    apt-get install apt-file
    

    This allows you to search for packages containing a file. Then, update its database using

    apt-file update
    

    (this can be run as normal user). Then, look for the missing header using:

    apt-file search libpq-fe.h
    

    On my machine, this gives:

    libpq-dev: /usr/include/postgresql/libpq-fe.h
    postgres-xc-server-dev: /usr/include/postgres-xc/server/gtm/libpq-fe.h
    

    There you go !

提交回复
热议问题