Character-encodings gem with Ruby 1.9


#1

Hello,

I tried to install Nikolai W.'s Ruby Character Encodings Library
[1] with Ruby 1.9, but didn’t succeed.

$ sudo gem1.9 install character-encodings
Building native extensions. This could take a while…
ERROR: Error installing character-encodings:
ERROR: Failed to build gem native extension.

/opt/local/bin/ruby1.9 extconf.rb install character-encodings
extconf.rb:4: invalid multibyte char
extconf.rb:4: invalid multibyte char
extconf.rb:4: syntax error, unexpected $end, expecting keyword_end
checking_for “‘#{opt}’ option to compiler” do
^
Gem files will remain installed in
/opt/local/lib/ruby/gems/1.9.0/gems/character-encodings-0.4.1 for
inspection.
Results logged to
/opt/local/lib/ruby/gems/1.9.0/gems/character-encodings-0.4.1/ext/encoding/character/utf-8/gem_make.out

I downloaded the gem, extracted it, added a magic comment at the top of
the file and manually called the configure command, that worked.

$ ruby1.9 extconf.rb install character-encodings
checking for ‘-std=c99’ option to compiler… yes
checking for ‘-finline-functions’ option to compiler… yes
checking for ‘-Wall’ option to compiler… yes
checking for ‘-Wextra’ option to compiler… yes
checking for ‘-Wwrite-strings’ option to compiler… yes
checking for ‘-Waggregate-return’ option to compiler… yes
checking for ‘-Wmissing-prototypes’ option to compiler… yes
checking for ‘-Wmissing-declarations’ option to compiler… yes
checking for ‘-Wnested-externs’ option to compiler… yes
checking for ‘-Wundef’ option to compiler… yes
checking for ‘-Wpointer-arith’ option to compiler… yes
checking for ‘-Wcast-align’ option to compiler… yes
checking for ‘-Werror’ option to compiler… yes
checking for ‘-Winline’ option to compiler… yes
checking for assert.h… yes
checking for limits.h… yes
checking for locale.h… yes
checking for stdbool.h… yes
checking for stddef.h… yes
checking for stdint.h… yes
checking for stdio.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for sys/types.h… yes
checking for wchar.h… yes
creating Makefile

But then the make command failed.

$ make
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE_ASSERT_H -DHAVE_LIMITS_H
-DHAVE_LOCALE_H -DHAVE_STDBOOL_H -DHAVE_STDDEF_H -DHAVE_STDINT_H
-DHAVE_STDIO_H -DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_SYS_TYPES_H
-DHAVE_WCHAR_H -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-fno-common -O2 -fno-common -pipe -fno-common -std=c99
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef
-Wpointer-arith -Wcast-align -Werror -Winline -o break.o -c break.c
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE_ASSERT_H -DHAVE_LIMITS_H
-DHAVE_LOCALE_H -DHAVE_STDBOOL_H -DHAVE_STDDEF_H -DHAVE_STDINT_H
-DHAVE_STDIO_H -DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_SYS_TYPES_H
-DHAVE_WCHAR_H -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-fno-common -O2 -fno-common -pipe -fno-common -std=c99
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef
-Wpointer-arith -Wcast-align -Werror -Winline -o decompose.o -c
decompose.c
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE_ASSERT_H -DHAVE_LIMITS_H
-DHAVE_LOCALE_H -DHAVE_STDBOOL_H -DHAVE_STDDEF_H -DHAVE_STDINT_H
-DHAVE_STDIO_H -DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_SYS_TYPES_H
-DHAVE_WCHAR_H -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-fno-common -O2 -fno-common -pipe -fno-common -std=c99
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef
-Wpointer-arith -Wcast-align -Werror -Winline -o private.o -c private.c
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE_ASSERT_H -DHAVE_LIMITS_H
-DHAVE_LOCALE_H -DHAVE_STDBOOL_H -DHAVE_STDDEF_H -DHAVE_STDINT_H
-DHAVE_STDIO_H -DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_SYS_TYPES_H
-DHAVE_WCHAR_H -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-fno-common -O2 -fno-common -pipe -fno-common -std=c99
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef
-Wpointer-arith -Wcast-align -Werror -Winline -o properties.o -c
properties.c
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE_ASSERT_H -DHAVE_LIMITS_H
-DHAVE_LOCALE_H -DHAVE_STDBOOL_H -DHAVE_STDDEF_H -DHAVE_STDINT_H
-DHAVE_STDIO_H -DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_SYS_TYPES_H
-DHAVE_WCHAR_H -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-fno-common -O2 -fno-common -pipe -fno-common -std=c99
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef
-Wpointer-arith -Wcast-align -Werror -Winline -o rb_utf_aref.o -c
rb_utf_aref.c
rb_utf_aref.c:8:16: error: re.h: No such file or directory
cc1: warnings being treated as errors
rb_utf_aref.c: In function ‘rb_str_subpat’:
rb_utf_aref.c:44: warning: implicit declaration of function
‘rb_reg_search’
rb_utf_aref.c:44: warning: nested extern declaration of ‘rb_reg_search’
rb_utf_aref.c: In function ‘rb_utf_aref_default’:
rb_utf_aref.c:65: error: ‘struct RString’ has no member named ‘ptr’
rb_utf_aref.c:65: error: ‘struct RString’ has no member named ‘len’
make: *** [rb_utf_aref.o] Error 1

What can I do to make it work?

Stefan

[1] http://bitwi.se/software/ruby/character-encodings/


#2

On Jul 10, 2008, at 2:17 PM, Stefan S. wrote:

I tried to install Nikolai W.'s Ruby Character Encodings
Library [1] with Ruby 1.9, but didn’t succeed.

Do you know that 1.9 has excellent built-in support for character
encodings?

Dave


#3

I tried to install Nikolai W.'s Ruby Character Encodings
Library [1] with Ruby 1.9, but didn’t succeed.

Do you know that 1.9 has excellent built-in support for character
encodings?

Yes, but String#upcase/downcase doesn’t work for non-ascii strings.

Stefan


#4

In article removed_email_address@domain.invalid,
Dave T. removed_email_address@domain.invalid wrote:

Do you know that 1.9 has excellent built-in support for character
encodings?

Like the OP said, as long as #upcase/#downcase don’t work, I’d not call
that
excellent.

I can certainly understand the constraints of locales/i18n/m17n and the
way
choosen by Matz for Ruby, but I’m getting frustrated by the support (or
more
exactly lack thereof) of Unicode strings.

I’m looking at friends that have chosen Python and while their way may
not be
the Right One (if there is such a way) but they are enjoying it for
common
usage.

For a language that toots POLA as a slogan, Unicode support is certainly
violating every principle there. I’m following 1.9 closely through svn
and
regularely try to use the Unicode support but it is not getting better.

Sorry if it sounds grumpy but I’m getting frustrated by my favorite
language
and am afraid it shows.