On Tue, 20 Jul 2021 15:09:04 +0000
Charlene Wendling <juliana...@posteo.jp> wrote:

> Hi,
> 
> Long time ago, gkoehler@ found out the guile2 32 bit big endian
> bootstrap files were leading to segfaults during the build [0] on
> powerpc.
> 
> Not using a bootstrap increases the building time by a factor of ~ 6.
> Currently, guile2 build time is 25 hours in the powerpc bulk. To give you
> an idea of what this represents on this arch, it's one hour more than
> x11/qt5/qtbase, or twice the time needed to build devel/boost.
> 
> The people at Macports saw gkoehler@'s mail, and managed to build
> bootstraps [1].
> 
> I took their recipe and adapted to our port system, so we can provide
> a valid 32-bit big endian bootstrap that actually works, based on
> what we do with lang/gcc/8, with the ability for anyone to
> produce a bootstrap.
> 
> This reduces the build time from 19 to 3 hours on my Mac Mini G4! [2]

One issue: the port is extracting your g2strap-2.2.7-32be.tgz twice,
in both WRKDIR and WRKSRC.  If you can fix that (maybe with
EXTRACT_ONLY), the diff will be ok gkoehler@

You don't bump REVISION, and I don't see a reason to bump.
We're building the same guile2, but building faster.

There is still no 64-bit-big-endian bootstrap, so powerpc64 (and
probably mips64 and sparc64) still go the slow way.  I have not tried
to make a 64-bit-big-endian bootstrap.  My build times for guile2 are
about

   5 h 45 m   on macppc Cube G4 (450 MHz) with your g2strap
   4 h 50 m   on powerpc64 (2700 to 3800 MHz)

I have avoided building guile2 for a long time, because the build was
too slow.  Now that we have a bootstrap, I ran "make test".  2 tests
fail on all archs because OpenBSD's getrlimit(2) doesn't have
RLIMIT_AS, but macppc has a 3rd failure in the ffi (foreign function
interface to call C from Guile):

bad return from expression `(f-s64-)': expected -2000000000; got -873842568
bad return from expression `(f-u64-)': expected 4000000000; got 3421124728
bad return from expression `(f-s64-u8 10)': expected -1999999990; got 
-4294967294
...
FAIL: test-ffi

guile2 uses devel/libffi so this might be some libffi problem.  I have
not yet studied issue; I know that lang/ruby uses libffi and wonder if
I can reproduce the problem by writing ruby code.

--George

> This has no impact on !{macppc,hppa}. I know it's quite a big change
> given the limited scope of that diff. But actually guile moved to 3.x,
> and 2.2.x is now considered legacy [3], so it's very unlikely we
> see an update for this version anyway. I'm hoping they did not
> reproduce the mistake for 3.x.
> 
> Comments and feedback are welcome,
> 
> Charlène.
> 
> 
> [0] https://marc.info/?l=openbsd-ports&m=157611545827058&w=2
> [1] https://trac.macports.org/ticket/54124#comment:78
> [2] https://bin.charlenew.xyz/guile2-2.2.7.log
> [3] https://www.gnu.org/software/guile/download/#releases
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/guile2/Makefile,v
> retrieving revision 1.27
> diff -u -p -u -p -r1.27 Makefile
> --- Makefile  3 Aug 2020 07:27:46 -0000       1.27
> +++ Makefile  20 Jul 2021 14:53:41 -0000
> @@ -1,7 +1,8 @@
>  # $OpenBSD: Makefile,v 1.27 2020/08/03 07:27:46 jasper Exp $
>  
> -# When updating, check that x11/gnome/aisleriot MODGNOME_CPPFLAGS references 
> the
> -# proper guile2 includes directory
> +# When updating, check that x11/gnome/aisleriot MODGNOME_CPPFLAGS references
> +# the proper guile2 includes directory. Also, 32-bit BE arches bootstraps may
> +# need to be rebuilt.
>  
>  COMMENT=             GNU's Ubiquitous Intelligent Language for Extension
>  # '
> @@ -25,6 +26,9 @@ WANTLIB += c curses ffi gc gmp iconv int
>  WANTLIB += unistring
>  
>  MASTER_SITES=                ${MASTER_SITE_GNU:=guile/}
> +MASTER_SITES0=               https://charlenew.xyz/distfiles/
> +DISTFILES=           ${DISTNAME}${EXTRACT_SUFX}
> +SUPDISTFILES=                ${BOOTSTRAP_32BE}:0
>  
>  # internal compiler error: in unify_nodes, at tree-ssa-structalias.c:1231
>  COMPILER =           base-clang ports-gcc
> @@ -49,9 +53,22 @@ CONFIGURE_ARGS=            --program-suffix=${V}
>  # warning: format '%ji' expects type 'intmax_t', but argument 4 has type 
> 'scm_t_intmax'
>  CONFIGURE_ARGS +=    --disable-error-on-warning
>  
> -# powerpc: Prevent "Segmentation fault (core dumped)" during build.
> -post-patch:
> -     mv ${WRKSRC}/prebuilt/32-bit-big-endian{,-broken}
> +.include <bsd.port.arch.mk>
> +
> +# The prebuilt bootstrap makes the build segfault on 32-bit BE arches.
> +# Provide ours instead.
> +BOOTSTRAP_32BE=              g2strap-2.2.7-32be.tgz
> +.if !${PROPERTIES:Mlp64} && ${PROPERTIES:Mbe}
> +BOOTSTRAP_TARGET=    32-bit-big-endian
> +BOOTSTRAP=           ${BOOTSTRAP_32BE}
> +DISTFILES+=          ${SUPDISTFILES}
> +.endif
> +
> +post-extract:
> +.if "${BOOTSTRAP_TARGET}" != ""
> +     mv ${WRKSRC}/prebuilt/${BOOTSTRAP_TARGET}{,-broken}
> +     cd ${WRKSRC} && tar xzf ${FULLDISTDIR}/${BOOTSTRAP}
> +.endif
>  
>  post-install:
>       install -d ${PREFIX}/share/guile/site/${V}/
> @@ -59,3 +76,20 @@ post-install:
>       mv ${PREFIX}/share/aclocal/guile{,${V}}.m4
>  
>  .include <bsd.port.mk>
> +
> +# The below bits only matter on 32-bit BE archs for now.
> +
> +G2PKG=       ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME}.tgz
> +
> +.PHONY: g2strap
> +
> +g2strap: ${G2PKG}
> +.if "${BOOTSTRAP_TARGET}" != ""
> +     mkdir -p ${WRKBUILD}/g2strap/prebuilt/${BOOTSTRAP_TARGET}
> +     cp -a ${WRKBUILD}/bootstrap/{Makefile.*,ice-9,language,srfi,system} \
> +           ${WRKBUILD}/g2strap/prebuilt/${BOOTSTRAP_TARGET}
> +     tar -C ${WRKBUILD}/g2strap -czf ${FULLDISTDIR}/${BOOTSTRAP} .
> +     @echo "The bootstrap can be found at: " ${FULLDISTDIR}/${BOOTSTRAP}
> +.else
> +     @echo "You don't need to build a bootstrap on ${MACHINE_ARCH}."
> +.endif
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/lang/guile2/distinfo,v
> retrieving revision 1.9
> diff -u -p -u -p -r1.9 distinfo
> --- distinfo  3 Aug 2020 07:27:46 -0000       1.9
> +++ distinfo  20 Jul 2021 14:53:41 -0000
> @@ -1,2 +1,4 @@
> +SHA256 (g2strap-2.2.7-32be.tgz) = 
> MZmNCiGNR+GcVb73Bk7qnVGOn86juxflnEDEGzDjkZo=
>  SHA256 (guile-2.2.7.tar.gz) = RLTF+74lfM3r6hhCAhLJs+kMPIalSSDYVUA5/GdpoAc=
> +SIZE (g2strap-2.2.7-32be.tgz) = 4057585
>  SIZE (guile-2.2.7.tar.gz) = 18129833


-- 
George Koehler <kern...@gmail.com>

Reply via email to