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

Ruby - bundle install failing for gems requiring native extensions #39

Closed
sushmasatish opened this issue Aug 5, 2016 · 4 comments
Closed

Comments

@sushmasatish
Copy link

Ruby - 2.3.1
Bundler - 1.12.5
bundle install fails for gems like pg, bcrypt.

Failed for gems -

  • pg - 0.18.4
  • crypt - 3.1.11
@mhart
Copy link
Member

mhart commented Aug 5, 2016

Do they have native components that need building?

You need to install gcc for anything that requires native builds: https://github.com/lambci/lambci#native-gcc-compilation

So try:

{
  "cmd": ". ~/init/ruby && . ~/init/gcc && bundle install"
}

@sushmasatish
Copy link
Author

Hi @mhart - Thank you for the reply, with gcc, now bcrypt is getting installed but for PG, we would need postgres libs to be installed as well I think.

I am getting the following error:

Installing pg 0.18.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/lambci/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.18.4/ext
/tmp/lambci/home/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160805-204-1ddlwyp.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/tmp/lambci/home/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /tmp/lambci/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.18.4/mkmf.log

extconf failed, exit code 1

@mhart
Copy link
Member

mhart commented Aug 5, 2016

Right – as you say, you'll need to find a way of getting the postgres libs onto Lambda as they're not natively installed.

It should be possible, but I don't know enough about installing postgres dev libs/headers into a custom location. At a guess, put any include files (*.h) in $CPATH, any linker files in $LIBRARY_PATH and any dynamic libraries (*.so) can go in either /tmp/lib64 or ~/usr/lib64 as both are added to $LD_LIBRARY_PATH

@mhart
Copy link
Member

mhart commented Aug 11, 2016

Going to close this – native extensions can be built, just require some tweaking

@mhart mhart closed this as completed Aug 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants