"missing function dlopen" error while installing sqlite3 - ruby

106 views
Skip to first unread message

navarose h

unread,
Feb 5, 2019, 6:42:58 PM2/5/19
to sqlite3-ruby
While creating a new rails project, bundle install complained.

Fetching sqlite3 1.4.0
Installing sqlite3 1.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory
:
C
:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sqlite3-1.4.0/ext/sqlite3
C
:/Ruby24-x64/bin/ruby.exe -r ./siteconf20190205-19788-3qr0ge.rb extconf.rb
checking
for sqlite3.h... no
sqlite3
.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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=C:/Ruby24-x64/bin/$(RUBY_BASE_NAME)
       
--with-sqlcipher
       
--without-sqlcipher
       
--with-sqlite3-config
       
--without-sqlite3-config
       
--with-pkg-config
       
--without-pkg-config
       
--with-sqlcipher
       
--without-sqlcipher
       
--with-sqlite3-dir
       
--without-sqlite3-dir
       
--with-sqlite3-include
       
--without-sqlite3-include=${sqlite3-dir}/include
       
--with-sqlite3-lib
       
--without-sqlite3-lib=${sqlite3-dir}/lib

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

C
:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/sqlite3-1.4.0/mkmf.log

extconf failed
, exit code 1

Gem files will remain installed in
C
:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sqlite3-1.4.0 for inspection.
Results logged to
C
:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/sqlite3-1.4.0/gem_make.out

An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0'` succeeds before bundling.

In Gemfile:
  sqlite3

C
:\Users\rose\railsprojects>




So I have decided to build sqlite3 using mingw64.
Once thats done I tried to install the gem using command


gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:\sqlite\ --with-sqlite3-lib=C:\sqlite\.libs\

C
:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190205-18436-ve1008.rb extconf.rb --with-sqlite3-include=C:\sqlite\ --with-sqlite3-lib=C:\sqlite\.libs\
checking
for sqlite3.h... yes
checking
for pthread_create() in -lpthread... no
checking
for main() in -ldl... no
checking
for dlopen()... no
missing
function dlopen
*** 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=C:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME)
       
--with-sqlcipher
       
--without-sqlcipher
       
--with-sqlite3-config
       
--without-sqlite3-config
       
--with-pkg-config
       
--without-pkg-config
       
--with-sqlcipher
       
--without-sqlcipher
       
--with-sqlite3-dir
       
--without-sqlite3-dir
       
--with-sqlite3-include=${sqlite3-dir}/include
       
--with-sqlite3-lib=${sqlite3-dir}/lib
       
--with-pthreadlib
       
--without-pthreadlib
       
--with-dllib
       
--without-dllib

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

  C
:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log

extconf failed
, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
ruby
-on-rails ruby-on-rails-5
shareeditdeleteflag


```

Its complaining about dlopen.
Any clue?

My ruby version is
`ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]`

navarose h

unread,
Feb 5, 2019, 8:50:56 PM2/5/19
to sqlite3-ruby
Highlighted erros from mkmf.log

find_library: checking for pthread_create() in -lpthread... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby25-x64/include/ruby-2.5.0/x64-mingw32 -IC:/Ruby25-x64/include/ruby-2.5.0/ruby/backward -IC:/Ruby25-x64/include/ruby-2.5.0 -I. -IC:/Ruby25-x64/msys64/mingw64/include -IC:/qlite3 -IC:/sqlite3/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=x86-64 -mtune=generic -O2 -pipe  conftest.c  -L. -LC:/Ruby25-x64/lib -LC:/qlite3 -LC:/sqlite3/lib -L. -pipe -s -LC:/Ruby25-x64/msys64/mingw64/lib     -lsqlite3 -lx64-msvcrt-ruby250 -lpthread  -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:16:57: error: 'pthread_create' undeclared (first use in this function); did you mean 'rb_thread_create'?
 int t(void) { void ((*volatile p)()); p = (void ((*)()))pthread_create; return !p; }
                                                         ^~~~~~~~~~~~~~
                                                         rb_thread_create




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

have_library: checking for -ldl... -------------------- no

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby25-x64/include/ruby-2.5.0/x64-mingw32 -IC:/Ruby25-x64/include/ruby-2.5.0/ruby/backward -IC:/Ruby25-x64/include/ruby-2.5.0 -I. -IC:/Ruby25-x64/msys64/mingw64/include -IC:/qlite3 -IC:/sqlite3/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=x86-64 -mtune=generic -O2 -pipe  conftest.c  -L. -LC:/Ruby25-x64/lib -LC:/qlite3 -LC:/sqlite3/lib -L. -pipe -s -LC:/Ruby25-x64/msys64/mingw64/lib    -lpthread  -lsqlite3 -lx64-msvcrt-ruby250 -ldl -lpthread  -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status




have_func: checking for dlopen()... -------------------- no

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby25-x64/include/ruby-2.5.0/x64-mingw32 -IC:/Ruby25-x64/include/ruby-2.5.0/ruby/backward -IC:/Ruby25-x64/include/ruby-2.5.0 -I. -IC:/Ruby25-x64/msys64/mingw64/include -IC:/qlite3 -IC:/sqlite3/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=x86-64 -mtune=generic -O2 -pipe  conftest.c  -L. -LC:/Ruby25-x64/lib -LC:/qlite3 -LC:/sqlite3/lib -L. -pipe -s -LC:/Ruby25-x64/msys64/mingw64/lib    -lpthread  -lsqlite3 -lx64-msvcrt-ruby250 -lpthread  -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:16:57: error: 'dlopen' undeclared (first use in this function); did you mean '_lopen'?
 int t(void) { void ((*volatile p)()); p = (void ((*)()))dlopen; return !p; }
                                                         ^~~~~~
                                                         _lopen
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in

Michael Leitner

unread,
Feb 6, 2019, 11:58:26 AM2/6/19
to sqlite3-ruby
I experienced the same thing today. I downloaded sqlite tools to C:\sqlite and placed it in the SystemPath. I also installed the MinGW tools that the ruby installer offers, i also installed the updates (all three options) but when i try to use bundler to create a new rails project i still get this. Also when i try to install the gem without bundler. :(
Reply all
Reply to author
Forward
0 new messages