Bug 237410

Summary: databases/ruby-bdb: update to default ruby25 breaks ruby-bdb
Product: Ports & Packages Reporter: Marco Beishuizen <mbeis>
Component: Individual Port(s)Assignee: Akinori MUSHA <knu>
Status: In Progress ---    
Severity: Affects Many People CC: fabian, meta, mfechner, ml, ume, w.schwarzenfeld
Priority: --- Keywords: needs-qa, regression
Version: LatestFlags: bugzilla: maintainer-feedback? (knu)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233901
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237421
Attachments:
Description Flags
Patch to fix build ruby-bdb with ruby25
none
Patch to fix build ruby-bdb with ruby25 #2 none

Description Marco Beishuizen 2019-04-20 10:44:41 UTC
Today the default version of Ruby changed to 2.5. Following the instructions in /usr/ports/UPDATING results in an error:

...
===>  Staging for portupgrade-2.4.16,2
===>   portupgrade-2.4.16,2 depends on file: /usr/local/bin/ruby25 - found
===>   portupgrade-2.4.16,2 depends on file: /usr/local/lib/ruby/site_ruby/2.5/amd64-freebsd12/bdb.so - not found
===>  ruby25-bdb-0.6.6_5 is marked as broken: does not build with Ruby 2.5.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/ruby-bdb
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/ports-mgmt/portupgrade
*** Error code 1
...

Anyone know how to solve this?

Thanks in advance & Regards,
Marco
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-20 10:47:13 UTC
CC committer of ports r499391
Comment 2 Hajimu UMEMOTO freebsd_committer 2019-04-20 12:13:37 UTC
Created attachment 203826 [details]
Patch to fix build ruby-bdb with ruby25

How about this patch?
Comment 3 Fabian Wenk 2019-04-20 14:15:41 UTC
The patch did work on two of my systems with FreeBSD 11.2-RELEASE-p9 / amd64.
Comment 4 Koichiro Iwao freebsd_committer 2019-04-20 14:20:30 UTC
(In reply to Hajimu UMEMOTO from comment #2)
Let's ship it to upstream rather than patching in ports.
Comment 5 Marco Beishuizen 2019-04-20 14:41:21 UTC
The patch doesn't work here on 12.0-STABLE:

...
/usr/local/include/ruby-2.5/ruby/ruby.h:2206:6: note: expanded from macro 'rb_sc                                                                                      an_args_count_hash'                                                                                                                                         
     rb_scan_args_count_block(fmt, ofs, varc, vari) : \                                                                                                               
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                   
/usr/local/include/ruby-2.5/ruby/ruby.h:2201:6: note: expanded from macro 'rb_sc                                                                                      an_args_count_block'                                                                                                                                            
     rb_scan_args_count_end(fmt, ofs, varc, vari) : \                                                                                                                 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                     
/usr/local/include/ruby-2.5/ruby/ruby.h:2197:12: note: expanded from macro 'rb_s                                                                                      can_args_count_end'                                                                                                                                         
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))                                                                                                              
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                               
common.c:4227:12: warning: division by zero is undefined [-Wdivision-by-zero]                                                                                         
    switch(rb_scan_args(argc, argv, "02", &iov, &flagv)) {                                                                                                            
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                               
/usr/local/include/ruby-2.5/ruby/ruby.h:2182:9: note: expanded from macro 'rb_sc                                                                                      an_args'                                                                                                        
        rb_scan_args0(argc,argvp,fmt,\                                                                                                                                
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                
/usr/local/include/ruby-2.5/ruby/ruby.h:2355:9: note: expanded from macro 'rb_sc                                                                                      an_args0'                                                                                                           
                     (rb_scan_args_verify(fmt, varc), vars))                                                                                                          
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                  
/usr/local/include/ruby-2.5/ruby/ruby.h:2240:11: note: expanded from macro 'rb_s                                                                                      can_args_verify'                                                                                                                                
        verify = rb_scan_args_verify_count(fmt, varc); \                                                                                                              
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                 
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see                                                                                       all)                                                                                            
/usr/local/include/ruby-2.5/ruby/ruby.h:2206:6: note: expanded from macro 'rb_sc                                                                                      an_args_count_hash'                                                                                                                                         
     rb_scan_args_count_block(fmt, ofs, varc, vari) : \                                                                                                               
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.5/ruby/ruby.h:2201:6: note: expanded from macro 'rb_sc                                                                                      an_args_count_block'                                                                                                                                            
     rb_scan_args_count_end(fmt, ofs, varc, vari) : \                                                                                                                 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                     
/usr/local/include/ruby-2.5/ruby/ruby.h:2197:12: note: expanded from macro 'rb_s                                                                                      can_args_count_end'                                                                                                                                         
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))                                                                                                              
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                               
common.c:4227:12: warning: division by zero is undefined [-Wdivision-by-zero]                                                                                         
    switch(rb_scan_args(argc, argv, "02", &iov, &flagv)) {                                                                                                            
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                               
/usr/local/include/ruby-2.5/ruby/ruby.h:2182:9: note: expanded from macro 'rb_sc                                                                                      an_args'                                                                                                        
        rb_scan_args0(argc,argvp,fmt,\
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.5/ruby/ruby.h:2355:9: note: expanded from macro 'rb_scan_args0'
                     (rb_scan_args_verify(fmt, varc), vars))
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.5/ruby/ruby.h:2240:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/local/include/ruby-2.5/ruby/ruby.h:2206:6: note: expanded from macro 'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.5/ruby/ruby.h:2201:6: note: expanded from macro 'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.5/ruby/ruby.h:2197:12: note: expanded from macro 'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 warnings and 8 errors generated.
*** [common.o] Error code 1

make[3]: stopped in /usr/ports/databases/ruby-bdb/work/bdb-0.6.6/src
2 errors
...
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-04-20 15:23:32 UTC
cannot imagine, I think there is something goin wrong to apply the patch.

Working fine here on 11.2 amd64 and there are the same header files.

Only exception, with DOCS=on
ram/usr/ports/databases/ruby-bdb/work/stage/usr/local/lib/ruby/site_ruby/2.5/amd64-freebsd11/bdb.so
/bin/mkdir -p 
/ram/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby25/bdb/doc
(cd /ram/usr/ports/databases/ruby-bdb/work/bdb-0.6.6 && install  -m 0644 
Changes README.en bdb.rd docs/*.rd 
/ram/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby25/bdb)
(cd /ram/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc && /bin/sh 
-c '(/usr/bin/find -Ed $1 $3 | /usr/bin/cpio -dumpl $2 >/dev/null 2>&1) 
&&  /usr/bin/find -Ed $1 $3 \(   -type d -exec /bin/sh -c '\''cd 
'\''$2'\'' && chmod 755 "$@"'\'' . {} +  -o -type f -exec /bin/sh -c 
'\''cd '\''$2'\'' && chmod 0644 "$@"'\'' . {} + \)' COPYTREE_SHARE . 
/ram/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby25/bdb/doc)
cd: /ram/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc: No such 
file or directory
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/databases/ruby-bdb
*** Error code 1


I think it is needed to change in the Makefile

68         (cd ${WRKSRC}/docs/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/doc)

to

68         (cd ${WRKSRC}/docs && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/doc)
Comment 7 Hajimu UMEMOTO freebsd_committer 2019-04-20 16:38:22 UTC
(In reply to Koichiro Iwao from comment #4)
Sure, it should be.
However, the owner of the upstream is the port maintainer. :-)
Comment 8 Hajimu UMEMOTO freebsd_committer 2019-04-20 16:44:00 UTC
(In reply to Marco Beishuizen from comment #5)
Unfortunately, I cannot reproduce your problem on my 13-CURRENT, 12-STABLE and 11-STABLE boxes. 
Perhaps, it is another issue.
Comment 9 Hajimu UMEMOTO freebsd_committer 2019-04-20 17:18:56 UTC
Created attachment 203833 [details]
Patch to fix build ruby-bdb with ruby25 #2

(In reply to w.schwarzenfeld from comment #6)
The work/bdb-0.6.6/docs/doc has to be made by rdoc through build.
I suspect that it fails to make due to lack of /usr/local/bin/rdoc on your box.
I think the following change to Makefile fixes your issue:

Index: Makefile
===================================================================
--- Makefile	(revision 499424)
+++ Makefile	(working copy)
@@ -23,5 +21,5 @@
 USE_RUBY=		yes
 USE_RUBY_EXTCONF=	yes
-MAKE_ENV+=		RUBY_RDOC=${LOCALBASE}/bin/rdoc
+USE_RUBY_RDOC=		yes
 
 ALL_TARGET=	all rdoc

I remade a patch which includes this chunk.
Comment 10 Marco Beishuizen 2019-04-20 17:20:17 UTC
After deleting, reinstalling and cleaning all relevant ports, the patch works and ruby-bdb builds fine. Portupgrade too.

So thanks for the help!

Regards,
Marco
Comment 11 Walter Schwarzenfeld freebsd_triage 2019-04-20 17:30:48 UTC
(In reply to Hajimu UMEMOTO from comment #9)
Yes, this solves the "problem" with DOC.
Comment 12 Matthias Fechner freebsd_committer 2019-04-20 19:45:58 UTC
I just testbuild the patch.
Comment 13 commit-hook freebsd_committer 2019-04-20 19:55:58 UTC
A commit references this bug:

Author: mfechner
Date: Sat Apr 20 19:55:09 UTC 2019
New revision: 499463
URL: https://svnweb.freebsd.org/changeset/ports/499463

Log:
  Fix build problem with ruby 2.5.
  This patch should be included upstream.

  PR:		237410
  Submitted by:	ume@
  Reported by:	mbeis@xs4all.nl
  Reviewed by:	mbeis@xs4all.nl, w.schwarzenfeld@utanet.at

Changes:
  head/databases/ruby-bdb/Makefile
  head/databases/ruby-bdb/files/patch-src-common.c
  head/databases/ruby-bdb/files/patch-src-cursor.c
  head/databases/ruby-bdb/files/patch-src-recnum.c
Comment 14 Matthias Fechner freebsd_committer 2019-04-20 19:57:02 UTC
Patch is fine, I committed it now to unbreak portupgrade users.

Could you please try to get this upstream patched?
Thanks a lot.
Comment 15 Koichiro Iwao freebsd_committer 2019-04-21 03:09:58 UTC
maintainer is upstream developer. I hope he apply numbers of ports local patches to upstream.