Errors Installing the gem wdm in cygwin - ruby

I keep getting this error while installing the gem wdm from inside cygwin. Does anybody had the same issue and know now to fix it. Thanks. (I am Trying to install Guard gem)
$ gem install wdm
Building native extensions. This could take a while...
ERROR: Error installing wdm:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
checking for main() in -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o entry.o -c entry.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o memory.o -c memory.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o monitor.o -c monitor.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o queue.o -c queue.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o rb_change.o -c rb_change.c
rb_change.c: In function ‘extract_absolute_path_from_notification’:
rb_change.c:47:16: error: ‘_MAX_FNAME’ undeclared (first use in this function)
rb_change.c:47:16: note: each undeclared identifier is reported only once for each function it appears in
rb_change.c:47:33: error: ‘_MAX_EXT’ undeclared (first use in this function)
Makefile:206: recipe for target `rb_change.o' failed
make: *** [rb_change.o] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/wdm-0.1.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/wdm-0.1.0/ext/wdm/gem_make.out

A colleague of mine had an issue with wdm the other day.
We fixed it by downloading the Ruby DevKit (Not sure if you already had this installed).
I found some pretty decent step by steps online, I'll paste them here - hope they help
Development kit is here: http://rubyinstaller.org/downloads/
Download the Development Kit and install it in say c:\devkit.
Open a command window and type c:.
Change folders by typing cd devkit.
Type ruby dk.rb init to generate the config.yml file to be used later.
Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present). This needs to be done only once.
Finally type, ruby dk.rb install for DevKit enhance your installed Rubies. This needs to be done only once.
Confirm your Ruby environment is correctly using the DevKit by running:
gem install wdm --platform=ruby
It’s crucial that you include the --platform=ruby option to force RubyGems to build the native gem rather than potentially installing an incorrect binary gem.

Related

facing an error during installing mumps on cygwin?

trying to install mumps on my windows laptop, followed instructions to setup cygwin first and install mumps through it....now facing this error updon running ./BuildMumpsWithNativeClientServer.script in cygwin terminal
config.status: creating include/mumpsc/config.h
Now run "make" followed by "make install"
gcc -w -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -DMUMPS_SYM -Iinclude/ -finline-functions -w -DMUMPS_SYM -Iinclude/ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -lgmp -c -o mumps.o mumps.c
gcc -w -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -DMUMPS_SYM -Iinclude/ -finline-functions -w -DMUMPS_SYM -Iinclude/ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -lgmp -c -o parse.o parse.c
gcc -w -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -DMUMPS_SYM -Iinclude/ -finline-functions -w -DMUMPS_SYM -Iinclude/ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -lgmp -c -o sys1.o sys1.c
g++ -w -DMUMPS_SYM -Iinclude/ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -lgmp -c -o arith.o arith.cpp
sys1.c:804:1: error: conflicting types for ‘itoa’
itoa (val, str, rad)
^~~~
In file included from sys1.c:51:0:
/usr/include/stdlib.h:224:8: note: previous declaration of ‘itoa’ was here
char * itoa (int, char *, int);
^~~~
make: *** [<builtin>: sys1.o] Error 1
make: *** Waiting for unfinished jobs....
arith.cpp: In function ‘void mps_exp10(char*, char*)’:
arith.cpp:855:15: error: ‘exp10’ was not declared in this scope
double aa=exp10(strtod(a,NULL));
^~~~~
arith.cpp:855:15: note: suggested alternative: ‘expx’
double aa=exp10(strtod(a,NULL));
^~~~~
expx
make: *** [<builtin>: arith.o] Error 1
I'm going to give a non-answer that (I hope) will help you achieve your ultimate goal of installing a MUMPS build on your Windows laptop. Because you're running "BuildMumpsWithNativeClientServer.script", I'm guessing you're trying to install Kevin O'Kane's version of MUMPS. You might want to switch to a production-ready MUMPS build like Intersystems Cache, GT.M, or YottaDB.
If you use Intersystems Cache, it will install natively on Windows. If you use GT.M or it's fork, YottaDB, they install cleanly on most Linux distros, but not as native Windows apps. The painless option is to install Windows Subsystem for Linux (WSL) and a linux distro on your laptop. I recommend Ubuntu 18.04 as a Linux distro, since it's the most recent long-term support linux distro that's available in the Windows store.
Once you have linux installed via WSL on your Windows box, installing GT.M only takes a single command: sudo apt install fis-gtm
I know this isn't exactly answering the question you asked, but I'm hoping it gets you the result you really want. Good luck!

How to install gbarcode gem to Ubuntu?

I've problem with gbarcode gem which has dependency gnu-barcode c application.
When trying to say gem install gbarcode it says:
Building native extensions. This could take a while...
ERROR: Error installing gbarcode-linux:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb
checking for main() in -lbarcode... yes
creating Makefile
make
gcc -I. -I. -I/home/user/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c barcode_wrap.c
gcc -shared -o gbarcode.so barcode_wrap.o -L. -L/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -Wl,-R/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -L/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -lruby -lbarcode -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libbarcode.a(library.o): relocation R_X86_64_32 against `encodings' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libbarcode.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [gbarcode.so] Error 1
I've tried to install gnu-barcode application from ubuntu software center, apt-get and directly from source http://www.gnu.org/software/barcode/ and the response is always the same.
How should I install gnu barcode so that it's working with the gem.
And yes this project is quite heavy dependent on that gem so replacing it would be really painful to all parties.

Gem build "recipe for target 'stemmer.so' failed"

When installing Jekyll from gem using gem install jekyll, I am getting the following build error. I am using Cygwin on Windows 7 and have built the posix-spawn gem from source prior to installing.
Building native extensions. This could take a while...
ERROR: Error installing jekyll-1.1.2.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -ggdb -O2 -pipe -fno-strict-aliasing -o porter.o -c porter.c
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -ggdb -O2 -pipe -fno-strict-aliasing -o porter_wrap.o -c porter_wrap.c
rm -f stemmer.so
gcc -shared -o stemmer.so porter.o porter_wrap.o -L. -L/usr/lib -L. -Wl,--export-all-symbols -Wl,--enable-auto-image-base,--enable-auto-import -lruby191 -lpthread -lrt -ldl -lcrypt
/usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcrypt
collect2: error: ld returned 1 exit status
Makefile:214: recipe for target `stemmer.so' failed
make: *** [stemmer.so] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2/ext/gem_make.out
I am using gem v2.0.7, ruby v1.9.3p448, gcc v4.8.1 and g++ v4.8.1
Any ideas? I have no idea when it comes to Ruby gems. I cannot find any information on this "stemmer".
Dan
Turns out the crux of this error was in the cannot find -lcrypt. I installed libcrypt-devel and the gem compiled fine after that.
I think on most native Linux distros, this lib will already be included!
Yeah, Thanks, I installed :-).
Please installing 'libcrypt-devel' in cygwin

Bundler halts on json install, even though there's no json in Gemfile

Project bundle is stopping with error on json installation. But I'm not asking for json in Gemfile. Current Ruby in RVM is 1.9.2-p290, strict.
Have no idea to workaround this. Any helps, maybe?
Installing json (1.7.7)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make
xcrun cc -I. - I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c generator.c
xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle generator.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl -lobjc
i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/ft/gswz6cs52wb9jh_v5h2yt5_h0000gn/T//ccvGNawc.out
make: *** [generator.bundle] Error 1
Gem files will remain installed in /Users/noAlvaro/.rvm/gems/ruby-1.9.2-p290#heroku_project/gems/json-1.7.7 for inspection.
Results logged to /Users/noAlvaro/.rvm/gems/ruby-1.9.2-p290#heroku_project/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Any help, anything, will be much appreciated. :)
Even if you don't explicitly list json as dependency, other gems you are using may do this. As a result, Bundler will include it in the bundled list.
To check which library is using json you can inspect the Gemfile.lock file or use bundle viz to draw your dependency tree.

compiler error while installing rubygem 'mysql2' in Ruby 1.9.2 over CentOS 64-bit

a CentOS 64-bit Server with Ruby 1.8.7 & 1.9.2
{{no RVM, need it without RVM...
currently all Ruby1.9.2 binaries are ruby19 and similarly accessible,
so no mapping of gem-path or anything of that sort is there}}
is giving error while installing gem 'mysql2' ...
I have all dependencies installed and all are 64-bit versions ...
All error are of kind {./client.h:13:
error: redefinition of typedef
‘rb_unblock_function_t’}
Could {#warning rubysig.h is obsolete}
be a reason for this?
Console Capture:
#gem19 install mysql2 -v 0.2.7 -- --with-mysql-dir=/usr/bin --with-mysql-config=/usr/bin/mysql_config --with-mysql-include=/usr/include/mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/bin/ruby19 extconf.rb --with-mysql-dir=/usr/bin --with-mysql-config=/usr/bin/mysql_config --with-mysql-include=/usr/include/mysql
checking for rb_thread_blocking_region()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -Wall -fno-strict-aliasing -fPIC -Wall -funroll-loops -o result.o -c result.c
In file included from ./client.h:11,
from ./mysql2_ext.h:39,
from result.c:1:
/usr/include/ruby-1.9.1/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete
In file included from ./mysql2_ext.h:39,
from result.c:1:
./client.h:13: error: redefinition of typedef ‘rb_unblock_function_t’
/usr/include/ruby-1.9.1/ruby/intern.h:754: error: previous declaration of ‘rb_unblock_function_t’ was here
./client.h:14: error: redefinition of typedef ‘rb_blocking_function_t’
/usr/include/ruby-1.9.1/ruby/intern.h:755: error: previous declaration of ‘rb_blocking_function_t’ was here
./client.h:20: error: static declaration of ‘rb_thread_blocking_region’ follows non-static declaration
/usr/include/ruby-1.9.1/ruby/intern.h:759: error: previous declaration of ‘rb_thread_blocking_region’ was here
./client.h: In function ‘rb_thread_blocking_region’:
./client.h:23: warning: ‘rb_thread_blocking_region_begin’ is deprecated (declared at /usr/include/ruby-1.9.1/ruby/backward/rubysig.h:31)
./client.h:25: warning: ‘rb_thread_blocking_region_end’ is deprecated (declared at /usr/include/ruby-1.9.1/ruby/backward/rubysig.h:32)
In file included from ./mysql2_ext.h:39,
from result.c:1:
./client.h:41:7: warning: no newline at end of file
make: *** [result.o] Error 1
This is caused by a patch they introduced on the gem in order for it to run in Ruby 1.8 but it is not needed on Ruby 1.9.
To deactivated this "fix" and be able to install the gem you can define a flag for the compiler:
gem install mysql2 -- --with-cflags=\"-DHAVE_RB_THREAD_BLOCKING_REGION\"
The problem is in the extconf/mkmf section:
rb_thread_blocking_region()... no
But Ruby 1.9.2 defines rb_thread_blocking_region (unless you built Ruby
with some funky set of ifdef's and edits I'm not aware of).
Check your mkmf.log file. It should show you that Ruby failed
to compile/link the conftest.c file that tests for
rb_thread_blocking_region. The reason why is that libcrypt.a
has a dependency on libfreebl3, but the library isn't getting
referenced on the link line.
I fixed the problem by editing /usr/local/lib/ruby/1.9.1/i686-linux/rbconfig.rb like so:
- CONFIG["LIBS"] = "-lpthread -lrt -ldl -lcrypt -lm "
+ CONFIG["LIBS"] = "-lpthread -lrt -ldl -lcrypt -lfreebl3 -lm "
I was able to build the mysql2 gem after. No need to install rvm, etc.
What I did to fix it was to re-install Ruby via RVM. There no more errors after that.
Alternatively, remove the block in client.h that is trying to emulate rb_thread_blocking_region for Ruby 1.8 and you'll be good to go.

Resources