Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to build on 32bits architecture #35

Open
papoteur-mga opened this issue Sep 4, 2024 · 3 comments
Open

Fail to build on 32bits architecture #35

papoteur-mga opened this issue Sep 4, 2024 · 3 comments

Comments

@papoteur-mga
Copy link

I try to build scamp for Mageia i686. The build on x86_64 is OK, but on i868 I get:

gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/include/plplot  -D_REENTRANT   -O2 -g -pipe -Wformat -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -fomit-frame-pointer -m32 -march=i686 -msse2 -mtune=generic -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -fcommon -c -o chealpixstore.o chealpixstore.c
...
define.h:135:28: error: assignment to 'int64_t *' {aka 'long long int *'} from incompatible pointer type 'long int *' [-Wincompatible-pointer-types]
  135 |                 {if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ))))\
      |                            ^
@papoteur-mga
Copy link
Author

Suggested fix:

From 24ae754c44ac79070e8f399e92706f92fbc88c58 Mon Sep 17 00:00:00 2001
From: Papoteur <[email protected]>
Date: Wed, 4 Sep 2024 17:18:22 +0200
Subject: [PATCH] scamp fix define with pointer size varying according to arch
 32/64

define.h:135:28: error: assignment to 'int64_t *' {aka 'long long int *'} from incompatible pointer type 'long int *' [-Wincompatible-pointer-types]
      135 |                 {if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ))))\
          |                            ^#
---
 src/chealpixstore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chealpixstore.c b/src/chealpixstore.c
index b441e68..55363c5 100644
--- a/src/chealpixstore.c
+++ b/src/chealpixstore.c
@@ -124,7 +124,7 @@ PixelStore_add(
 
         if (store->pixelids_size == store->npixels) {
             QREALLOC(store->pixelids,
-                 long, store->pixelids_size * 2);
+                 int64_t, store->pixelids_size * 2);
             store->pixelids_size *= 2;
         }
         store->pixelids[store->npixels] = pixnum;
-- 
2.41.1

@ebertin
Copy link
Member

ebertin commented Sep 25, 2024

Thank you! Please do not hesitate to submit a PR .

@papoteur-mga
Copy link
Author

Thank you! Please do not hesitate to submit a PR .

Sorry, this is not in my plan. Anyone is free to use the above fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants