Issue #10796 has been updated by Jon Forums.


Usaku NAKAMURA wrote:
> Jon Forums wrote:
> > Bigdecimal 1.2.6 installs fine in 64bit 2.1.5p277 on my ubuntu server 14.10 x64 vm.
> 
> Perhaps the installation was successful, but merely error has been delayed until run time :-P
> 
> rb_rational_num() and rb_rational_dem() are new APIs from 2.2.
> So, Bigdecimal gem 1.2.6 **never** works with ruby 2.1 or earlier.

:) I also thought Bigdecimal 1.2.6 should fail with 2.1.x due to using 2.2 APIs. I expected the following quicktest to fail, but oddly it worked. Perhaps the quicktest is too simple and fails to exercise the correct code path at runtime. Strange. I didn't see any win vs. nix #ifdef issues in bigdecimal.{c,h} but did not investigate ruby's main headers or configure.in.

~~~
jon@ubusvr64:~$ uname -a
Linux ubusvr64 3.16.0-29-generic #39-Ubuntu SMP Mon Dec 15 22:27:29 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

jon@ubusvr64:~$ gem li bigdecimal

*** LOCAL GEMS ***

bigdecimal (1.2.6)

jon@ubusvr64:~$ ruby --version
ruby 2.1.5p277 (2015-01-06 revision 49158) [x86_64-linux]

jon@ubusvr64:~$ irb -rbigdecimal
irb(main):001:0> BigDecimal.new('-1.0') / BigDecimal.new('0.0')
=> #<BigDecimal:21e2600,'-Infinity',9(36)>
~~~

Regardless, the 1.2.7 gem installs OK on win8.1 x64 in these 32bit rubies using mingw-w64 gcc 4.9.2

~~~
C:\Users\Jon\Documents\RubyDev\ruby-git>uru gem li bigdecimal

ruby 2.0.0p617 (2015-01-22 revision 49382) [i386-mingw32]

*** LOCAL GEMS ***

bigdecimal (1.2.7)


ruby 2.2.0p36 (2015-01-22 revision 49375) [i386-mingw32]

*** LOCAL GEMS ***

bigdecimal (1.2.7, 1.2.6)



ruby 2.1.5p285 (2015-01-22 revision 49383) [i386-mingw32]

*** LOCAL GEMS ***

bigdecimal (1.2.7)
~~~

Bigdecimal 1.2.7 gem also installs OK on my arch 3.18.4-1 x64 (mri 2.2.0p37) and ubuntu server 14.10 x64 (mri 2.1.5p77) systems.

----------------------------------------
Bug #10796: bigdecimal gem update error
https://bugs.ruby-lang.org/issues/10796#change-51294

* Author: Emanuel D
* Status: Assigned
* Priority: Normal
* Assignee: Yui NARUSE
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
----------------------------------------
```winbatch
C:\Zend\Apache2\htdocs\u3c>gem update
Updating installed gems
Updating bigdecimal
Building native extensions.  This could take a while...
ERROR:  Error installing bigdecimal:
        ERROR: Failed to build gem native extension.

    C:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150128-10504-1w9xw9b.rb extconf.rb
checking for labs() in stdlib.h... yes
checking for llabs() in stdlib.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating bigdecimal-x64-mingw32.def
compiling bigdecimal.c
bigdecimal.c: In function 'GetVpValueWithPrec':
bigdecimal.c:238:6: warning: implicit declaration of function 'rb_rational_num' [-Wimplicit-function-declaration]
bigdecimal.c:242:6: warning: implicit declaration of function 'rb_rational_den' [-Wimplicit-function-declaration]
linking shared-object bigdecimal.so
bigdecimal.o: In function `is_zero':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2126: undefined reference to `rb_rational_num'
bigdecimal.o: In function `is_one':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2149: undefined reference to `rb_rational_num'
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2150: undefined reference to `rb_rational_den'
bigdecimal.o: In function `GetVpValueWithPrec':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:238: undefined reference to `rb_rational_num'
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:242: undefined reference to `rb_rational_den'
bigdecimal.o: In function `BigMath_s_log':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2924: undefined reference to `rb_rational_num'
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2924: undefined reference to `rb_rational_num'
bigdecimal.o: In function `BigDecimal_power':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2256: undefined reference to `rb_rational_num'
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2262: undefined reference to `rb_rational_den'
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2263: undefined reference to `rb_rational_num'
bigdecimal.o: In function `is_zero':
C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\bigdecimal-1.2.6/bigdecimal.c:2126: undefined reference to `rb_rational_num'
collect2.exe: error: ld returned 1 exit status
make: *** [bigdecimal.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bigdecimal-1.2.6 for inspection.
Results logged to C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/bigdecimal-1.2.6/gem_make.out
Updating psych
Fetching: psych-2.0.12.gem (100%)
Building native extensions.  This could take a while...
Successfully installed psych-2.0.12
Parsing documentation for psych-2.0.12
Installing ri documentation for psych-2.0.12
Installing darkfish documentation for psych-2.0.12
Done installing documentation for psych after 2 seconds
Parsing documentation for psych-2.0.12
Done installing documentation for psych after 1 seconds
Gems updated: bigdecimal psych

C:\Zend\Apache2\htdocs\u3c>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby21-x64/lib/ruby/gems/2.1.0
  - RUBY EXECUTABLE: C:/Ruby21-x64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby21-x64/bin
  - SPEC CACHE DIRECTORY: C:/Users/Emanuel/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Ruby21-x64/lib/ruby/gems/2.1.0
     - C:/Users/Emanuel/.gem/ruby/2.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - c:\DevKit\bin
     - c:\DevKit\mingw\bin
     - C:\Program Files\ConEmu\ConEmu
     - C:\Program Files\ConEmu
     - C:\ProgramData\Oracle\Java\javapath
     - C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
     - C:\Windows\system32
     - C:\Windows
     - C:\Windows\System32\Wbem
     - C:\Windows\System32\WindowsPowerShell\v1.0\
     - C:\Program Files (x86)\MySQL\MySQL Utilities\
     - C:\Program Files (x86)\MySQL\MySQL Utilities\Doctrine extensions for PHP\
     - C:\Windows\System32\WindowsPowerShell\v1.0\
     - C:\Zend\ZendServer\share\ZendFramework\bin
     - C:\Zend\ZendServer\bin
     - C:\Program Files\TortoiseHg\
     - C:\ProgramData\ComposerSetup\bin
     - C:\Program Files (x86)\Git\cmd
     - C:\nodejs\
     - C:\Ruby21-x64\bin
     - C:\ProgramData\chocolatey\bin
     - C:\Users\Emanuel\AppData\Roaming\npm

C:\Zend\Apache2\htdocs\u3c>
```

I also opened this: https://github.com/rubygems/rubygems/issues/1155
but I was told to come here.

---Files--------------------------------
bigdecimal-10796.patch (526 Bytes)


-- 
https://bugs.ruby-lang.org/