heroku-buildpack-ruby icon indicating copy to clipboard operation
heroku-buildpack-ruby copied to clipboard

Cannot build `sqlite3` gem with apt buildpack

Open schneems opened this issue 7 years ago • 5 comments

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

schneems avatar Dec 10 '18 21:12 schneems

@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 avatar Jan 26 '19 03:01 gbenedict

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

gbenedict avatar Feb 05 '19 15:02 gbenedict

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

4ndv avatar Apr 22 '19 12:04 4ndv

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

schneems avatar Dec 04 '19 21:12 schneems

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

donnykurnia avatar Mar 21 '21 10:03 donnykurnia