# \`make check' hangs, when the source directory is read-only

**URL:** <https://www.ruby-forum.com/t/make-check-hangs-when-the-source-directory-is-read-only/177607>\
**Category:** Ruby\
**Created:** [October 20, 2009, 10:21pm UTC](https://www.ruby-forum.com/t/make-check-hangs-when-the-source-directory-is-read-only/177607 "2009-10-20T22:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e274bd/32.png) [@kot](https://www.ruby-forum.com/u/kot)\
**Post date:** [October 20, 2009, 10:21pm UTC](https://www.ruby-forum.com/t/make-check-hangs-when-the-source-directory-is-read-only/177607/1 "2009-10-20T22:21:54Z")

</div>

Hello!

I’m building platform-specific Ruby-binaries (1.8.7-p174) for each of  
our several platforms based on a single source-code directory, that’s  
available read-only.

The build is fine (except in the win32ole directory, which I had to  
remove). `make test’ succeeds:

# :/tmp/ruby-1.8.7-p174-x86\_64-pc-linux-gnu (203) make test

test succeeded

However, when I try to `make check’, I get:

# :/tmp/ruby-1.8.7-p174-x86\_64-pc-linux-gnu (204) make check

test succeeded  
./miniruby -I/src/PUBruby/ruby-1.8.7-p174/lib -I.ext/common -I./-  
-r/src/PUBruby/ruby-1.8.7-p174/ext/purelib.rb  
/src/PUBruby/ruby-1.8.7-p174/runruby.rb --extout=.ext –  
“/src/PUBruby/ruby-1.8.7-p174/test/runner.rb”  
–basedir="/src/PUBruby/ruby-1.8.7-p174/test" --runner=console

Launching `top’ in another window I can see the ruby process spinning…  
I left it running for 3 hours, and it accumulated 3 hours of CPU time…

Please, advise. Thanks!

---

<div class="post-metadata">

**Author:** ![kot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e274bd/32.png) [@kot](https://www.ruby-forum.com/u/kot)\
**Post date:** [October 20, 2009, 11:26pm UTC](https://www.ruby-forum.com/t/make-check-hangs-when-the-source-directory-is-read-only/177607/2 "2009-10-20T23:26:31Z")

</div>

> I’m building platform-specific Ruby-binaries (1.8.7-p174) for each of  
> our several platforms based on a single source-code directory, that’s  
> available read-only.

Actually, never mind… Something else must be wrong. I copied the  
source tree locally and ran the build there – the most vanilla way to  
build things.

`make check’ – as well as a single random test – still spins…

Running under strace shows:

strace ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  
./runruby.rb --extout=.ext – “./test/runner.rb” --basedir="./test"  
test/soap/test\_basetype.rb  
…  
lots of output  
…  
open("/tmp/ruby-1.8.7-p174-x86\_64-pc-linux-gnu/test/soap/test\_basetype.rb",  
O\_RDONLY) = 3  
fstat(3, {st\_mode=S\_IFREG|0644, st\_size=27077, …}) = 0  
close(3) = 0  
rt\_sigprocmask(SIG\_BLOCK, NULL, [], 8) = 0  
open("/tmp/ruby-1.8.7-p174-x86\_64-pc-linux-gnu/test/soap/test\_basetype.rb",  
O\_RDONLY) = 3  
close(3) = 0  
open("/tmp/ruby-1.8.7-p174-x86\_64-pc-linux-gnu/test/soap/test\_basetype.rb",  
O\_RDONLY) = 3  
fstat(3, {st\_mode=S\_IFREG|0644, st\_size=27077, …}) = 0  
mmap(NULL, 4096, PROT\_READ|PROT\_WRITE, MAP\_PRIVATE|MAP\_ANONYMOUS, -1, 0)  
= 0x2b1f51586000  
read(3, “require ‘test/unit’\nrequire 'soa”…, 4096) = 4096  
read(3, “34567890123456789012345678901234”…, 4096) = 4096  
\<- HANG -\>

This is on an RHEL-5.4 machine (RedHat’s own older version of Ruby NOT  
installed), x86\_64. The configure was run thus:

env CC=gcc44 CFLAGS="-O2 -pipe -march=nocona" ./configure  
–prefix=/usr/local/pub/ruby\_\_1.8.7-p174  
–mandir=/usr/local/pub/ruby\_\_1.8.7-p174/man --enable-pthread  
–disable-install-doc

The C-compiler (gcc44) is gcc version 4.4.0 20090514 (Red Hat 4.4.0-6)  
(GCC).

---

<div class="post-metadata">

**Author:** ![kot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e274bd/32.png) [@kot](https://www.ruby-forum.com/u/kot)\
**Post date:** [October 21, 2009, 5:31pm UTC](https://www.ruby-forum.com/t/make-check-hangs-when-the-source-directory-is-read-only/177607/3 "2009-10-21T17:31:21Z")

</div>

ÐœÑ–Ñ…Ð°Ñ–Ð» Ð¢. wrote:

> The C-compiler (gcc44) is gcc version 4.4.0 20090514 (Red Hat 4.4.0-6)  
> (GCC).

Simply recompiling from scratch using gcc-4.1.2 solved the hanging  
problem for me. The check is now running (outputting a dot as  
progress-report).

Alternatively, using gcc-4.4.0, but with less aggressive optimization  
(-O1 instead of -O2) avoids the problem as well.

Increasing the compiler warnings level (-Wall), one can see a lot of  
negative comments, including a bunch of strict-aliasing violations…

Indeed, this was is already discussed in:

[https://bugzilla.redhat.com/show\_bug.cgi?id=489990](https://bugzilla.redhat.com/show_bug.cgi?id=489990)

The bug is in Ruby…

The work-around is to disable strict-aliasing, when compiling. For gcc  
users, this is done with -fno-strict-aliasing after the -O2 optimization  
flag (see attached patch).

After rebuilding this way, I can get `make check’ to start and proceed  
(the errors it reports now are the same as with other compilers and  
platforms).

Other (non-gcc) compilers are on their own…

```
    -mi

```
