I am unable to install ruby-opencv gem.
Here's what I have done so far.
Installed openCV with
sudo apt-get install libopencv-dev
Then tried installing ruby-opencv gem with
gem install ruby-opencv
But I got the following error
➜ test gem install ruby-opencv
Building native extensions. This could take a while...
ERROR: Error installing ruby-opencv:
ERROR: Failed to build gem native extension.
/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
>> Check the required libraries...
checking for main() in -lopencv_calib3d... yes
checking for main() in -lopencv_contrib... yes
checking for main() in -lopencv_core... yes
checking for main() in -lopencv_features2d... yes
checking for main() in -lopencv_flann... yes
checking for main() in -lopencv_gpu... 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=/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby
--with-opencv-dir
--without-opencv-dir
--with-opencv-include
--without-opencv-include=${opencv-dir}/include
--with-opencv-lib
--without-opencv-lib=${opencv-dir}/lib
--with-libxml2-dir
--without-libxml2-dir
--with-libxml2-include
--without-libxml2-include=${libxml2-dir}/include
--with-libxml2-lib
--without-libxml2-lib=${libxml2-dir}/lib
--with-opencv_calib3dlib
--without-opencv_calib3dlib
--with-opencv_contriblib
--without-opencv_contriblib
--with-opencv_corelib
--without-opencv_corelib
--with-opencv_features2dlib
--without-opencv_features2dlib
--with-opencv_flannlib
--without-opencv_flannlib
--with-opencv_gpulib
--without-opencv_gpulib
extconf.rb:53:in `block in <main>': libopencv_gpu not found. (RuntimeError)
from extconf.rb:52:in `each'
from extconf.rb:52:in `<main>'
It seems there is no libopencv-gpu dependency installed.
I tried to install it with apt-get but couldn't succeed as no repository was found.
Can any one help me how to install ruby-opencv gem?
UPDATE
added mkmf.log content
➜ test cat /home/ckgagan/.rvm/gems/ruby-1.9.3-p484/gems/ruby-opencv-0.0.11/ext/opencv/mkmf.log
have_library: checking for main() in -lopencv_calib3d... -------------------- yes
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
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 */
--------------------
have_library: checking for main() in -lopencv_contrib... -------------------- yes
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
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 */
--------------------
have_library: checking for main() in -lopencv_core... -------------------- yes
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
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 */
--------------------
have_library: checking for main() in -lopencv_features2d... -------------------- yes
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
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 */
--------------------
have_library: checking for main() in -lopencv_flann... -------------------- yes
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
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 */
--------------------
have_library: checking for main() in -lopencv_gpu... -------------------- no
"gcc -o conftest -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_gpu -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
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]
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/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-linux -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -I/usr/include -I/usr/local/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -Wl,-R/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -L/home/ckgagan/.rvm/rubies/ruby-1.9.3-p484/lib -lruby -lopencv_gpu -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
/usr/bin/ld: cannot find -lopencv_gpu
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 */
--------------------
Thanks
I just successfully install this gem ruby-opencv after hours investigation with many failures.
You have to download 2.x archive from http://opencv.org/downloads.html, NOTE, you can't install the latest version which is 3.0.beta, I'm the one who downloaded 3.0.beta initially, and got many failures.
Then install required packages and make install opencv according to this instruction
http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
From this installation instruction, you don't need to build opencv_contrib, just build opencv, that's all.
Finally, execute gem i ruby-opencv
Good luck.
Try installing the gem with the path to your opencv install as per the instructions on their github page.
gem install ruby-opencv -- --with-opencv-dir=/path/to/opencvdir
#lan Delairre, this is my note while installing opencv, hope this is helpful to you:
Download opencv-2.4.10 from http://opencv.org/downloads.html
Build libs
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
If got some error, try follow this instruction to install packages
http://milq.github.io/install-opencv-ubuntu-debian/
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libgtk2.0-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
cd ~/src/opencv-2.4.10
mkdir release
cd release
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON ..
make -j7
sudo make install
sudo ldconfig
Related
While compiling a Ruby gem's native extension, I get this error according to logs:
LD_LIBRARY_PATH=.:/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/lib "gcc-12 -M -o conftest -I/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0/x86_64-linux -I/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0/ruby/backward -I/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0 -I. -I/opt/local/include -I/usr/local/include -I/opt/homebrew/include -I/usr/include -I/home/linuxbrew/.linuxbrew/opt/libyaml/include -I/home/linuxbrew/.linuxbrew/opt/openssl#3/include -I/home/linuxbrew/.linuxbrew/opt/readline/include -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef -fPIC conftest.c -L. -L/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/lib -L/opt/local/lib -Wl,-rpath,/opt/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/usr/lib -Wl,-rpath,/usr/lib -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl#3/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl#3/lib -L/home/linuxbrew/.linuxbrew/opt/readline/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/readline/lib -L. -fstack-protector-strong -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl#3/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl#3/lib -L/home/linuxbrew/.linuxbrew/opt/readline/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/readline/lib -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/lib -L/home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/lib -lruby -lm -lc"
In file included from /home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0/ruby/defines.h:16,
from /home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0/ruby/ruby.h:25,
from /home/linuxbrew/.linuxbrew/Cellar/ruby#3.1/3.1.3_1/include/ruby-3.1.0/ruby.h:38,
from conftest.c:1:
/usr/include/stdio.h:781:10: fatal error: bits/sys_errlist.h: No such file or directory
781 | #include <bits/sys_errlist.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
The problem is that in the -I arguments you can see -I/opt/homebrew/include -I/usr/include, and the first of these directories has /opt/homebrew/include/stdio.h which doesn't contain #include <bits/sys_errlist.h>. As far as I understand https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html, it should be used instead of /usr/include/stdio.h. What am I missing and how can I fix the problem?
Versions:
WSL 1.0.3.0
Ubuntu 20.04
Homebrew GCC 12.2.0
Homebrew Ruby 3.1.3
The awful (but working for me) workaround:
Rename /usr/include;
Compile;
Rename it back.
Fetching ruby-filemagic 0.7.2
Installing ruby-filemagic 0.7.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/quantum/.rvm/gems/ruby-2.4.2/gems/ruby-filemagic-0.7.2/ext/filemagic
/Users/quantum/.rvm/rubies/ruby-2.4.2/bin/ruby -r ./siteconf20180207-53723-1uirx0.rb extconf.rb
checking for -lgnurx... no
checking for magic_open() in -lmagic... no
*** ERROR: missing required library to compile this module
*** 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.
have_library: checking for -lgnurx... -------------------- no
"gcc -o conftest -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -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 -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/Users/quantum/.rvm/rubies/ruby-2.4.2/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.2.4.2 -lpthread -lgmp -ldl -lobjc "
ld: warning: directory not found for option '-L/opt/local/lib'
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/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -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 -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/Users/quantum/.rvm/rubies/ruby-2.4.2/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.2.4.2 -lgnurx -lpthread -lgmp -ldl -lobjc "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: library not found for -lgnurx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13:
14: int t(void) { ; return 0; }
/* end */
--------------------
have_library: checking for magic_open() in -lmagic... -------------------- no
"gcc -o conftest -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -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 -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/Users/quantum/.rvm/rubies/ruby-2.4.2/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.2.4.2 -lmagic -lpthread -lgmp -ldl -lobjc "
conftest.c:13:57: error: use of undeclared identifier 'magic_open'
int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
/* end */
"gcc -o conftest -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/quantum/.rvm/rubies/ruby-2.4.2/include/ruby-2.4.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -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 -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/Users/quantum/.rvm/rubies/ruby-2.4.2/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.2.4.2 -lmagic -lpthread -lgmp -ldl -lobjc "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: library not found for -lmagic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: extern void magic_open();
14: int t(void) { magic_open(); return 0; }
/* end */
--------------------
It looks like the magic_open is failing? How can I fix this?
AAA,
found the solution which helped me, spent like almost two days on it, so if it would save someones time posting here.
brew install libmagic
and then
env ARCHFLAGS="-arch x86_64" gem install -v 0.7.1 ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
make sure though that you are installing required version in gem install -v 0.7.1 ruby-filemagic
sudo brew install libmagic fixed that for me
We are running on Ubuntu 14.04, with Gitlab 9.3.7, which works fine. We are trying to update to the latest security patch of Gitlab v9.3.8, but it gives us this error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/re2-1.0.0/ext/re2
/usr/local/bin/ruby -r ./siteconf20170720-19622-15i0edf.rb extconf.rb
checking for main() in -lstdc++... yes
checking for stdint.h... yes
checking for rb_str_sublen()... yes
checking for main() in -lre2... no
You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install
*** 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-re2-dir
--without-re2-dir
--with-re2-include
--without-re2-include=${re2-dir}/include
--with-re2-lib
--without-re2-lib=${re2-dir}/lib
--with-stdc++lib
--without-stdc++lib
--with-re2lib
--without-re2lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/git/gitlab/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/re2-1.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/re2-1.0.0 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/re2-1.0.0/gem_make.out
An error occurred while installing re2 (1.0.0), and Bundler cannot continue.
Make sure that `gem install re2 -v '1.0.0'` succeeds before bundling.
In Gemfile:
re2
The mkmf.log file contains:
have_library: checking for main() in -lstdc++... -------------------- yes
"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lpthread -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/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lstdc++ -lpthread -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return !p; }
/* end */
--------------------
have_header: checking for stdint.h... -------------------- yes
"gcc -E -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <stdint.h>
/* end */
--------------------
have_func: checking for rb_str_sublen()... -------------------- yes
"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lstdc++ -lpthread -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_sublen; return !p; }
/* end */
--------------------
have_library: checking for main() in -lre2... -------------------- no
"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lre2 -lstdc++ -lpthread -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lre2
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return !p; }
/* end */
"gcc -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-linux -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -I/usr/local/include -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 -Wall -Wextra -funroll-loops conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lstdc++ -Wl,-R/usr/local/lib -L/usr/local/lib -lruby-static -lre2 -lstdc++ -lpthread -ldl -lcrypt -lm -lc"
conftest.c:13:13: error: conflicting types for ‘main’
extern void main();
^
conftest.c:5:5: note: previous definition of ‘main’ was here
int main(int argc, char **argv)
^
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
13: extern void main();
14: int t(void) { main(); return 0; }
/* end */
--------------------
I've tried adding ruby-dev and ruby2.3-dev as we are using Ruby 2.3. No changes in the update. As this is a fairly recent patch, Gitlab has no further information on their site, and the installation instructions for re2 have not helped.
I was able to install the re2-gem after installing the lib:
apt-get install libre2-dev
I had same problem
It works for me, try it on you own risk
Ubuntu 14.04 have no libre2-dev
https://launchpad.net/ubuntu/+source/re2
I installed it from sources
https://github.com/google/re2/wiki/Install
cd /tmp
git clone https://github.com/google/re2.git
cd re2/
make
make test
sudo checkinstall -D --install=no
sudo dpkg -i re2_20170720-1_amd64.deb
And then run
ldconfig
I have the same error on macOS Big Sur. And below installation solve the problem
brew install re2
Hi I've just encountered the same error. At least we're not the only one.
I've made an issue in GitLab: https://gitlab.com/gitlab-org/gitlab-ce/issues/35342
I am trying to build website using Jekyll in Github Pages, I have issues installing github-pages gem in my local machine Windows 7 x64 Enterprise version.
Here is the steps I took:
* installed ruby 2.1.7 32bit at c:\Ruby21\ (file rubyinstaller-2.1.7.exe)
* installed corresponding devkit at c:\Devkit\ (file DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)
* run “gem install json --platform=ruby” to install RubyGems library JSON
* confirm JSON gem ok: ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect, I got response 42.
run “gem install bundler”, installed ok.
I went to local repo, created a Gemfile with content:
source 'https://rubygems.org'
gem 'github-pages'
run "bundle install"
The last run was failed with following message:
Installing rdiscount 2.1.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
checking for random()... no
checking for srandom()... no
checking for rand()... yes
checking for srand()... yes
checking size of unsigned long... 4
checking size of unsigned int... failed
checking size of unsigned short... failed
no int with size 2
*** 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:/Ruby21/bin/ruby
--with-rdiscount-dir
--without-rdiscount-dir
--with-rdiscount-include
--without-rdiscount-include=${rdiscount-dir}/include
--with-rdiscount-lib
--without-rdiscount-lib=${rdiscount-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/rdiscount-2.1.7 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/rdiscount-2.1.7/gem_make.out
An error occurred while installing rdiscount (2.1.7), and Bundler cannot
continue.
Make sure that `gem install rdiscount -v '2.1.7'` succeeds before bundling.
Below is the content of the file gem_make.out:
have_func: checking for random()... -------------------- no
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -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 */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:57: error: 'random' undeclared (first use in this function)
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:16:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
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 ((*)()))random; return 0; }
/* end */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:1: warning: implicit declaration of function 'random' [-Wimplicit-function-declaration]
C:\Users\xxxxx\AppData\Local\Temp\ccvoe3lp.o: In function `t':
C:\Ruby21\lib\ruby\gems\2.1.0\gems\rdiscount-2.1.7\ext/conftest.c:16: undefined reference to `random'
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: int t(void) { random(); return 0; }
/* end */
--------------------
have_func: checking for srandom()... -------------------- no
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:57: error: 'srandom' undeclared (first use in this function)
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:16:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
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 ((*)()))srandom; return 0; }
/* end */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:1: warning: implicit declaration of function 'srandom' [-Wimplicit-function-declaration]
C:\Users\xxxxx\AppData\Local\Temp\ccPnlJQk.o: In function `t':
C:\Ruby21\lib\ruby\gems\2.1.0\gems\rdiscount-2.1.7\ext/conftest.c:16: undefined reference to `srandom'
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: int t(void) { srandom(); return 0; }
/* end */
--------------------
have_func: checking for rand()... -------------------- yes
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
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 ((*)()))rand; return 0; }
/* end */
--------------------
have_func: checking for srand()... -------------------- yes
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
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 ((*)()))srand; return 0; }
/* end */
--------------------
check_sizeof: checking size of unsigned long... -------------------- 4
"gcc -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 -c conftest.c"
conftest.c:9:5: error: size of array 'conftest_const' is negative
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: typedef unsigned long rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: /*top*/
9: int conftest_const[(sizeof((*rbcv_ptr_)) < 0) ? 1 : -1];
/* end */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: typedef unsigned long rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: #include <stdio.h>
9: /*top*/
10: typedef unsigned
11: #ifdef PRI_LL_PREFIX
12: #define PRI_CONFTEST_PREFIX PRI_LL_PREFIX
13: LONG_LONG
14: #else
15: #define PRI_CONFTEST_PREFIX "l"
16: long
17: #endif
18: conftest_type;
19: conftest_type conftest_const = (conftest_type)(sizeof((*rbcv_ptr_)));
20: int main() {printf("%"PRI_CONFTEST_PREFIX"u\n", conftest_const); return 0;}
/* end */
./conftest |
--------------------
check_sizeof: checking size of unsigned int... -------------------- failed
"gcc -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 -c conftest.c"
conftest.c:9:5: error: size of array 'conftest_const' is negative
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: typedef unsigned int rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: /*top*/
9: int conftest_const[(sizeof((*rbcv_ptr_)) < 0) ? 1 : -1];
/* end */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
c:/devkit/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file conftest.exe: Permission denied
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: typedef unsigned int rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: #include <stdio.h>
9: /*top*/
10: typedef unsigned
11: #ifdef PRI_LL_PREFIX
12: #define PRI_CONFTEST_PREFIX PRI_LL_PREFIX
13: LONG_LONG
14: #else
15: #define PRI_CONFTEST_PREFIX "l"
16: long
17: #endif
18: conftest_type;
19: conftest_type conftest_const = (conftest_type)(sizeof((*rbcv_ptr_)));
20: int main() {printf("%"PRI_CONFTEST_PREFIX"u\n", conftest_const); return 0;}
/* end */
--------------------
check_sizeof: checking size of unsigned short... -------------------- failed
"gcc -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 -c conftest.c"
conftest.c:9:5: error: size of array 'conftest_const' is negative
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: typedef unsigned short rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: /*top*/
9: int conftest_const[(sizeof((*rbcv_ptr_)) < 0) ? 1 : -1];
/* end */
"gcc -o conftest.exe -IC:/Ruby21/include/ruby-2.1.0/i386-mingw32 -IC:/Ruby21/include/ruby-2.1.0/ruby/backward -IC:/Ruby21/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -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 conftest.c -L. -LC:/Ruby21/lib -L. -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
c:/devkit/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file conftest.exe: Permission denied
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: typedef unsigned short rbcv_typedef_;
6: static rbcv_typedef_ *rbcv_ptr_;
7:
8: #include <stdio.h>
9: /*top*/
10: typedef unsigned
11: #ifdef PRI_LL_PREFIX
12: #define PRI_CONFTEST_PREFIX PRI_LL_PREFIX
13: LONG_LONG
14: #else
15: #define PRI_CONFTEST_PREFIX "l"
16: long
17: #endif
18: conftest_type;
19: conftest_type conftest_const = (conftest_type)(sizeof((*rbcv_ptr_)));
20: int main() {printf("%"PRI_CONFTEST_PREFIX"u\n", conftest_const); return 0;}
/* end */
--------------------
I don't have background on c. I am not sure what the issue is and how to fix it.
Any help is appreciated!
PS:
I've tried different Ruby versions(2.1.7/2.2.3) and x86/x64, all resulted the same error. I also tried in another machine with win7 ultimate and installation without any error. I am suspecting there is some error specific to this particular win7 ent machine.
The cmd I ran is with admin rights.
Possibly related: You have a 64-bit OS but are using a 32-bit Ruby. Try a 64-bit Ruby (and DevKit).
You might also try Ruby 2.2.2, which is explicitly tested on 64-bit Windows.
After upgrading to Ruby 1.9.3 (from 1.9.2 using system RVM) on Ubuntu 10.04.3, I removed all of my gems, and attempted to reinstall pg (ala bundle install pg).
It then threw an error and informed me that I should look at mkmf.log, both of which are included in this gist: https://gist.github.com/d05a81701d968895c730
libpq-dev, libpq5, and postgresql-client are all installed and working correctly.
Pointing gem at pg_config, and the include and bin directories directly does not appear to change anything.
I've seen several questions about similar error messages around stackoverflow, and the rest of the web, but they all appear to be simple missing dependency issues (most of them are solved by installing libpq-dev), so I'm at a bit of a loss.
Various other properties that might be useful / relevant:
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
rvm 1.10.1 (system)
gem 1.8.15
psql (PostgreSQL) 8.4.9
Thanks in advance.
gem_make.out:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.
ldd.stdout:
$ldd /usr/lib/libpq.so
linux-gate.so.1 => (0xf57fe000)
libssl.so.0.9.8 => /lib/i686/cmov/libssl.so.0.9.8 (0xb77f4000)
libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0xb76a2000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb75f1000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0xb75ec000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb75bd000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb758b000)
libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0xb7544000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb752b000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb73d0000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb73cc000)
libz.so.1 => /lib/libz.so.1 (0xb73b7000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7393000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb738b000)
libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xb7386000)
libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7372000)
/lib/ld-linux.so.2 (0xb786a000)
liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0xb7365000)
libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb734d000)
libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0xb72b2000)
libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0xb72a0000)
libgcrypt.so.11 => /lib/libgcrypt.so.11 (0xb722d000)
libgpg-error.so.0 => /lib/libgpg-error.so.0 (0xb7228000)
pgconfig.stdout:
$pg_config --ldflags --libs
-Wl,-Bsymbolic-functions -Wl,--as-needed -Wl,--as-needed
-lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -lreadline -lcrypt -ldl -lm
mkmf.log:
find_executable: checking for pg_config... -------------------- yes
--------------------
find_header: checking for libpq-fe.h... -------------------- yes
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
"gcc -E -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------
find_header: checking for libpq/libpq-fs.h... -------------------- yes
"gcc -E -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq/libpq-fs.h>
/* end */
--------------------
have_library: checking for PQconnectdb() in -lpq... -------------------- no
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_init#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_free#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_check_private_key#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_free#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_pending#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `TLSv1_method#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_set_verify#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_pop_to_mark#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_new#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_error#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_get_error#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_write#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_ctrl#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `PEM_read_bio_PrivateKey#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_free#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_free#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_set_client_cert_cb#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `PEM_read_bio_X509#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_set_mark#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_read#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_NAME_oneline#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_library_init#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_ex_data#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_connect#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_new_file#OPENSSL_0.9.8'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -llibpq... -------------------- no
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -llibpq -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -llibpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -llibpq -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lms/libpq -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lms/libpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lms/libpq -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */
--------------------
I've got the same problem in my case was lib's inside .rvm/usr/lib which was taken to this compilation instead of lib's from system. I'm not sure why that happens and why it doesn't work (in my case on Ubuntu 10.04 x86_64) but to solve it just :
mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm
for a while or forever ;)
If someone will investigate why that happen I will be appreciate.
Regards.
Look at the mkmf.log around line 39:
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include -D_FILE_OFFSET_BITS=64 -I/usr/include/postgresql -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC conftest.c -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_init#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_free#OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key#OPENSSL_0.9.8'
...
Smells like a missing OpenSSL. I also don't see a -lssl in the library list but the missing symbols suggest that it should be there.
So try installing the OpenSSL libraries (version 0.9.8 by the look of things). Then see if pg_config --libs contains -lssl or similar and try again. If all of this works then you might want to send a bug report to the Ubuntu people so that they can fix the libpq-dev dependencies.
Sorry, I don't have an Ubuntu set up anywhere accessible at the moment so there is some guesswork going on here.
Don't be fooled by the SSL lib being installed - have a look at your Ruby build and check the ssl build log there. I've been bitten by that one before. Other libraries that sometimes don't get loaded are the GZip ones. This may not be the problem but have a look.
UPDATE:
You need the -dev libraries.
These days I use rbenv or one of the other ruby build tools and follow whatever messages they spit out.