Can't install curb gem in Linux Mint - ruby-on-rails

I have a problem with installing curb. When I type in my console:
sudo gem install curb
It returns me following error:
Fetching: curb-0.8.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for curl-config... no
checking for main() in -lcurl... 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=/usr/bin/ruby1.9.1
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:23:in `<main>': Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in /var/lib/gems/1.9.1/gems/curb-0.8.6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/curb-0.8.6/ext/gem_make.out
I don't have any idea how to solve this problem. I was looking for some solution in Google but not find anything that will help me to solve this problem. Please help...
EDIT:
Here is mkmf.log file. Maybe it will be helpfull in debuging:
find_executable: checking for curl-config... -------------------- no
--------------------
have_library: checking for main() in -lcurl... -------------------- no
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -lruby-1.9.1 -lcurl -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
^
conftest.c:4:53: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:4:28: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
^
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
/* end */
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -lruby-1.9.1 -lcurl -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
int t() { main(); return 0; }
^
/usr/bin/ld: cannot find -lcurl
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: int t() { main(); return 0; }
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
/* end */
--------------------

If you are on Ubuntu do this before proceeding:
sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
Alternatively for other OS install, download package from here after selecting your OS:
http://curl.haxx.se/dlwiz/?type=devel

Your Mint installation is probably missing the curl dev libraries.
Try this on the command line:
sudo apt-get install libcurl4-openssl-dev

Use command from previous answer
sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
Sometimes Mint can't install libcurl4-openssl-dev because of next error.
The following packages have unmet dependencies:
libldap2-dev : Depends: libldap-2.4-2 (= 2.4.31-1+nmu2ubuntu8.2) but 2.4.31-1+nmu2ubuntu8.3 is to be installed
E: Unable to correct problems, you have held broken packages.
In my case I've resolved it with next command:
sudo aptitude install libldap2-dev
At first it suggested to do nothing, I've selected No, then it suggested to downgrade my current install to proper version. I've selected Yes. Then I was able to install libcurl4-openssl-dev as usual

Related

Homebrew- impossible to install postgresql

I am stuck in the installation process of pg, making circles with the same issues, and couldn't resolve them.
I brew install libpq, then brew install openssl#1.1 then pg, and the exit error goes back to ask me to reinstall OpenSSL.
I have several Rails projects where PG used to work fine. I updates homebrew a few days ago and my configuration is a total mess.
My system is Mac OS Mojave 10.14.6. What do you advise to clean and start again with a proper configuration? (I am far from being a command line expert..)
Thanks for all recommendations!
Here is the mkmf.log I get when the installation of pg fails:
find_executable: checking for pg_config... -------------------- no
--------------------
checking for libpq per pkg-config... -------------------- no
"pkg-config --exists libpq"
| pkg-config --libs libpq
=> "-lpq\n"
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 -lpq "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
| pkg-config --cflags-only-I libpq
=> "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include\n"
| pkg-config --cflags-only-other libpq
=> "\n"
| pkg-config --libs-only-l libpq
=> "-lpq\n"
package configuration for libpq
incflags: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include
cflags:
ldflags:
libs: -lpq
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"clang -E -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
have you tried using an installed instead? https://www.postgresql.org/download/

Sqlite error while creating a rails project on Windows

Im a newbee to rails.
Im trying to create a rails project
rails new depot
Unfortunately this is failing at the point where rails try to do geminstall of sqlite
The error is as follows
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>
I have installed (copied binaries) from SQLite Download page to my C:\sqlite folder.
My OS is 64 bit so I have downloaded "sqlite-dll-win64-x64-3260000.zip" and "sqlite-tools-win32-x86-3260000.zip" (from here https://www.sqlite.org/download.html)
I also have the dll and header files as shown
02/12/2018 12:38 AM 504,837 shell.c
02/12/2018 12:39 AM 490,496 sqldiff.exe
02/12/2018 12:38 AM 7,770,073 sqlite3.c
02/12/2018 12:26 PM 5,933 sqlite3.def
02/12/2018 12:27 PM 1,878,528 sqlite3.dll
02/12/2018 12:40 AM 911,360 sqlite3.exe
02/12/2018 12:38 AM 556,318 sqlite3.h
02/12/2018 12:38 AM 33,713 sqlite3ext.h
02/12/2018 12:40 AM 2,003,968 sqlite3_analyzer.exe
Because of this error I tried to install sqlite3 with gem command
As my header and DLL are in directory C:\sqlite, I used the following command on msys2 terminal
ridk enable
C:\Users\rose>gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=C:\sqlite
Fetching: sqlite3-1.4.0.gem (100%)
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
Building native extensions with: '--with-sqlite3-dir=C:\sqlite'
This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190205-17968-rk6pw2.rb extconf.rb --with-sqlite3-dir=C:\sqlite
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -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:/Ruby25-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
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-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:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out
C:\Users\rose>
Any clue whats missing?
The mkmf log says
"pkg-config --exists sqlite3"
| pkg-config --libs sqlite3
=> "-LC:/Ruby25-x64/msys64/mingw64/lib -lsqlite3\n"
"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. -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 -L. -pipe -s -lx64-msvcrt-ruby250 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
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 -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. -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 -L. -pipe -s -lx64-msvcrt-ruby250 -LC:/Ruby25-x64/msys64/mingw64/lib -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
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 */
| pkg-config --cflags-only-I sqlite3
=> "-IC:/Ruby25-x64/msys64/mingw64/include\n"
| pkg-config --cflags-only-other sqlite3
=> "\n"
| pkg-config --libs-only-l sqlite3
=> "-lsqlite3\n"
package configuration for sqlite3
cflags:
ldflags: -LC:/Ruby25-x64/msys64/mingw64/lib
libs: -lsqlite3
find_header: checking for sqlite3.h... -------------------- yes
"x86_64-w64-mingw32-gcc -E -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:\sqlite/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 -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/* end */
--------------------
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:\sqlite/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:\sqlite/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
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
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: printf("%p", &t);
12: }
13:
14: return 0;
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))pthread_create; return !p; }
/* end */
"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:\sqlite/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:\sqlite/lib -L. -pipe -s -LC:/Ruby25-x64/msys64/mingw64/lib -lsqlite3 -lx64-msvcrt-ruby250 -lpthread -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
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: printf("%p", &t);
12: }
13:
14: return 0;
15: }
16: extern void pthread_create();
17: int t(void) { pthread_create(); return 0; }
/* end */
--------------------
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:\sqlite/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:\sqlite/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.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
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: printf("%p", &t);
12: }
13:
14: return 0;
15: }
16:
17: int t(void) { ; return 0; }
/* end */
--------------------
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:\sqlite/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:\sqlite/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
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: printf("%p", &t);
12: }
13:
14: return 0;
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))dlopen; return !p; }
/* end */
"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:\sqlite/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:\sqlite/lib -L. -pipe -s -LC:/Ruby25-x64/msys64/mingw64/lib -lpthread -lsqlite3 -lx64-msvcrt-ruby250 -lpthread -lsqlite3 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
C:\Users\Navarose\AppData\Local\Temp\ccNQH25m.o:conftest.c:(.text+0x5): undefined reference to `dlopen'
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: printf("%p", &t);
12: }
13:
14: return 0;
15: }
16: extern void dlopen();
17: int t(void) { dlopen(); return 0; }
/* end */
--------------------
As a last resort I built the SQlite using mingw64
Later tried to install the gem. And a new error which is like shostopper
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
Found a very neat fix in here
https://github.com/sparklemotion/sqlite3-ruby/issues/248
It seesms it is only missing a library in msys2.
ridk exec pacman -S mingw-w64-x86_64-dlfcn
After that, the compilation went ok.
gem install sqlite3 -v 1.4.0
Note:- adding a dependency on a git branch does not seem ideal.
Point to the fork of sqlite3-ruby gem and use the branch last updated in 2018:
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
to your Gemfile. So far, it worked for me. Good luck! :)
As per the description mentioned in the post it seems like sqlite is not properly installed on your machine including all headers required.
Run the below mentioned command to get it installed properly:
gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=C:/path/to/sqlite3
Where C:/path/to/sqlite3 is where the headers (include) and libs (lib) for sqlite3 are resided.
Hope that helps.
It's an simple Permission issue, follow the below steps.
Uninstall Ruby
Reinstall Ruby , *while reinstalling Ruby install it under C:\user-name* Folder.
After Installing Ruby , re run gem install sqllite3 under C:\user-name\ Folder.
here user-name is user your user directory.
Example :C:\Users\rose\

Rails postresql installation issue

Hi folks, I have a problem when I try to install the postgresql, it is about a project, first I install the postgresql, then I write: sudo bundle install and it gives me this error and I cannot run the project because of it:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.20.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/gem_make.out
Below is the code from the file: mkmf.log
nd_executable: checking for pg_config... -------------------- yes
/usr/lib/ruby/2.3.0/mkmf.rb:1547: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
--------------------
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -Wl,-rpath, -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
find_header: checking for libpq-fe.h... -------------------- no
"gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i"
conftest.c:3:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------

Problems while installing pg gem

I need to install pg gem, but the installation failed. I've tried all the solution propesed in other questions but no luck.
Here is my output, and here is my "mkmf.log" file
Any idea?
[UPDATE]
I've solved the first problem by putting libs in the correct directory. But now I've another problem:
find_executable: checking for pg_config... -------------------- yes
--------------------
"gcc -o conftest -I/usr/include/ruby-1.9.1/i686-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -I/usr/include/postgresql -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby-1.9.1-static -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
[UPDATE2]
Solved it by putting links to "libgcc", "libgcc_s", "crtend.o", "crtendS.o", "crtbeginS.o" and "crtbegin.o" into /usr/lib
It looks like you are missing development libraries even for glibc. Just install devel packages for glibc and postgresql and try again.

Rails 2.3.8 won't run on Passenger after upgrade to Ruby EE - iconv error

I just installed Ruby EE 11.01. I had a Rails 2.3.8 application that was running against Passenger 3.0.2 on Apache2. Now, my application will not come up. The error is:
no such file to load -- iconv
I am on Mac OS X 10.6.4. I installed Ruby EE with:
sudo ./installer -c --with-openssl-dir=/opt/local -c --with-readline-dir=/opt/local -c --with-iconv-dir=/opt/local
"which iconv" yields:
/opt/local/bin/iconv
Attempting to install gem iconv yields:
Building native extensions. This could take a while...
ERROR: Error installing iconv:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2011.01/bin/ruby extconf.rb
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... 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.
is my iconv path wrong in the install line? Help!
EDIT:
Looking in the log file above I see this:
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
have_library: checking for iconv() in -liconv... -------------------- no
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
Undefined symbols:
"_libiconv", referenced from:
_t in ccxx7BhR.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
I highly recommend using RVM on Mac OS. It's extremely easy to install and it handles downloading and compiling the environment with readline, iconv, openssl, zlib, etc. I can't tell you how many hours it's saved me.
http://rvm.beginrescueend.com/
Back to your question - did you try gem install iconv -- --with-iconv-dir=/opt/local ?

Resources