heroku / heroku-buildpack-ruby

Heroku's buildpack for Ruby applications.
MIT License
9 stars 3 forks source link

Cannot build `sqlite3` gem with apt buildpack #834

Open schneems opened 5 years ago

schneems commented 5 years ago

While technically the apt buildpack is not supported it works for most common cases. However, I was not able to get the sqlite3 gem to install against the libsqlite3-dev package.

This is the error output:

remote:        checking for sqlite3.h... yes
remote:        checking for pthread_create() in -lpthread... yes
remote:        checking for sqlite3_libversion_number() in -lsqlite3... yes
remote:        checking for rb_proc_arity()... yes
remote:        checking for rb_integer_pack()... yes
remote:        checking for sqlite3_initialize()... yes
remote:        checking for sqlite3_backup_init()... yes
remote:        checking for sqlite3_column_database_name()... yes
remote:        checking for sqlite3_enable_load_extension()... yes
remote:        checking for sqlite3_load_extension()... yes
remote:        checking for sqlite3_open_v2()... yes
remote:        checking for sqlite3_prepare_v2()... yes
remote:        checking for sqlite3_int64 in sqlite3.h... yes
remote:        checking for sqlite3_uint64 in sqlite3.h... yes
remote:        creating Makefile
remote:
remote:        current directory:
remote:        /tmp/build_72dc3e768bb2b036042d74e451f38cb0/vendor/bundle/ruby/2.4.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        make "DESTDIR=" clean
remote:
remote:        current directory:
remote:        /tmp/build_72dc3e768bb2b036042d74e451f38cb0/vendor/bundle/ruby/2.4.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        make "DESTDIR="
remote:        compiling backup.c
remote:        compiling database.c
remote:        compiling exception.c
remote:        compiling sqlite3.c
remote:        compiling statement.c
remote:        linking shared-object sqlite3/sqlite3_native.so
remote:        /usr/bin/ld:
remote:        /tmp/build_72dc3e768bb2b036042d74e451f38cb0/.apt/usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o):
remote:        relocation R_X86_64_PC32 against symbol `sqlite3_version' can not be used when
remote:        making a shared object; recompile with -fPIC
remote:        /usr/bin/ld: final link failed: Bad value
remote:        collect2: error: ld returned 1 exit status
remote:        Makefile:257: recipe for target 'sqlite3_native.so' failed
remote:        make: *** [sqlite3_native.so] Error 1

This came up in an internal ticket: number 657004

gbenedict commented 5 years ago

@schneems Any luck getting this working? I have it working on an existing app that installed it last summer, but it's now failing trying to upgrade a different app . Both are Heroku-16.

My error is slightly different:

remote:        checking for sqlite3.h... yes
remote:        checking for sqlite3_libversion_number() in -lsqlite3... yes
remote:        checking for rb_proc_arity()... yes
remote:        checking for rb_integer_pack()... yes
remote:        checking for sqlite3_initialize()... yes
remote:        checking for sqlite3_backup_init()... yes
remote:        checking for sqlite3_column_database_name()... yes
remote:        checking for sqlite3_enable_load_extension()... yes
remote:        checking for sqlite3_load_extension()... yes
remote:        checking for sqlite3_open_v2()... yes
remote:        checking for sqlite3_prepare_v2()... yes
remote:        checking for sqlite3_int64 in sqlite3.h... yes
remote:        checking for sqlite3_uint64 in sqlite3.h... yes
remote:        creating Makefile
remote:        
remote:        make "DESTDIR=" clean
remote:        
remote:        make "DESTDIR="
remote:        compiling statement.c
remote:        compiling sqlite3.c
remote:        compiling database.c
remote:        compiling backup.c
remote:        compiling exception.c
remote:        linking shared-object sqlite3/sqlite3_native.so
remote:        /usr/bin/ld:
remote:        /tmp/build_96491d9867609e438400188b815890f1/.apt/usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o):
remote:        relocation R_X86_64_PC32 against symbol `sqlite3_stricmp' can not be used when
remote:        making a shared object; recompile with -fPIC
remote:        /usr/bin/ld: final link failed: Bad value
remote:        collect2: error: ld returned 1 exit status
remote:        Makefile:253: recipe for target 'sqlite3_native.so' failed
remote:        make: *** [sqlite3_native.so] Error 1
gbenedict commented 5 years ago

I found a way to get this to build on both Heroku-16 and Heroku-18. You need an extra package in your Aptfile:

libsqlite3-dev
libsqlite3-0
4ndv commented 5 years ago

@gbenedict had same problem on dokku with heroku-buildpack-ruby and heroku-buildpack-apt, worked for me, thanks!

schneems commented 4 years ago

@iamswain25 you downvoted this comment did it not work for you ? https://github.com/heroku/heroku-buildpack-ruby/issues/834#issuecomment-460670464

donnykurnia commented 3 years ago

https://github.com/heroku/heroku-buildpack-ruby/issues/834#issuecomment-460670464 works for me.