Skip to content

Fix m4 on OS X highsierra (allows nettle to build)#8559

Merged
adamjstewart merged 1 commit intospack:developfrom
hartzell:m4-highsierra-fix
Jun 24, 2018
Merged

Fix m4 on OS X highsierra (allows nettle to build)#8559
adamjstewart merged 1 commit intospack:developfrom
hartzell:m4-highsierra-fix

Conversation

@hartzell
Copy link
Copy Markdown
Contributor

m4 exited immediately (causing the nettle build to fail).

(alice)[11:09:46]spack>>/Users/hartzell/tmp/spack-mac/spack/opt/spack/darwin-highsierra-x86_64/clang-9.1.0-apple/m4-1.4.18-caxsf7l5yd7qbq2bown6bzi5el3ltfwf/bin/m4
Abort trap: 6
(alice)[11:10:18]spack>>fg

Tracked down a fix via the Homebrew recipe. I'll send a note to the
[email protected] list to ensure that upstream knows about it.

High Sierra does not seem to need the additional args appended that Sierra does so no changes were necessary in configure_args.

Tested by building nettle.

m4 exited immediately (causing the nettle build to fail).

```
(alice)[11:09:46]spack>>/Users/hartzell/tmp/spack-mac/spack/opt/spack/darwin-highsierra-x86_64/clang-9.1.0-apple/m4-1.4.18-caxsf7l5yd7qbq2bown6bzi5el3ltfwf/bin/m4
Abort trap: 6
(alice)[11:10:18]spack>>fg
```

Tracked down a fix via the Homebrew recipe.  I'll send a note to the
`[email protected]` list to ensure that upstream knows about it.
@adamjstewart
Copy link
Copy Markdown
Member

Looks like this fixes m4. make check still doesn't pass, although this patch gets it farther.

@adamjstewart adamjstewart merged commit 1e92721 into spack:develop Jun 24, 2018
@hartzell
Copy link
Copy Markdown
Contributor Author

FYI, from the m4 mailing list:

On 06/23/2018 01:48 PM, George Hartzell wrote:
> 
> Hi All,
> 
> I'm ensuring that the Spack packager can build m4 on OS X High Sierra.
> 
> Here's my PR for them:
> 
>      https://github.com/spack/spack/pull/8559

Making someone chase a URL is not friendly for long-term archives. 
Here's a summary:

+With format string strictness, High Sierra also enforces that %n isn't used
+in dynamic format strings, but we should just disable its use on darwin in
+general.
+
+--- a/lib/vasnprintf.c.orig	2017-06-22 15:19:15.000000000 -0700
++++ b/lib/vasnprintf.c	2017-06-22 15:20:20.000000000 -0700
+@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
+ #endif
+                   *fbp = dp->conversion;
+ #if USE_SNPRINTF
+-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && 
!defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! 
defined __CYGWIN__))
++# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && 
__GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || 
defined __WIN32__) && ! defined __CYGWIN__))
+                 fbp[1] = '%';
+                 fbp[2] = 'n';
+                 fbp[3] = '\0';

In other words, you are patching gnulib to work around MacOS's new 
strictness that prevents the POSIX-compliant use of %n within 
snprintf().  As similar patches have already been made in upstream 
gnulib, the next release of m4 should automatically work with newer 
MacOS by virtue of updating to a newer gnulib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants