Gem Install PG on Raspbian through RVM

77 views
Skip to first unread message

BeeRich33

unread,
Mar 20, 2017, 7:22:18 AM3/20/17
to ruby-pg
I'm getting a gcc error when trying to install the PG gem on Raspberry Pi 2 (on Raspbian)


find_executable: checking for pg_config... -------------------- yes

--------------------

find_header: checking for libpq-fe.h... -------------------- no

"gcc -o conftest -I/home/rich/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/armv7l-linux-eabihf -I/home/rich/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/hom$
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -E -I/home/rich/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/armv7l-linux-eabihf -I/home/rich/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/home/rich/.r$
conftest.c:3:22: fatal error: libpq-fe.h: No such file or directory
#include <libpq-fe.h>
^
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */

--------------------

As requested on the website, they told me to post here before claiming this to be a problem.  Anybody know how I can do this on Raspbian Debian Jessie Lite?

Cheers

Lars Kanis

unread,
Mar 20, 2017, 9:38:44 AM3/20/17
to rub...@googlegroups.com
You must install postgresql client libraries first. This package is usually called "libpq-dev" or "postgresql-client".

--
Regards, Lars

BeeRich33

unread,
Mar 20, 2017, 9:58:50 AM3/20/17
to ruby-pg, la...@greiz-reinsdorf.de
Would these not be dependencies on the apt-get install?

BeeRich33

unread,
Mar 20, 2017, 9:59:26 AM3/20/17
to ruby-pg, la...@greiz-reinsdorf.de
Or...the gem install?

Robert Klemme

unread,
Mar 20, 2017, 12:29:24 PM3/20/17
to rub...@googlegroups.com
On Mon, Mar 20, 2017 at 2:59 PM, BeeRich33 <bee...@gmail.com> wrote:
> Or...the gem install?

Definitively not for the Gem install as this package system is not
tied to platform package managers like apt, dpkg, yum, rpm. This would
be a herculean task: technical integration with the different package
mangers is already some work, but it will be even worse to keep track
of package names and versions across a number of distributions.
Dependencies would have to be properly declared considering different
numbering schemes on different distributions and everything would need
testing as well...

Cheers

robert

--
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

Michael Granger

unread,
Mar 20, 2017, 12:50:21 PM3/20/17
to ruby-pg, la...@greiz-reinsdorf.de
On Monday, March 20, 2017 at 6:59:26 AM UTC-7, BeeRich33 wrote:
Or...the gem install?

On Monday, March 20, 2017 at 9:58:50 AM UTC-4, BeeRich33 wrote:
Would these not be dependencies on the apt-get install?


It would be an APT dependency if you were installing via an APT package for the gem. There's no mechanism (that I know of anyway) that a Rubygem can use to express a dependency in another packaging system. 

BeeRich

unread,
Mar 20, 2017, 7:00:13 PM3/20/17
to rub...@googlegroups.com
No, I wasn’t expecting it to go that far. But a warning in the installer to indicate missing packages that were part of another system.

In any case, that indeed was the case and that too was convoluted with unclear library choices, but I took a shot at it and it went through.

Thanks for the reply.


> On Mar 20, 2017, at 12:50 PM, Michael Granger <ruby...@gmail.com> wrote:
>
> It would be an APT dependency if you were installing via an APT package for the gem. There's no mechanism (that I know of anyway) that a Rubygem can use to express a dependency in another packaging system.



Cheers
bee...@gmail.com



Michael Granger

unread,
Mar 20, 2017, 7:51:11 PM3/20/17
to ruby-pg
On Monday, March 20, 2017 at 4:00:13 PM UTC-7, BeeRich33 wrote:
No, I wasn’t expecting it to go that far.  But a warning in the installer to indicate missing packages that were part of another system.  

How would the gem know what packages (if any) were missing from your system? If I'm installing on FreeBSD, the gem telling me that I'm missing an Ubuntu package isn't going to be helpful.  Ruby runs on hundreds of systems, so a gem can't practically provide useful advice for all of them, or even the most common of them.
 
In any case, that indeed was the case and that too was convoluted with unclear library choices, but I took a shot at it and it went through.  

Glad to hear it. 

BeeRich

unread,
Mar 20, 2017, 8:16:40 PM3/20/17
to rub...@googlegroups.com

> On Mar 20, 2017, at 7:51 PM, Michael Granger <ruby...@gmail.com> wrote:
>
>
> How would the gem know what packages (if any) were missing from your system? If I'm installing on FreeBSD, the gem telling me that I'm missing an Ubuntu package isn't going to be helpful. Ruby runs on hundreds of systems, so a gem can't practically provide useful advice for all of them, or even the most common of them.

Not to go that far. Just to indicate that things were missing and that there are dependencies on which this gem would rely. If I knew there were missing prerequisites, then I could investigate further. If anything, this would come down to the PG folks to provide some kind of reference on prerequisites for various applications. Otherwise some people are just left in the dark.

> In any case, that indeed was the case and that too was convoluted with unclear library choices, but I took a shot at it and it went through.
>
> Glad to hear it.



Cheers
bee...@gmail.com



mic...@cozy.co

unread,
Mar 21, 2017, 2:34:28 PM3/21/17
to ruby-pg
On Monday, March 20, 2017 at 5:16:40 PM UTC-7, BeeRich33 wrote:

Not to go that far.  Just to indicate that things were missing and that there are dependencies on which this gem would rely.  If I knew there were missing prerequisites, then I could investigate further.  If anything, this would come down to the PG folks to provide some kind of reference on prerequisites for various applications.  Otherwise some people are just left in the dark.  

 When it fails to install for this reason, you should see something like:

Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

If you don't see that, then maybe we can provide some better output. 

BeeRich33

unread,
Mar 21, 2017, 3:31:21 PM3/21/17
to ruby-pg
Hi there.  Ya I wasn't sure what to do at that point.  No insight as to where to go.  

Cody Cutrer

unread,
Mar 21, 2017, 5:14:43 PM3/21/17
to rub...@googlegroups.com
Top result for "libpq-fe.h" is http://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem, which seems to lay it out pretty black and white.

--
You received this message because you are subscribed to the Google Groups "ruby-pg" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-pg+unsubscribe@googlegroups.com.
To post to this group, send email to rub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-pg/73ebd336-a2ca-41c7-8805-b4b5229d90f4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

BeeRich33

unread,
Mar 21, 2017, 9:11:46 PM3/21/17
to ruby-pg
Which is why I came in here, and got the answer.  Lars put me in the right direction, and it worked.  It's above your post, in black and white.  
Reply all
Reply to author
Forward
0 new messages