Why could GCC prefer to use stdio.h file from later in the include path? - gcc

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.

Related

I want to install rrdiff gem but its giving me error that lrsync is not there, how to install and configure lrsync for mac apple m1 chip?

I want to install rrdiff gem but its giving me error that lrsync is not there, how to install and configure lrsync for mac apple m1 chip so the gem install for rrdiff works properly?
Here is the lrsync:
lrsync github link
Here are mkmf.log and gem_make.out files:
mkmf.log:
have_library: checking for -lrsync... -------------------- no
"gcc -o conftest -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/-darwin20 -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl#1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib -L. -fstack-protector-strong -L/usr/local/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib -lruby.2.7 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"gcc -o conftest -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/-darwin20 -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl#1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib -L. -fstack-protector-strong -L/usr/local/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib -lruby.2.7 -lrsync "
ld: library not found for -lrsync
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: int (* volatile tp)(void)=(int (*)(void))&t;
9: printf("%d", (*tp)());
10: }
11:
12: return !!argv[argc];
13: }
14:
15: int t(void) { ; return 0; }
/* end */
--------------------
gem_make.out:
current directory: /Users/aashishgangwani/.rvm/gems/ruby-2.7.1/bundler/gems/rrdiff-6742766bf0e0/ext/rrdiff
/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/bin/ruby -I /Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20210727-47852-a9wtwt.rb extconf.rb
checking for -lrsync... 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=/Users/aashishgangwani/.rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--with-rsync-dir
--without-rsync-dir
--with-rsync-include
--without-rsync-include=${rsync-dir}/include
--with-rsync-lib
--without-rsync-lib=${rsync-dir}/lib
--with-rsynclib
--without-rsynclib
extconf.rb:3:in `<main>': unhandled exception
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/aashishgangwani/.rvm/gems/ruby-2.7.1/bundler/gems/extensions/-darwin-20/2.7.0/rrdiff-6742766bf0e0/mkmf.log
extconf failed, exit code 1
rrdif mkmf.log file
rrdiff gem_make.out file
I have tried to clone the repository of lrsync and do "make" into the folder but that doesn't solve my problem.

Error installing ruby file magic on OSX

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

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

Error while Installing ruby2.1.5 from sources on freebsd 7

I am trying to install ruby2.2 in in freebsd 7 i386, but it is throwing below error.
Can someone help how to resolve it
I
# make
CC = /usr/local/bin/gcc48
LD = ld
LDSHARED = /usr/local/bin/gcc48 -shared
CFLAGS = -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
-ansi -std=iso9899:199409
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector
-fno-strict-overflow -fvisibility=hidden
-DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/i386-freebsd7.1 -I./include -I.
DLDFLAGS = -Wl,-soname,showflags -fstack-protector -pie
SOLIBS =
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc48
COLLECT_LTO_WRAPPER=
/usr/local/libexec/gcc48/gcc/i386-portbld- freebsd7.1/4.8.3/lto-wrapper
Target: i386-portbld-freebsd7.1
Configured with: ./../gcc-4.8.3/configure
--disable-bootstrap --disable-nls
--enable-gnu-indirect-function
--libdir=/usr/local/lib/gcc48
--libexecdir=/usr/local/libexec/gcc48
--program-suffix=48
--with- as=/usr/local/bin/as
--with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/
--with-ld=/usr/local/bin/ld
--with-pkgversion='FreeBSD Ports Collection'
--with-system-zlib --disable-libgcj
--enable-languages=c,c++,objc,fortran
--prefix=/usr/local --mandir=/usr/local/man
--infodir=/usr/local/info/gcc48
--build=i386-portbld-freebsd7.1
Thread model: posix
gcc version 4.8.3 (FreeBSD Ports Collection)
compiling math.c
**math.c: In function 'math_log':
**math.c:466:9: internal compiler error: Segmentation fault: 11
d += numbits * log(2); /* log(2**numbits) */****
^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.

Where can I get the nsslowhash lib from for fedora 16? Source preferably

While trying to build the mysql2 gem with ruby 1.9.2-p320 on Fedora 16, I ran into this error,
reproducible like so:
gremlin:mysql2 $ cat conftest.c
#include "ruby.h"
/*top*/
int main() {return 0;}
int t() {
void ((*volatile p)());
p = (void ((*)()))rb_thread_blocking_region;
return 0;
}
gremlin:mysql2 $ gcc -o conftest -I/usr/local/include/ruby-1.9.1/i686-linux \
-I/usr/local/include/ruby-1.9.1/ruby/backward
-I/usr/local/include/ruby-1.9.1 -I.
-I/usr/local/include/ruby-1.9.1/
-D_FILE_OFFSET_BITS=64 -O3 -ggdb -Wextra -Wno-unused-parameter
-Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers
-Wno-long-long conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.
-rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib
-lruby-static -lpthread -lrt -ldl -lnss3 -lcrypt -lm -lc
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):
In function `__md5_crypt_r':
(.text+0x96): undefined reference to `NSSLOW_Init'
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):
In function `__md5_crypt_r':
(.text+0xb1): undefined reference to `NSSLOWHASH_NewContext'
... and many more messages for other global functions in the nsslowhash library,
which it looks like /usr/lib/libcrypt.a expects to have available, but I don't have
it installed, and can't find the source for.
Actually, that's not totally true. I found nsslowhash as part of
the Mozilla-Central build for Firefox, but when I run nm on the compiled
.a and .so files, none of them define anything that matches NSSLOW.
So where do these names come from?
Any help appreciated.
Problem solved by adding -lfreebl3 to the LIBS CONFIG setting.

Resources