Project

General

Profile

Actions

Bug #13496

closed

Patches for MinGW builds - gnu_printf in 'config' & defines.h

Added by MSP-Greg (Greg L) over 7 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-01-20 trunk 61983) [x64-mingw32]
[ruby-core:80832]

Description

Thanks to Nobu for 58448, which led me to the probable cause of many (but not all) of the silent SEGV's I was having in test-all, which is the patch of defines.h.

Since appveyor is currently broken, and I'm not a *nix guy, does anyone know if the following two patches will break travis or appveyor? Or, a better way to do it?

These are the only two patches I have on the 'build' side. The other patches are only for test-all. I believe these should probably be backported to 2.4. Thank you.

--- a/configure.in	Wed Apr 19 14:58:48 2017
+++ configure.in	Thu Apr 20 13:44:41 2017
@@ -1319,6 +1319,7 @@
 		])
 		AC_CHECK_TYPE([NET_LUID], [], [],
 			      [@%:@include <winsock2.h>
+			      @%:@include <windows.h>
 			      @%:@include <iphlpapi.h>])
 		if test x"$ac_cv_type_NET_LUID" = xyes; then
 		    AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
@@ -1657,8 +1658,13 @@
             [@%:@include <stdio.h>
 	    @%:@include <stddef.h>
             @%:@ifdef __GNUC__
+            @%:@ifdef __MINGW32__
+            @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
+              decl __attribute__((format(gnu_printf, string_index, first_to_check)))
+            @%:@else
             @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
               decl __attribute__((format(printf, string_index, first_to_check)))
+            @%:@endif
             @%:@else
             @%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
             @%:@endif

and

--- a/include/ruby/defines.h	Thu Apr 20 18:58:40 2017
+++ b/include/ruby/defines.h	Sat Apr 22 17:08:33 2017
@@ -83,8 +83,13 @@
 #endif /* __GNUC__ >= 3 */
 
 #ifdef __GNUC__
+#ifdef __MINGW32__
+#define PRINTF_ARGS(decl, string_index, first_to_check) \
+  decl __attribute__((format(gnu_printf, string_index, first_to_check)))
+#else
 #define PRINTF_ARGS(decl, string_index, first_to_check) \
   decl __attribute__((format(printf, string_index, first_to_check)))
+#endif
 #else
 #define PRINTF_ARGS(decl, string_index, first_to_check) decl
 #endif


Files

tool-m4-ruby_check_printf_prefix.m4.patch (934 Bytes) tool-m4-ruby_check_printf_prefix.m4.patch MSP-Greg (Greg L), 01/20/2018 04:23 PM
gnu_printf.patch (1.42 KB) gnu_printf.patch MSP-Greg (Greg L), 01/20/2018 04:24 PM

Updated by MSP-Greg (Greg L) over 7 years ago

Just noticed the 2nd line of the 1st patch should be --

+++ b/configure.in  Thu Apr 20 13:44:41 2017

Updated by hsbt (Hiroshi SHIBATA) over 7 years ago

Hi, Greg.

Thanks always about MinGW.

Can you give instructions to build your MinGW environment on Windows?
I will prepare MinGW environment for build ruby source.

Updated by MSP-Greg (Greg L) over 7 years ago

Good evening Hiroshi,

I've been thinking of putting it on GitHub, but I've been dividing my OSS time between it and my doc site.

I'll try to get something by Sunday or earlier. It will probably require some setup/editing of config files, but once that's done, set the ruby repo to wherever, click a cmd file and it builds. I've got to

It will require msys2/MinGW and and three packages I created (OpenSSL, GDBM, and LibYAML). I'll upload them to bintray or add them as release files. For the time being, I'll just upload the 64 bit.

Updated by MSP-Greg (Greg L) over 7 years ago

Hiroshi,

Good morning.

Definitely pre-release. See ruby-loco.

Re pgp, I haven't worked with it much. My KeyID is 77D8FA18. I don't recall whether you need that or the truncated public key. My info can be found at sks under MSP-Greg.

Looking forward to hearing your results. I hope the README is clear...

This morning's build -

16632 tests, 2227872 assertions, 8 failures, 1 errors, 114 skips
ruby 2.5.0dev (2017-04-28 trunk 58501) [x64-mingw32]

Thanks again.

Updated by MSP-Greg (Greg L) over 7 years ago

Hiroshi,

Today, I updated ruby-loco to work with current builds.

I've added a page to my doc site, Ruby MinGW test-all, it contains a brief summary of test results for several (but not all) builds.

For several builds, things have stayed at 8 failures, 1 error, and approx 85 skips. I'm not sure why, but total 'assertions' seems to jump around quite a bit.

Recently, I took the make -j argument to 1 when I had some build issues. I need to raise it back up to 3 and check results...

If others can confirm that builds and test-all are stable, maybe you and the other contributors can take a look at whether the required patches can be corrected, and also determine if the failures/errors can (or should) be fixed, or whether the assertions/tests should be considered 'skips'.

Thanks always about MinGW.

Considering that I don't have the knowledge to really determine what is causing these issues, thank you (and the other Core contributors) for helping with my semi-educated guesses...

Updated by MSP-Greg (Greg L) almost 7 years ago

Since I've been building trunk, the gnu_printf patch has moved from

Configure.in -> Configure.ac -> tool/m4/ruby_check_printf_prefix.m4

Given that both ruby-loco and RubyInstaller2 use a patch for this, it would certainly be helpful to have added integrated in trunk.

I've attached the two patch files I use for this, currently the configure.ac hunk in gnu_printf.patch isn't used.

From time to time, I've been able to manually 'bisect' issues with the ruby-loco builds. Sometimes it's for stable gems (tested infrequently) that don't pass trunk, other times it been for bugs in recent releases, link 2.5.x.

I'm about to redo the patch system because to handle this patch requires it being aware of both major/minor/tiny and the svn. Current system is only major/minor/tiny aware.

Thanks, Greg

Actions #7

Updated by MSP-Greg (Greg L) almost 7 years ago

  • Subject changed from Patches for MinGW builds to Patches for MinGW builds - gnu_printf in 'config' & defines.h
Actions #8

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r64620.


Declare as gnu_printf on mingw

[Bug #13496]

From: MSP-Greg

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0