Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-4841

Subversion fails to compile with ruby-2.7

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.13.0
    • 1.14.0
    • bindings_swig_ruby
    • None
    • Arch Linux with ruby 2.7

    Description

      I am trying to compile subversion with ruby-2.7 and there is an issue:

       

      first there is a suspicious compiler warning:

      gcc: error: unrecognized command line option ‘-prefer-pic’
      [root@wolf subversion-1.13.0]# gcc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -pthread -Wno-int-to-pointer-cast -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/build/subversion/src/subversion-1.13.0/subversion -I/build/subversion/src/subversion-1.13.0/subversion/include -I/build/subversion/src/subversion-1.13.0/subversion/bindings/swig -I/build/subversion/src/subversion-1.13.0/subversion/bindings/swig/include -I/build/subversion/src/subversion-1.13.0/subversion/bindings/swig/proxy -I/build/subversion/src/subversion-1.13.0/subversion/bindings/swig/proxy -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/include -I. -I/usr/include/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0/x86_64-linux -I/build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/libsvn_swig_ruby -c -o subversion/bindings/swig/ruby/svn_client.lo subversion/bindings/swig/ruby/svn_client.c
      subversion/bindings/swig/ruby/svn_client.c: In function ‘SWIG_Ruby_ConvertPtrAndOwn’:
      subversion/bindings/swig/ruby/svn_client.c:1666:13: warning: implicit declaration of function ‘assert’ [-Wimplicit-function-declaration]
       1666 | assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
       | ^~~~~~
      subversion/bindings/swig/ruby/svn_client.c:1394:1: note: ‘assert’ is defined in header ‘<assert.h>’; did you forget to ‘#include <assert.h>’?
       1393 | #include "assert.h"
       +++ |+#include <assert.h>
       1394 |

       

      Then ruby tests fail:

      /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': /build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/libsvn_swig_ruby/.libs/libsvn_swig_ruby-1.so.0: undefined symbol: assert - /build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/.ext/svn/ext/core.so (LoadError)
      	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
      	from /build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/svn/error.rb:21:in `<top (required)>'
      	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
      	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
      	from /build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/svn/core.rb:25:in `<top (required)>'
      	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
      	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
      	from /build/subversion/src/subversion-1.13.0/subversion/bindings/swig/ruby/test/run-test.rb:47:in `<main>'
      make: *** [Makefile:962: check-swig-rb] Error 1

       

      After some debugging I found that ruby-2.7 introduced a new file under '/usr/include/ruby-2.7.0/ruby/assert.h' and subversion build includes path '/usr/include/ruby-2.7.0/' before standard includes path. Thus ruby's version of "assert.h" gets included and it contains no definition of assert() function.

       

      Is it something you can fix?

       

      I feel that /usr/include/ruby-2.7.0/ include path should be enough for subversion. No need to include /usr/include/ruby-2.7.0/ruby and /usr/include/ruby-2.7.0/backward in build/ac-macros/swig.m4

          AC_CACHE_CHECK([for Ruby include path], [svn_cv_ruby_includes],[
          if test -d "$rbconfig_rubyhdrdir"; then
            dnl Ruby >=1.9
            svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir -I$rbconfig_rubyhdrdir/ruby -I$rbconfig_rubyhdrdir/ruby/backward"
            if test -d "$rbconfig_rubyarchhdrdir"; then
              dnl Ruby >=2.0
              svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir"
            else
              svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch"
            fi
          else
            dnl Ruby 1.8
            svn_cv_ruby_includes="-I. -I$rbconfig_archdir"
          fi
          ])
      

      Attachments

        Activity

          People

            jamessan James McCoy
            anatolikus Anatol Pomozov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: