Subject: bug#28308: Build failure on FreeBSD/aarch64

From: Gergely Czuczy <[email-masked]>
Date: Thu, 2 Nov 2017 22:03:41 +0100

On 2017. 10. 31. 18:31, Noam Postavsky wrote:
> tags 28308 + patch
> quit
>
> On Tue, Oct 24, 2017 at 2:43 PM, Noam Postavsky
> <[email-masked]> wrote:
>
>> It seems that the memory pointer to by float_block->floats becomes
>> invalid following the dumping process.
> The following patch which makes FreeBSD use the hybrid malloc scheme fixes it:
>
> diff --git a/configure.ac b/configure.ac
> index d294412dc4..2e690987a6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2206,7 +2206,7 @@ AC_DEFUN
>   case "$opsys" in
>     ## darwin ld insists on the use of malloc routines in the System framework.
>     darwin | mingw32 | nacl | sol2-10) ;;
> -  cygwin) hybrid_malloc=yes
> +  freebsd | cygwin) hybrid_malloc=yes
>             system_malloc= ;;
>     *) test "$ac_cv_func_sbrk" = yes &&
> system_malloc=$emacs_cv_sanitize_address;;
>   esac
> diff --git a/src/gmalloc.c b/src/gmalloc.c
> index baaff58050..8fd05fe845 100644
> --- a/src/gmalloc.c
> +++ b/src/gmalloc.c
> @@ -1509,9 +1509,13 @@ gdefault_morecore (ptrdiff_t increment)
>         return bss_sbrk (increment);
>       }
>   #endif
> +#ifdef HAVE_SBRK
>     result = (void *) __sbrk (increment);
>     if (result == (void *) -1)
>       return NULL;
> +#else
> +  result = NULL;
> +#endif
>     return result;
>   }
So, the amd64 and the aarch64 builds have finished:
GNU Emacs 26.0.50 (build 1, amd64-portbld-freebsd11.0) of 2017-11-02
GNU Emacs 26.0.50 (build 1, aarch64-portbld-freebsd12.0) of 2017-11-02

Both are functional.

Regarding updating the port, that's rather simple, you don't have to 
update the whole OS or anything similar.

Here's how you can do it:
cd /usr/ports/editors/emacs-devel
rm distinfo
rm -rf work
vi Makefile # adjust GH_TAGNAME with the commit id.
make fetch; make makesum

That will update the required things to build it. However, if the 
installed files have changed, plist might have to be adjusted for the 
install target, but just ignore that. If you touch the missing files, 
that's sufficient (if happens at all).

If this version will be the fix for the issue, could you please let me 
know which commit has it? I would like to let the port's maintainer 
know, so he can update the port in the master branch, fixing aarch64 
support finally.

Thank you very much for the help.