heroku / heroku/heroku-buildpack-ruby

Cannot build `sqlite3` gem with apt buildpack

Open
#834 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
785
Forks
1.8k
Avg merge
1d 9h
Merged PRs (30d)
8

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the sqlite3-1.3.13 installation with Ruby 2.4, the apt buildpack, and libsqlite3-dev, then inspect the native extension build and the linker error shown in the report. Done means the sqlite3 gem builds successfully against the apt-provided SQLite library without the relocation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.