Unable to install sqlite3 gem - ruby

I have an issue trying to install the sqlite3 gem using Ruby on Rails 3.0.1.
Using Windows 10 21H2 x64. The SQLite engine is installed.
Below is the error message from “C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/mkmf.log”
“x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30-x64/include/ruby-3.0.0/x64-mingw32 -IC:/Ruby30-x64/include/ruby-3.0.0/ruby/backward -IC:/Ruby30-x64/include/ruby-3.0.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30-x64/lib -L. -pipe -s -fstack-protector-strong -m64 -lpthread -lx64-msvcrt-ruby300 -lsqlite3 -lpthread -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " C:/Ruby30-x64/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find -lsqlite3 collect2.exe: error: ld returned 1 exit status checked program was: /* begin / 1: #include “ruby.h” 2: 3: #include <winsock2.h> 4: #include <windows.h> 5: 6: /top/ 7: extern int t(void); 8: int main(int argc, char *argv) 9: { 10: if (argc > 1000000) { 11: int ( volatile tp)(void)=(int ()(void))&t; 12: printf(”%d", (tp)()); 13: } 14: 15: return !!argv[argc]; 16: } 17: extern void sqlite3_libversion_number(); 18: int t(void) { sqlite3_libversion_number(); return 0; } / end *
I have provided the gem install sqlite3 output below:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/digest-3.0.0/lib/digest.rb:6: warning: already initialized constant Digest::REQUIRE_MUTEX
C:/Ruby30-x64/lib/ruby/3.0.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
error: mingw-w64-x86_64-termcap: signature from "David Macek <david.macek.0#gmail.com>" is unknown trust
error: mingw-w64-x86_64-readline: signature from "David Macek <david.macek.0#gmail.com>" is unknown trust
error: failed to commit transaction (invalid or corrupted package)
pacman failed with the following output:
resolving dependencies...
looking for conflicting packages...
Packages (4) mingw-w64-x86_64-readline-8.0.004-2 mingw-w64-x86_64-tcl-8.6.11-3 mingw-w64-x86_64-termcap-1.3.1-6 mingw-w64-x86_64-sqlite3-3.35.4-2
Total Download Size: 0.40 MiB
Total Installed Size: 59.88 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
downloading mingw-w64-x86_64-termcap-1.3.1-6-any.pkg.tar.zst...
downloading mingw-w64-x86_64-readline-8.0.004-2-any.pkg.tar.zst...
checking keyring...
checking package integrity...
:: File /var/cache/pacman/pkg/mingw-w64-x86_64-termcap-1.3.1-6-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
:: File /var/cache/pacman/pkg/mingw-w64-x86_64-readline-8.0.004-2-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
Errors occurred, no packages were upgraded.
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r ./siteconf20220513-19776-vbg7uj.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 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:/Ruby30-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
--with-pthread-dir
--without-pthread-dir
--with-pthread-include
--without-pthread-include=${pthread-dir}/include
--with-pthread-lib
--without-pthread-lib=${pthread-dir}/lib
--with-pthreadlib
--without-pthreadlib
--with-dl-dir
--without-dl-dir
--with-dl-include
--without-dl-include=${dl-dir}/include
--with-dl-lib
--without-dl-lib=${dl-dir}/lib
--with-dllib
--without-dllib
--with-sqlcipher
--without-sqlcipher
--with-sqlite3lib
--without-sqlite3lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2 for inspection.
Results logged to C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/gem_make.out

Related

Error installing gems after transferring all data to a new mac: ERROR: Failed to build gem native extension

After setting up a new mac and transferring data from my old one, some gems won't install and I am getting error messages such as the following when trying to install spidr:
$ sudo gem install spidr
Password:
Fetching: mini_portile2-2.4.0.gem (100%)
Successfully installed mini_portile2-2.4.0
Fetching: nokogiri-1.9.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing spidr:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.9.0/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20181217-24587-ul93i2.rb extconf.rb
checking if the C compiler accepts ... *** 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
--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=/usr/local/Cellar/ruby/2.5.3_1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:412:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/nokogiri-1.9.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.9.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/nokogiri-1.9.0/gem_make.out
I am also attaching the contents of the referenced mkmf.log file below:
"clang -o conftest -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/x86_64-darwin18 -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/backward -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.5.3_1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.5.3 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/ruby.h:29:
/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/defines.h:131:11: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
# include <string.h>
^~~~~~~~~~
<String.h>
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/ruby.h:29:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/defines.h:131:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I have done research for quite some hours now and don't know what to do anymore. I am attaching another similar error when trying to install another gem, fastlane:
$ sudo gem install fastlane
Password:
Building native extensions. This could take a while...
ERROR: Error installing fastlane:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.5.0/gems/unf_ext-0.0.7.5/ext/unf_ext
/usr/local/opt/ruby/bin/ruby -r ./siteconf20181217-24788-1jgurro.rb extconf.rb
checking for -lstdc++... *** 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
--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=/usr/local/Cellar/ruby/2.5.3_1/bin/$(RUBY_BASE_NAME)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:778:in `try_func'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:1005:in `block in have_library'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:948:in `block in checking_for'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:346:in `postpone'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:947:in `checking_for'
from /usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:1000:in `have_library'
from extconf.rb:6:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/unf_ext-0.0.7.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.5.0/gems/unf_ext-0.0.7.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/unf_ext-0.0.7.5/gem_make.out
The corresponding mkmf.log contents:
"clang -o conftest -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/x86_64-darwin18 -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/backward -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.5.3_1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.5.3 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/ruby.h:29:
/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/defines.h:131:11: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
# include <string.h>
^~~~~~~~~~
<String.h>
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/ruby.h:29:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/defines.h:131:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Xcode Developer Tools are installed using xcode-select --install.
Does anyone maybe have a hint what to do?
Thanks very much in advance for any help and best regards
Sebastian
I think I fixed it by deleting file String.h in /usr/local/include/ folder. The same is written in this SO question: gem install libxml-ruby: fatal error: 'plist/Node.h' file not found
Command brew doctor told me that there are lots of files in /usr/local/include/ folder that might be deleted. I deleted file String.h and left all other files in place. This fixed it.
Thanks for everyone commenting and trying to help.

Trying to install Ruby gems on Synology DiskStation DS216j, cannot find Ruby header files

I am trying to run some Ruby scripts on my Synology DiskStation DS216j. I successfully managed to install Ruby 2.3.1 via OPKG/Entware-ng but when I try to install gems with native extensions, I get an error:
$ sudo gem install io-console
Building native extensions. This could take a while...
ERROR: Error installing io-console:
ERROR: Failed to build gem native extension.
current directory: /volume1/#entware-ng/opt/lib/ruby/gems/2.3/gems/io-console-0.4.6
/opt/bin/ruby -r ./siteconf20161113-31591-ucvjgl.rb extconf.rb
*** 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=/opt/bin/$(RUBY_BASE_NAME)
/opt/lib/ruby/2.3/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/lib/ruby/2.3/mkmf.rb:571:in `block in try_compile'
from /opt/lib/ruby/2.3/mkmf.rb:524:in `with_werror'
from /opt/lib/ruby/2.3/mkmf.rb:571:in `try_compile'
from /opt/lib/ruby/2.3/mkmf.rb:835:in `macro_defined?'
from extconf.rb:7:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/lib/ruby/gems/2.3/gems/io-console-0.4.6 for inspection.
Results logged to /opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/gem_make.out
The content of /opt/lib/ruby/gems/2.3/extensions/arm-linux/2.3/io-console-0.4.6/mkmf.log:
"arm-openwrt-linux-gnueabi-gcc -o conftest -I/opt/include/ruby-2.3/arm-linux-gnu -I/opt/include/ruby-2.3/ruby/backward -I/opt/include/ruby-2.3 -I. -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/include -I/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/usr/include -I/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/include -D_FILE_OFFSET_BITS=64 -O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/include -I/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/include -fPIC conftest.c -L. -L/opt/lib -L. -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/usr/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_glibc-2.23_eabi/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libiconv-full/lib -L/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/lib -Wl,-rpath-link=/media/ware3/Entware-ng.2016.08/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib/libintl-full/lib -L/media/ware3/Entware-ng.2016.08/build_dir/target-arm_cortex-a9_glibc-2.23_eabi/ruby-2.3.1 -fstack-protector -rdynamic -Wl,-export-dynamic -lruby -lpthread -lgmp -ldl -lcrypt -lm -lc"
/opt/bin/ld: cannot find -lruby
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
/opt/bin/ld: cannot find -lruby seems to be the real error here.
Googling this results in recommendations to install the Ruby source code/headers which I did:
$ wget -qO- http://pkg.entware.net/binaries/armv7/include/include.tar.gz | tar xvz -C /opt/include
[snip]
$ ls -lah /opt/include/ruby-2.3/
drwxr-xr-x 4 1000 1000 4.0K Aug 19 12:42 .
drwxr-xr-x 179 root root 20.0K Oct 10 09:32 ..
drwxr-xr-x 3 1000 1000 4.0K Aug 19 12:42 arm-linux-gnu
drwxr-xr-x 3 1000 1000 4.0K Aug 19 12:42 ruby
-rw-r--r-- 1 1000 1000 868 Jul 11 2012 ruby.h
So I guess the real question is: how can I tell /opt/bin/ld that the Ruby header files are located in /opt/include/ruby-2.3/?
Any help or tips are appreciated, thanks!
/opt/bin/ld: cannot find -lruby means that the linker can't find the Ruby library, not the headers. You need the compiled shared object library at /opt/lib/libruby.so or static library /opt/lib/libruby-static.a.

Issues with installing ffi gem on OS X yosemite with ruby-2.2.2

I'm trying to install the ffi gem so that I can use guard-rspec using the command sudo gem install ffi -v '1.9.8'. I end up getting this output:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20150424-14771-zza3du.rb extconf.rb
*** 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=/usr/local/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config'
from extconf.rb:15:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/ffi-1.9.8 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.8/gem_make.out
The mkmf.log file looks like this:
"/usr/local/bin/gcc -o conftest -I/usr/local/include/ruby-2.2.0/x86_64-darwin14 -I/usr/local/include/ruby-2.2.0/ruby/backward -I/usr/local/include/ruby-2.2.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -pipe conftest.c -L. -L/usr/local/lib -L. -fstack-protector -lruby-static -framework CoreFoundation -lpthread -lgmp -ldl -lobjc "
sh: line 1: 14464 Trace/BPT trap: 5 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find dsymutil 2> /dev/null
dsymutil: error: unable to find utility "dsymutil", not a developer tool or in PATH
collect2: error: dsymutil returned 72 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
So mkmf.rb seems to be complaining that it can't find dsymutil. But the command /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find dsymutil gives the output
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil
So the problem isn't that I don't have the command line tools installed.
I decided to take a look at the source code for mkmf.rb to see if I could figure out what was going on. The method that raised the error is:
def try_do(src, command, *opts, &b)
unless have_devel?
raise <<MSG
The compiler failed to generate an executable file.
You have to install development tools first.
MSG
end
begin
src = create_tmpsrc(src, &b)
xsystem(command, *opts)
ensure
log_src(src)
MakeMakefile.rm_rf "#{CONFTEST}.dSYM"
end
end
So we can see that the error that gets raised is raised if the method have_devel? returns false. Now check this out:
$ irb
irb(main):001:0> require 'mkmf'
=> true
irb(main):002:0> have_devel?
=> true
Great. So ruby can find my command line tools. But if I run irb as root:
$ sudo irb
Password:
irb(main):001:0> require 'mkmf'
=> true
irb(main):002:0> have_devel?
=> false
It fails. The mkmf.log file that gets spit out is the same as the one above, complaining about lack of dsymutil. I have no idea why this would happen.
Does anybody have any suggestions as to how I could get ffi installed? I suspect that something is weird about my box and nobody will be able to reproduce this mkmf behavior.

Can't install Nokogiri for Ruby in Windows

I know this is simple but I just can't figure it out. I need to run a script in Ruby and it requires Nokogiri. I do have some experience in other languages but not in Ruby.
Here is my system :
Ruby 2.0.0-p195 (x64) is installed # C:\Programs\RubyLanguage
Ruby Development Kit (mingw64-64-4.7.2-20130224-1432) is installed # C:\Programs\RubyDevKit
When I run gem install nokogiri I get this error:
ERROR: Error installing nokogiri:
The 'nokogiri' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Easy enough. So I followed the link of above and did to step 3. However step 4 says generate "config.yml". So I did. Now the file is an empty list with some comments. I still can't install Nokogiri because of error above and I don't seem to get anywhere with DevKit . What I am saying is that the steps in the Development Kit installation is not clear enough for me.
Update it now says installation of Nokogiri failed ( DevKit Works according to step 5 : Installing documentation for json-1.8.0
1 gem installed )
mkmf.log: package configuration for libxslt is not found
package configuration for libxml-2.0 is not found
package configuration for libiconv is not found
find_header: checking for libxml/parser.h... -------------------- no
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Programs/RubyLanguage/include/ruby-2.0.0/x64-mingw32 -IC:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/backward -IC:/Programs/RubyLanguage/include/ruby-2.0.0 -I. -IC:/Programs/RubyLanguage/include/libxml2 -IC:/Programs/RubyLanguage/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -L. -LC:/Programs/RubyLanguage/lib -LC:/Programs/RubyLanguage/lib -L. -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
In file included from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/defines.h:153:0,
from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:70,
from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby.h:33,
from conftest.c:1:
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/win32.h: In function 'rb_w32_pow':
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/win32.h:776:16: warning: conversion to 'double' from 'long double' may alter its value [-Wconversion]
In file included from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby.h:33:0,
from conftest.c:1:
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h: In function 'rb_float_value':
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:777:6: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion]
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:777:6: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion]
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */
"x86_64-w64-mingw32-gcc -E -IC:/Programs/RubyLanguage/include/ruby-2.0.0/x64-mingw32 -IC:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/backward -IC:/Programs/RubyLanguage/include/ruby-2.0.0 -I. -IC:/Programs/RubyLanguage/include/libxml2 -IC:/Programs/RubyLanguage/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -o conftest.i"
conftest.c:5:27: fatal error: libxml/parser.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libxml/parser.h>
/* end */
CMD log
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\SEPEHR>gem install nokogiri
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
C:/Programs/RubyLanguage/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.
-----
*** 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:/Programs/RubyLanguage/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
Gem files will remain installed in C:/Programs/RubyLanguage/lib/ruby/gems/2.0.0/
gems/nokogiri-1.6.0 for inspection.
Results logged to C:/Programs/RubyLanguage/lib/ruby/gems/2.0.0/gems/nokogiri-1.6
.0/ext/nokogiri/gem_make.out
Update: As of version 1.6.2, Nokogiri now does support the 64-bit version of Ruby 2.0.0. (Note that it requires libxml >= 2.6.21 )
Here's the answer if you still need to install the x86 version for some reason or if you want to understand how to install and build a gem using DevKit:
Nokogiri does not yet support the 64-bit version of Ruby 2.0.0. You can read about it and follow the status here.
But Nokogiri does support the x86 version of ruby 2.0.0. You should be able to install the gem in on 2.0.0 x86 install.
It's pretty easy to hand-install. I prefer that over RailsInstaller because I need to maintain other things as they are. Here's how:
Download and unzip the files for the version you need. Be sure to download the correct version of DevKit for the x86 version of 2.0.0.
Fix your path: Make sure your path includes the directories to the right ruby, gem, and DevKit dirs:
Assume you installed the x86 version of ruby 2.0.0 into C:\rubies\ruby-2-0-0-x86 and the associated DevKit into C:\rubies\DevKit-xxxx-x86 you will need to include these directories in your PATH:
C:\rubies\ruby-2-0-0-x86\bin
C:\rubies\ruby-2-0-0-x86\lib\ruby\gems\2.0.0
C:\rubies\DevKit-xxxx-x86\bin
Inject DevKit into the right ruby install: Once you have ruby installed and can get the correct info when you type ruby -v, then run ruby dk.rb init -- which will get DevKit set up & 'injected' into the correct ruby version. (N.B. I always have to edit the config.yml file that is produced and put in the correct path to the ruby installation I want. Don't sweat it if you need to do that.)
Yup ... Downgrading to 1.9.3 worked . Tnx for help . I put the summary here :
Install Ruby 1.9.3 ( Do not change Install Name to ex.RubyLang or
config doesn't find it automatically )
Install DevKit (Follow DevKit Installation Steps)
Install Nokogiri
I wasn't able to install x64 Nokogiri for Ruby 2.0 on Windows 7, but the binary gem seems to be working.

installing libxml in ruby 1.8.7 on linux mint

this is the result when trying to install -> extconf failure: need libm
virtualrails#jay ~ $ sudo gem install libxml-ruby
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
/opt/rubystack-2.0-0/ruby/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... no
checking for atan() in -lm... no
*** 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=/opt/rubystack-2.0-0/ruby/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-mlib
--without-mlib
extconf failure: need libm
Gem files will remain installed in /opt/rubystack-2.0-0/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-2.6.0 for inspection.
Results logged to /opt/rubystack-2.0-0/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-2.6.0/ext/libxml/gem_make.out
And this is the output of mkmf.log:
have_library: checking for atan() in -lm... -------------------- no
"gcc -o conftest -I. -I/opt/rubystack-2.0-0/ruby/lib/ruby/1.8/i686-linux -I. -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -D_FILE_OFFSET_BITS=64 -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -g -Os -fno-strict-aliasing -L/opt/rubystack-2.0-0/common/lib -fno-builtin conftest.c -L. -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L. -L/opt/rubystack-2.0-0/common/lib -ltcmalloc_minimal -rdynamic -Wl,-export-dynamic -lruby-static -lm -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘atan’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))atan; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/rubystack-2.0-0/ruby/lib/ruby/1.8/i686-linux -I. -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -D_FILE_OFFSET_BITS=64 -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -g -Os -fno-strict-aliasing -L/opt/rubystack-2.0-0/common/lib -fno-builtin conftest.c -L. -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L. -L/opt/rubystack-2.0-0/common/lib -ltcmalloc_minimal -rdynamic -Wl,-export-dynamic -lruby-static -lm -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lruby-static
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { atan(); return 0; }
/* end */
i am using http://sourceforge.net/projects/virtualrails/ in virtualbox 4.2.8
using gem 1.3.5
its contains two errors:
conftest.c:3: error: ‘atan’ undeclared (first use in this function)
/usr/bin/ld: cannot find -lruby-static
the first error 'atan' is easy to solve but the second one not really sure if one library is missing or if the is a bigger problem beging all this
https://github.com/xml4r/libxml-ruby#requirements:
libxml-ruby requires Ruby 1.8.4 or higher. It is dependent on the
following libraries to function properly:
- libm (math routines: very standard)
- libz (zlib)
- libiconv
- libxml2
If you are running Linux or Unix you’ll need a C compiler so the extension can be compiled when it is installed.
make sure you have all of these before building gem
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install libxml-ruby

Resources