--- Begin Message ---
Subject: |
[bug-gnu-emacs] emacs-25.0.95 fails to build on DragonFlyBSD, and an easy repair |
Date: |
Mon, 13 Jun 2016 14:10:07 -0600 |
emacs-25.0.95 fails to build on DragonFlyBSD 3.8, 3.9, 4.0, 4.2, 4.4,
and 4.6, independent of the compiler (various gcc or clang versions)
used.
On each system, src/alloc.c fails to compile:
CC alloc.o
alloc.c:474:32: error: macro "ALIGN" passed 2 arguments, but takes just
1
ALIGN (void *ptr, int alignment)
^
alloc.c:475:1: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '' token
{
^
alloc.c: In function 'pure_alloc':
alloc.c:5171:66: error: macro "ALIGN" passed 2 arguments, but takes
just 1
result = ALIGN (purebeg + pure_bytes_used_lisp, GCALIGNMENT);
^
alloc.c:5171:16: error: 'ALIGN' undeclared (first use in this function)
result = ALIGN (purebeg + pure_bytes_used_lisp, GCALIGNMENT);
^
alloc.c:5171:16: note: each undeclared identifier is reported only once
for each function it appears in
Makefile:378: recipe for target 'alloc.o' failed
gmake[1]: [alloc.o] Error 1 (ignored)
The conflict with the all-to-generic macro name ALIGN() appears to
come from these DragonFlyBSD definitions:
% find /usr/include -type f | xargs grep '[^_A-Z]_ALIGN[^_A-Z]'
/usr/include/cpu/param.h:#define _ALIGN(p) (((unsigned long)(p) +
_ALIGNBYTES) & ~_ALIGNBYTES)
/usr/include/cpu/param.h:#define ALIGN(p) _ALIGN(p)
whereas alloc.c has
static void *
ALIGN (void *ptr, int alignment)
{
return (void *) ROUNDUP ((uintptr_t) ptr, alignment);
}
As an experiment, I made these patches to alloc.c on DragonFlyBSD 4.6:
% diff alloc.c.org alloc.c
474c474
< ALIGN (void *ptr, int alignment)
---
> EMACS_ALIGN (void *ptr, int alignment)
1245c1245
< abase = ALIGN (base, BLOCK_ALIGN);
---
> abase = EMACS_ALIGN (base, BLOCK_ALIGN);
5171c5171
< result = ALIGN (purebeg + pure_bytes_used_lisp, GCALIGNMENT);
---
> result = EMACS_ALIGN (purebeg + pure_bytes_used_lisp,
GCALIGNMENT);
That solved the build problem on DragonFlyBSD 4.6, and I've installed
the new emacs on that system. The same fix repaired all of the five
other versions of that O/S in my lab.
Another, and simpler solution, would be to insert
#undef ALIGN
before the first use of ALIGN() in alloc.c.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: address@hidden -
- 155 S 1400 E RM 233 address@hidden address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#23764: [bug-gnu-emacs] emacs-25.0.95 fails to build on DragonFlyBSD, and an easy repair |
Date: |
Tue, 14 Jun 2016 13:40:49 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Version: 25.0.96
Thanks; fixed.
I see DragonFly BSD has known about this for months, eg
https://github.com/DragonFlyBSD/DPorts/blob/master/editors/emacs-devel/dragonfly/patch-src_alloc.c
--- End Message ---