Failed to install github-pages on windows 7 x64 - ruby

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.

Related

Windows: Installing pg gem fail with "Can't find the PostgreSQL client library (libpq)" and "undefined reference to `PQconnectdb'"

I'm having troubling installing the pg gem on Windows 10.
I've looked around and was able to progress with the first set of errors, but now am stuck with the error shown below.
Most answers I found all are for Linux and OSX and usually revolve around installing libpq-dev,which I'm not able to find for Windows. Given that I've moved past the initial missing libpq-fe.h error, I'm assuming that the required dev files are already included in the Windows installer.
I've tried specifying the folder/lib locations several ways, including:
gem install pg -v '1.1' -- --with-pg-dir="C:\Program Files\PostgreSQL\13" --with-pq-dir="C:\Program Files\PostgreSQL\13"
and
gem install pg -v '1.1' -- --with-pg-config="C:\Program Files\PostgreSQL\13\bin\pg_config.exe"
But neither seem to work. Any suggestions?
Additional info:
Console output
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions with: '--with-pg-config=C:\Program Files\PostgreSQL\13\bin\pg_config.exe'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby30/lib/ruby/gems/3.0.0/gems/pg-1.1.0/ext
C:/Ruby30/bin/ruby.exe -I C:/Ruby30/lib/ruby/3.0.0 -r ./siteconf20210424-18200-bi9e9l.rb extconf.rb --with-pg-config\=C:\\Program\ Files\\PostgreSQL\\13\\bin\\pg_config.exe
Using config values from C:\Program Files\PostgreSQL\13\bin\pg_config.exe
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.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.
mkmf.log
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -lmsvcrt-ruby300 -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 !!argv[argc];
8: }
/* end */
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -lmsvcrt-ruby300 -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -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() {return 0;}
/* end */
find_header: checking for libpq-fe.h... -------------------- yes
"i686-w64-mingw32-gcc -E -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libpq-fe.h>
/* end */
--------------------
find_header: checking for libpq/libpq-fs.h... -------------------- yes
"i686-w64-mingw32-gcc -E -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libpq/libpq-fs.h>
/* end */
--------------------
find_header: checking for pg_config_manual.h... -------------------- yes
"i686-w64-mingw32-gcc -E -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <pg_config_manual.h>
/* end */
--------------------
have_library: checking for PQconnectdb() in -lpq... -------------------- no
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -lpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
C:/Ruby30/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\Users\crist\AppData\Local\Temp\cch5p7v1.o:conftest.c:(.text+0x7): undefined reference to `PQconnectdb'
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: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -lpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c:18:13: error: conflicting types for 'PQconnectdb'
18 | extern void PQconnectdb();
| ^~~~~~~~~~~
In file included from conftest.c:5:
C:/PROGRA~1/POSTGR~1/13/include/libpq-fe.h:264:16: note: previous declaration of 'PQconnectdb' was here
264 | extern PGconn *PQconnectdb(const char *conninfo);
| ^~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: extern void PQconnectdb();
19: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -llibpq... -------------------- no
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -llibpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
C:/Ruby30/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\Users\crist\AppData\Local\Temp\cc4PD9EV.o:conftest.c:(.text+0x7): undefined reference to `PQconnectdb'
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: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -llibpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c:18:13: error: conflicting types for 'PQconnectdb'
18 | extern void PQconnectdb();
| ^~~~~~~~~~~
In file included from conftest.c:5:
C:/PROGRA~1/POSTGR~1/13/include/libpq-fe.h:264:16: note: previous declaration of 'PQconnectdb' was here
264 | extern PGconn *PQconnectdb(const char *conninfo);
| ^~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: extern void PQconnectdb();
19: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -lms/libpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
C:/Ruby30/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lms/libpq
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: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:/PROGRA~1/POSTGR~1/13/include -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30/lib -LC:/PROGRA~1/POSTGR~1/13/lib -L. -pipe -s -fstack-protector-strong -Wl,-rpath,C:/PROGRA~1/POSTGR~1/13/lib -lmsvcrt-ruby300 -lms/libpq -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c:18:13: error: conflicting types for 'PQconnectdb'
18 | extern void PQconnectdb();
| ^~~~~~~~~~~
In file included from conftest.c:5:
C:/PROGRA~1/POSTGR~1/13/include/libpq-fe.h:264:16: note: previous declaration of 'PQconnectdb' was here
264 | extern PGconn *PQconnectdb(const char *conninfo);
| ^~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <libpq-fe.h>
6:
7: /*top*/
8: extern int t(void);
9: int main(int argc, char **argv)
10: {
11: if (argc > 1000000) {
12: int (* volatile tp)(void)=(int (*)(void))&t;
13: printf("%d", (*tp)());
14: }
15:
16: return !!argv[argc];
17: }
18: extern void PQconnectdb();
19: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------
The issue was apparently being caused because I was using the 32 bit version of Ruby. Installed the 64 bit and the issue was resolved.

Jekyll installation via Bash on Windows 10

Using a Windows 10 machine with build 18363 with the Windows Subsystem for Linux installed (Ubuntu 18.04 LTS).
With a goal to install Jekyll, followed the steps mentioned in the documentation (which means to use a repository from BrightBox, which hosts optimized versions of Ruby for Ubuntu) but found a wall when the time to update Ruby gems came.
gem update
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.5.0 directory.
Even though the documentation says so, I thought permissions could be solved with sudo, byt of course it didn't
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/zlib-1.1.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/zlib-1.1.0 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/zlib-1.1.0/gem_make.out
Gems updated: bigdecimal csv date etc fileutils gdbm io-console ipaddr json psych rdoc stringio strscan webrick zlib
This is the content in gem_mke.out file
current directory: /var/lib/gems/2.5.0/gems/zlib-1.1.0/ext/zlib
/usr/bin/ruby2.5 -r ./siteconf20200312-8262-tpvi49.rb extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib1... no
checking for deflateReset() in -lzlib... no
checking for deflateReset() in -lzdll... no
checking for deflateReset() in -lzlibwapi... 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/$(RUBY_BASE_NAME)2.5
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-zlib
--without-zlib
--with-libzlib
--without-libzlib
--with-zlib1lib
--without-zlib1lib
--with-zliblib
--without-zliblib
--with-zdlllib
--without-zdlllib
--with-zlibwapilib
--without-zlibwapilib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/zlib-1.1.0/mkmf.log
extconf failed, exit code 1
This is the content of the mkmf.log file
have_library: checking for deflateReset() in -lz... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -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.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lz -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lz -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lz
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
have_library: checking for deflateReset() in -llibz... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -llibz -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -llibz -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -llibz
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
have_library: checking for deflateReset() in -lzlib1... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlib1 -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlib1 -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lzlib1
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
have_library: checking for deflateReset() in -lzlib... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlib -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlib -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lzlib
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
have_library: checking for deflateReset() in -lzdll... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzdll -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzdll -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lzdll
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
have_library: checking for deflateReset() in -lzlibwapi... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlibwapi -lpthread -lgmp -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘deflateReset’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))deflateReset; return !p; }
^~~~~~~~~~~~
conftest.c:13: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: /*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 ((*)()))deflateReset; return !p; }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.5-KHV_pi/ruby2.5-2.5.7=. -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.5 -lzlibwapi -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lzlibwapi
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: extern void deflateReset();
14: int t(void) { deflateReset(); return 0; }
/* end */
--------------------
If you don't want to use sudo for installing gems, you can reinstall ruby for the local user by compiling it from sources, but I have to admit I did not try that. My guess is that this will not fix the cannot find -lzlibwapi error that you encountered.
On my machine, I instead solved the issue by installing two missing libraries (that the second one was missing was only reported after installing the first one):
sudo apt-get install zlib1g-dev libgdbm-dev
You can then continue the installation of Jekyll, but you again have to insert sudo:
sudo gem install jekyll bundler
Even if you use sudo for installing gems, you can then use Jekyll normally (i.e., without sudo).
When using jekyll, you might run into the "Operation not permitted # apply2files" error. To prevent this, edit (or create) /etc/wsl.conf and add the appropriate mount options.

Updating Gitlab from 9.3.7 to 9.3.8 getting Error installing re2

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

Building native gem 'curb' on 64 bit Windows 8.1 fails: 'checking for curl-config... no'

>gem install curb -- --with-curl-dir=C:/curl-7.43.0-win32/bin --with-curl-lib=C:/curl-7.43.0-win32/lib --with-curl-include=C:/curl-7.43.0-win32/include
I get the following error
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/Ruby21-x64/bin/ruby.exe extconf.rb --with-curl-dir=C:/curl-7.43.0-win
32/bin --with-curl-lib=C:/curl-7.43.0-win32/lib --with-curl-include=C:/curl-7.43
.0-win32/include
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=C:/Ruby21-x64/bin/ruby
--with-curl-dir
--with-curl-include=${curl-dir}/include
--with-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:18: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.
I have researched this for hours and tried installing several different curl versions, making sure the curl directory is in my path. Using both mingw32 and windows command line, the error persists.
Also tried:
gem install curb --platform=mswin32
UPDATE
Below is the mkmf.log from the curb directory. What is it trying to tell me?
find_executable: checking for curl-config... -------------------- no
--------------------
have_library: checking for main() in -lcurl... -------------------- no
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -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-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L. -lx64-msvcrt-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 */
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -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-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L. -lx64-msvcrt-ruby210 -lcurl -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]
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/curl-7.40.0-devel-mingw32/bin/libcurl.dll when searching for -lcurl
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/curl-7.40.0-devel-mingw32/bin/libcurl.dll when searching for -lcurl
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcurl
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) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -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-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L. -lx64-msvcrt-ruby210 -lcurl -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:1: error: too few arguments to function 'main'
conftest.c:8:5: note: declared here
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) { main(); return 0; }
/* end */
--------------------
Also, I have curl-config executable in my path.
With my setup (Win 8.1 64bit, ruby 2.16 64 bit), the following version of curl is required: curl-7.40.0-devel-mingw64
gem install curb -- --with-curl-lib=C:/curl-7.40.0-devel-mingw64/bin --with-curl-include=C:/curl-7.40.0-devel-mingw64/include
You also need the 64 bit ruby dev kit unzipped into your_ruby_directory/DevKit and the following or equivalent in youir path.
C:\Ruby21-x64\bin;C:\Ruby21-x64\DevKit\bin;C:\Ruby21-x64\DevKit\mingw\bin;C:\curl-7.40.0-devel-mingw64\bin;C:\Ruby21-x64\bin;C:\Ruby21-x64\DevKit\bin;C:\Ruby21-x64\DevKit\mingw\bin;
I had also ensured that the cygwin curl-config executable was in my path, though it is unclear if this was required.

Can't install Puma gem on windows 8.1 (ruby 2.1.5)

I've been trying for a few days now to install the puma gem for ruby (2.1.5). I've update rubygems, I installed and succesfully ran the devkit, downloaded the latest ssl headers and fed them to the installation but all without success
This solution has been opted and I've seen several other ones from Luis Lavena or sourcing from http://rubygems.org instead of https:// but none of them seem to really work for me:
https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
I keep getting this error:
$ gem install puma -v 2.9.2 -- --with-opt-dir=c:\openssl
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir=c:openssl'
This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
c:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150126-4428-1lhbkfi.rb extconf.rb
--with-opt-dir=c:openssl
checking for SSL_CTX_new() in -lssl... no
checking for SSL_CTX_new() in -lssleay32... 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
--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-x64/bin/ruby
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-ssllib
--without-ssllib
--with-ssleay32lib
--without-ssleay32lib
extconf failed, exit code 1
Gem files will remain installed in c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/puma-2
.9.2 for inspection.
Results logged to c:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0
/puma-2.9.2/gem_make.out
my logfile:
have_library: checking for SSL_CTX_new() in -lssl... -------------------- no
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -Ic:openssl/include -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-x64/lib -Lc:openssl/lib -L. -lx64-msvcrt-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 */
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -Ic:openssl/include -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-x64/lib -Lc:openssl/lib -L. -lx64-msvcrt-ruby210 -lssl -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:57: error: 'SSL_CTX_new' 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 ((*)()))SSL_CTX_new; return 0; }
/* end */
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -Ic:openssl/include -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-x64/lib -Lc:openssl/lib -L. -lx64-msvcrt-ruby210 -lssl -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:1: warning: implicit declaration of function 'SSL_CTX_new' [-Wimplicit-function-declaration]
c:/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lssl
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) { SSL_CTX_new(); return 0; }
/* end */
--------------------
have_library: checking for SSL_CTX_new() in -lssleay32... -------------------- no
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -Ic:openssl/include -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-x64/lib -Lc:openssl/lib -L. -lx64-msvcrt-ruby210 -lssleay32 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:57: error: 'SSL_CTX_new' 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 ((*)()))SSL_CTX_new; return 0; }
/* end */
"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -Ic:openssl/include -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-x64/lib -Lc:openssl/lib -L. -lx64-msvcrt-ruby210 -lssleay32 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
conftest.c: In function 't':
conftest.c:16:1: warning: implicit declaration of function 'SSL_CTX_new' [-Wimplicit-function-declaration]
c:/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lssleay32
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) { SSL_CTX_new(); return 0; }
/* end */
--------------------
The gem_make.out file:
c:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150126-4428-1lhbkfi.rb extconf.rb --with-opt-dir=c:openssl
checking for SSL_CTX_new() in -lssl... no
checking for SSL_CTX_new() in -lssleay32... 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
--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-x64/bin/ruby
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-ssllib
--without-ssllib
--with-ssleay32lib
--without-ssleay32lib
extconf failed, exit code 1
Instructions you provided the link for are for 32 bit ruby (at least the link to openssl library has x86 in it), while it looks like you are using 64 bit version.
There is a way to check exact version of openssl used by your ruby installation as mentioned on Google Groups for RubyInstaller thread named Updated OpenSSL Knapsack packages (x86 and x64)
> ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
OpenSSL 1.0.0o 15 Oct 2014
So in my case the way to go is https://bintray.com/oneclick/OpenKnapsack/openssl/view hoping that there is corresponding version.

Resources