All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets
Date: Fri, 18 Sep 2015 11:02:07 +0100	[thread overview]
Message-ID: <55FBE11F.2000700@imgtec.com> (raw)
In-Reply-To: <1442569912-13452-1-git-send-email-judge.packham@gmail.com>

Dear Chris Packham,

On 09/18/2015 10:51 AM, Chris Packham wrote:
> From the micropython source:
> 
>   This mpz module implements arbitrary precision integers.
> 
>   The storage for each digit is defined by mpz_dig_t.  The actual number
>   of bits in mpz_dig_t that are used is defined by MPZ_DIG_SIZE.  The
>   machine must also provide a type that is twice as wide as mpz_dig_t,
>   in both signed and unsigned versions
> 
>   MPZ_DIG_SIZE can be between 4 and 8*sizeof(mpz_dig_t), but it makes
>   most sense to have it as large as possible.
> 
> Micropython detects x86_64 targets and sets MPZ_DIG_SIZE appropriately
> but for other 64-bit targets we need to explicitly pass
> -DMPZ_DIG_SIZE=32 in CFLAGS.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>  package/micropython/micropython.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> index 6266882..1ac2e8d 100644
> --- a/package/micropython/micropython.mk
> +++ b/package/micropython/micropython.mk
> @@ -16,6 +16,10 @@ ifeq ($(BR2_powerpc)$(BR2_sh)$(BR2_xtensa),y)
>  MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>  endif
>  
> +ifeq ($(BR2_ARCH_IS_64),y)
> +MICROPYTHON_CFLAGS += -DMPZ_DIG_SIZE=32
> +endif
> +

you have to take into account that MIPS64 n32 is a 64-bit target as
well, but it has a MP_SSIZE_MAX of 32-bit. So, if you set MPZ_DIG_SIZE
to 32 for all 64-bit arches, then you will see the same failure for the
when building for MIPS64 n32.

I suggest you to do modify the "ifeq" like this:

# MIPS64 n32 is a 64-bit arch, but it has a 32-bit wide SSIZE_MAX which
# means we still need the default MPZ_DIG_SIZE of 16.
ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)


Regards,

Vincent.

>  define MICROPYTHON_BUILD_CMDS
>  	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
>  		CROSS_COMPILE=$(TARGET_CROSS) \
> 

  reply	other threads:[~2015-09-18 10:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
2015-09-14 13:06 ` Vicente Olivert Riera
2015-09-14 23:14   ` Chris Packham
2015-09-14 13:40 ` Vicente Olivert Riera
2015-09-14 22:44   ` Chris Packham
2015-09-14 13:58 ` Thomas Petazzoni
2015-09-14 14:12   ` Vicente Olivert Riera
2015-09-14 23:03     ` Chris Packham
2015-09-15  8:24       ` Thomas Petazzoni
2015-09-15 19:49       ` Jörg Krause
2015-09-14 23:01   ` Chris Packham
2015-09-15  8:23     ` Thomas Petazzoni
2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
2015-09-15 10:14   ` Vicente Olivert Riera
2015-09-15 10:19     ` Vicente Olivert Riera
2015-09-15 21:30       ` Chris Packham
2015-09-15 22:03     ` Thomas Petazzoni
2015-09-15 21:54   ` Chris Packham
2015-09-15 22:49     ` [Buildroot] [PATCHv3] " Chris Packham
2015-09-16  6:25       ` Jerzy Grzegorek
2015-09-16 21:12       ` Thomas Petazzoni
2015-09-16 23:28         ` Chris Packham
2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
2015-09-17  8:56               ` Vicente Olivert Riera
2015-09-18  4:54                 ` Chris Packham
2015-09-16 23:29             ` [Buildroot] [PATCH v4 2/2] micropython-lib: new packages Chris Packham
2015-09-17  8:56               ` Vicente Olivert Riera
2015-09-17 21:48             ` [Buildroot] [PATCH v4 0/2] Micropython package Thomas Petazzoni
2015-09-18  7:32             ` Thomas Petazzoni
2015-09-18  8:22               ` Chris Packham
2015-09-18  9:19                 ` [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh Chris Packham
2015-09-19 12:00                   ` Thomas Petazzoni
2015-09-18  9:29                 ` [Buildroot] [PATCH v4 0/2] Micropython package Vicente Olivert Riera
2015-09-18  9:43                   ` Chris Packham
2015-09-18  9:51                     ` [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets Chris Packham
2015-09-18 10:02                       ` Vicente Olivert Riera [this message]
2015-09-19  9:19                         ` Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55FBE11F.2000700@imgtec.com \
    --to=vincent.riera@imgtec.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.