From: Jarmo Pertman on
i executed make test and it seems that some of the tests are also
failing:
jarmo(a)jarmo-laptop:~/Downloads/ruby-1.8.6-p399$ make test
not ok float 1 -- ./sample/test.rb:1172
not ok float 2 -- ./sample/test.rb:1173
not ok float 3 -- ./sample/test.rb:1174
not ok float 4 -- ./sample/test.rb:1175
not ok float 5 -- ./sample/test.rb:1176
not ok float 6 -- ./sample/test.rb:1177
not ok float 7 -- ./sample/test.rb:1178
not ok float 8 -- ./sample/test.rb:1179
not ok float 9 -- ./sample/test.rb:1180
test failed
make: *** [test] Error 1


# test.rb
1172 test_ok(2.6.floor == 2)
1173 test_ok((-2.6).floor == -3)
1174 test_ok(2.6.ceil == 3)
1175 test_ok((-2.6).ceil == -2)
1176 test_ok(2.6.truncate == 2)
1177 test_ok((-2.6).truncate == -2)
1178 test_ok(2.6.round == 3)
1179 test_ok((-2.4).truncate == -2)
1180 test_ok((13.4 % 1 - 0.4).abs < 0.0001)

Is there any special switches or commands i should use while compiling?

Jarmo
--
Posted via http://www.ruby-forum.com/.

From: Robert Klemme on
On 30.05.2010 02:34, Jarmo Pertman wrote:
> i executed make test and it seems that some of the tests are also
> failing:
> jarmo(a)jarmo-laptop:~/Downloads/ruby-1.8.6-p399$ make test
> not ok float 1 -- ./sample/test.rb:1172
> not ok float 2 -- ./sample/test.rb:1173
> not ok float 3 -- ./sample/test.rb:1174
> not ok float 4 -- ./sample/test.rb:1175
> not ok float 5 -- ./sample/test.rb:1176
> not ok float 6 -- ./sample/test.rb:1177
> not ok float 7 -- ./sample/test.rb:1178
> not ok float 8 -- ./sample/test.rb:1179
> not ok float 9 -- ./sample/test.rb:1180
> test failed
> make: *** [test] Error 1
>
>
> # test.rb
> 1172 test_ok(2.6.floor == 2)
> 1173 test_ok((-2.6).floor == -3)
> 1174 test_ok(2.6.ceil == 3)
> 1175 test_ok((-2.6).ceil == -2)
> 1176 test_ok(2.6.truncate == 2)
> 1177 test_ok((-2.6).truncate == -2)
> 1178 test_ok(2.6.round == 3)
> 1179 test_ok((-2.4).truncate == -2)
> 1180 test_ok((13.4 % 1 - 0.4).abs< 0.0001)
>
> Is there any special switches or commands i should use while compiling?
>
> Jarmo

If you are compiling from source anyway I'd probably switch to 1.8.7.
You could also check [1] to see whether it's a known bug already.

Cheers

robert

[1] http://redmine.ruby-lang.org/projects/show/ruby-186

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
From: KUBO Takehiro on
On Sun, May 30, 2010 at 9:34 AM, Jarmo Pertman <jarmo.p(a)gmail.com> wrote:
> i executed make test and it seems that some of the tests are also
> failing:
> jarmo(a)jarmo-laptop:~/Downloads/ruby-1.8.6-p399$ make test
> not ok float 1 -- ./sample/test.rb:1172
> not ok float 2 -- ./sample/test.rb:1173
> not ok float 3 -- ./sample/test.rb:1174
> not ok float 4 -- ./sample/test.rb:1175
> not ok float 5 -- ./sample/test.rb:1176
> not ok float 6 -- ./sample/test.rb:1177
> not ok float 7 -- ./sample/test.rb:1178
> not ok float 8 -- ./sample/test.rb:1179
> not ok float 9 -- ./sample/test.rb:1180
> test failed
> make: *** [test] Error 1
>
>
> # test.rb
> 1172 test_ok(2.6.floor == 2)
> 1173 test_ok((-2.6).floor == -3)
> 1174 test_ok(2.6.ceil == 3)
> 1175 test_ok((-2.6).ceil == -2)
> 1176 test_ok(2.6.truncate == 2)
> 1177 test_ok((-2.6).truncate == -2)
> 1178 test_ok(2.6.round == 3)
> 1179 test_ok((-2.4).truncate == -2)
> 1180 test_ok((13.4 % 1 - 0.4).abs < 0.0001)
>
> Is there any special switches or commands i should use while compiling?

As far as I checked, ruby_strtod() in util.c is broken by gcc 4.4's
optimization.

1. disable optimization.

./configure
make
vi Makefile # replace -O2 to -O0.
touch util.c # update the timestamp to recompile util.c.
make
sudo make install

2. use gcc-4.3.

sudo apt-get install gcc-4.3
./configure CC=gcc-4.3
make
sudo make install

3. configure with -fno-strict-aliasing and --enable-pthread.
(I don't know why it dismisses the problem...)

./configure CFLAGS='-g -O2 -fno-strict-aliasing' --enable-pthread
make
sudo make install

From: Jarmo Pertman on
By the way, doing every same move with 1.8.7 as i did with 1.8.6 works
indeed:
jarmo(a)jarmo-laptop:~/Downloads/ruby-1.8.7-p249$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]
jarmo(a)jarmo-laptop:~/Downloads/ruby-1.8.7-p249$ ruby -e "require 'date';
puts Date.today"
2010-05-30

But my problem was that i really-really needed 1.8.6, thus trying to
make it work.
But thanks for the tip.

Jarmo

Robert Klemme wrote:
> If you are compiling from source anyway I'd probably switch to 1.8.7.
> You could also check [1] to see whether it's a known bug already.
>
> Cheers
>
> robert
>
> [1] http://redmine.ruby-lang.org/projects/show/ruby-186

--
Posted via http://www.ruby-forum.com/.

From: Jarmo Pertman on
Thank you for this (insight|help)ful reply!

I tried your first suggestion which worked as you said! Then i decided
to downgrade gcc completely and tried your second suggestion which also
worked!

Also make test succeeded (although i tried with latest patchlevel, so
i'm not sure if it was even related with my problem).

But why does 1.8.7 work with gcc 4.4? Is util.c there somehow changed?
So in the end it is a incompatibility problem with Ruby 1.8.6 and gcc
4.4 (which comes by default with latest Ubuntu)?

Anyway, thank You again!

Jarmo

Takehiro Kubo wrote:
> As far as I checked, ruby_strtod() in util.c is broken by gcc 4.4's
> optimization.
>
> 1. disable optimization.
>
> ./configure
> make
> vi Makefile # replace -O2 to -O0.
> touch util.c # update the timestamp to recompile util.c.
> make
> sudo make install
>
> 2. use gcc-4.3.
>
> sudo apt-get install gcc-4.3
> ./configure CC=gcc-4.3
> make
> sudo make install
>
> 3. configure with -fno-strict-aliasing and --enable-pthread.
> (I don't know why it dismisses the problem...)
>
> ./configure CFLAGS='-g -O2 -fno-strict-aliasing' --enable-pthread
> make
> sudo make install

--
Posted via http://www.ruby-forum.com/.