Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112019-03-24T18:02:15ZRuby Issue Tracking System
Redmine Ruby master - Bug #15726 (Closed): Error compiling Rubyhttps://redmine.ruby-lang.org/issues/157262019-03-24T18:02:15Zrobin850 (Robin Dupret)robin.dupret@gmail.com
<p>Hello,</p>
<p>I'm sorry if I'm reporting that to the wrong place but the errors are so meaningless that it's hard to know where the issue really comes from.</p>
<p>Trying to install Ruby by compiling it, several errors happen. The process follows these commands:</p>
<pre><code class="shell syntaxhl" data-language="shell"><span class="nv">$ </span>wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.2.tar.gz
<span class="nv">$ </span><span class="nb">tar</span> <span class="nt">-xvf</span> ruby-2.6.2.tar.gz
<span class="nv">$ </span><span class="nb">cd </span>ruby-2.6.2
<span class="nv">$ </span>./configure
<span class="nv">$ </span>make <span class="nv">V</span><span class="o">=</span>1
</code></pre>
<p>Actually the <code>make</code> task fails. The first time, it fails at the <code>ar</code> step:</p>
<pre><code>Makefile:283: recipe for target 'libruby-static.a' failed
make: *** [libruby-static.a] Interrupt
</code></pre>
<p>Running <code>make</code> in verbose mode show that the error happens running:</p>
<pre><code>ar rcD libruby-static.a dln.o localeinit.o loadpath.o array.o ast.o bignum.o class.o compar.o compile.o complex.o cont.o debug.o debug_counter.o dir.o dln_find.o encoding.o enum.o enumerator.o error.o eval.o file.ogc.o hash.o inits.o io.o iseq.o load.o marshal.o math.o mjit.o mjit_compile.o node.o numeric.o object.o pack.o parse.o proc.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o symbol.o thread.o time.otranscode.o transient_heap.o util.o variable.o version.o vm.o vm_backtrace.o vm_dump.o vm_trace.o coroutine/amd64/Context.o enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o enc/trans/newline.o explicit_bzero.o setproctitle.o strlcat.o strlcpy.o addr2line.o prelude.o dmyext.o dmyenc.o
</code></pre>
<p>Running it manually says :</p>
<pre><code>ar: file.ogc.o: No such file or directory
</code></pre>
<p>And ditto for <code>time.otranscode.o</code> once <code>file.ogc.o</code> has been replaced with <code>file.o</code>. Replacing <code>time.otranscode.o</code> with <code>time.o</code> makes the error go away but running the command for a few seconds, then it exits with <code>Killed</code> but nothing is present in <code>dmesg</code>.</p>
<p>Trying to rerun <code>make</code>, the standard library gets compiled but it fails trying to compile BigDecimal with the following error:</p>
<pre><code>In file included from bigdecimal.c:13:0:
bigdecimal.h:122:1: error: redefinition of 'rb_array_const_ptr'
rb_array_const_ptr(VALUE a)
^~~~~~~~~~~~~~~~~~
In file included from bigdecimal.h:14:0,
from bigdecimal.c:13:
../.././include/ruby/ruby.h:2154:1: note: previous definition of 'rb_array_const_ptr' was here
rb_array_const_ptr(VALUE a)
^~~~~~~~~~~~~~~~~~
In file included from bigdecimal.c:13:0:
bigdecimal.h:139:1: error: static declaration of 'rb_sym2str' follows non-static declaration
rb_sym2str(VALUE sym)
^~~~~~~~~~
In file included from bigdecimal.h:14:0,
from bigdecimal.c:13:
../.././include/ruby/ruby.h:1806:7: note: previous declaration of 'rb_sym2str' was here
VALUE rb_sym2str(VALUE);
^~~~~~~~~~
bigdecimal.c:108:1: error: static declaration of 'rb_rational_num' follows non-static declaration
rb_rational_num(VALUE rat)
^~~~~~~~~~~~~~~
In file included from ../.././include/ruby/ruby.h:2111:0,
from bigdecimal.h:14,
from bigdecimal.c:13:
../.././include/ruby/intern.h:180:7: note: previous declaration of 'rb_rational_num' was here
VALUE rb_rational_num(VALUE rat);
^~~~~~~~~~~~~~~
bigdecimal.c:120:1: error: static declaration of 'rb_rational_den' follows non-static declaration
rb_rational_den(VALUE rat)
^~~~~~~~~~~~~~~
In file included from ../.././include/ruby/ruby.h:2111:0,
from bigdecimal.h:14,
from bigdecimal.c:13:
../.././include/ruby/intern.h:181:7: note: previous declaration of 'rb_rational_den' was here
VALUE rb_rational_den(VALUE rat);
^~~~~~~~~~~~~~~
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1: warning: unrecognized command line option '-Wno-cast-function-type'
Makefile:293: recipe for target 'bigdecimal.o' failed
make[2]: *** [bigdecimal.o] Error 1
make[2]: Leaving directory '/root/ruby-2.6.2/ext/bigdecimal'
exts.mk:189: recipe for target 'ext/bigdecimal/all' failed
make[1]: *** [ext/bigdecimal/all] Error 2
make[1]: Leaving directory '/root/ruby-2.6.2'
uncommon.mk:286: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
</code></pre>
<p>Is that a bug in the compilation process or something I do wrong or missing in my setup ?</p>
<p>System configuration:</p>
<ul>
<li>System: Debian 9.8 Stretch (Linux Kernel 2.6.32)</li>
<li>GCC: 6.3.0 20170516</li>
<li>Make: 4.1</li>
<li>ld: GNU ld (GNU Binutils for Debian) 2.28</li>
<li>OpenSSL : 1.1.0j 20 Nov 2018</li>
<li>Yacc: Bison 3.0.4</li>
</ul>
<p>Thanks for your time !</p> Ruby master - Feature #10108 (Feedback): NameError#name and nested constantshttps://redmine.ruby-lang.org/issues/101082014-08-03T12:43:26Zrobin850 (Robin Dupret)robin.dupret@gmail.com
<p>Hello,</p>
<p>We wanted to bring a discussion around the behavior of NameError#name with nested constants. The result can be quite unexpected when we are dealing with them. For instance:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">begin</span>
<span class="no">Math</span><span class="o">::</span><span class="no">PHI</span>
<span class="k">rescue</span> <span class="no">NameError</span> <span class="o">=></span> <span class="n">e</span>
<span class="n">e</span><span class="p">.</span><span class="nf">name</span> <span class="c1"># => :PHI</span>
<span class="k">end</span>
</code></pre>
<p>Having Math::PHI seems more expected. Rubinius works the same way as MRI while JRuby will return a symbol with the full path (i.e. <code>:"Math::PHI"</code>). Is there any reason why you are returning only the last part of the missing "path" ? At the very least, there is a documentation problem since <code>NameError#name</code>'s documentation states:</p>
<pre><code>name_error.name -> string or nil
</code></pre>
<p>but it always return a symbol.</p>
<p>Have a nice day !</p> Ruby master - Bug #9574 (Closed): Inconsistent behavior between Kernel#Float and to_fhttps://redmine.ruby-lang.org/issues/95742014-02-27T15:13:24Zrobin850 (Robin Dupret)robin.dupret@gmail.com
<p>Hello,</p>
<p>Sorry if this has still been requested, I haven't found anything about this on the tracker. There is an inconsistent behavior between #to_f and Float() with strings. I don't know whether this is intended or not but if it is, there is at least something wrong in Kernel#Float's documentation:</p>
<blockquote>
Numeric types are converted directly, the rest are converted using arg.to_f.
</blockquote>
<pre><code>>> "123.".to_f
=> 123.0
>> Float("123.")
ArgumentError: invalid value for Float(): "123."
from (pry):1:in `Float'
</code></pre>
<p>The issue has been originally reported here <a href="https://github.com/rails/rails/issues/11800" class="external">https://github.com/rails/rails/issues/11800</a>.</p>
<p>Have a nice day.</p> Ruby master - Feature #6596 (Assigned): New method `Array#indexes`https://redmine.ruby-lang.org/issues/65962012-06-15T18:05:05Zrobin850 (Robin Dupret)robin.dupret@gmail.com
<p>I submitted a pull request on Github that provides a new method <code>Array#indexes</code>. It departs from <code>Array#index</code> in such a way that it returns an array of indexes and not the single first occurrence that is relevant.</p>
<p>The reason I want this method is that I don't understand why <code>Array#index</code> returns a single index if the parameter is in the array several times.</p>
<p>Examples</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">a</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
<span class="n">a</span><span class="p">.</span><span class="nf">indexes</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1">#=> [0, 3]</span>
<span class="n">a</span><span class="p">.</span><span class="nf">index</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># => 0</span>
</code></pre>
<p>In my opinion, it's not logical to return only a single index since <code>1</code> is in the array twice.</p>