Fail to build on 32bits architecture
papoteur-mga opened this issue · 3 comments
papoteur-mga commented
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 commented
Suggested fix:
From 24ae754c44ac79070e8f399e92706f92fbc88c58 Mon Sep 17 00:00:00 2001
From: Papoteur <papoteur@mageia.org>
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 commented
Thank you! Please do not hesitate to submit a PR .
papoteur-mga commented
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.