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

make error #307

Open
bintao-tao opened this issue May 3, 2024 · 3 comments
Open

make error #307

bintao-tao opened this issue May 3, 2024 · 3 comments

Comments

@bintao-tao
Copy link

bintao-tao commented May 3, 2024

When I execute the make operation, the error is reported as follows:
in file included from charm/core/math/pairing/pairingmodule.c:30:
charm/core/math/pairing/pairingmodule.h:39:10: fatal error: longintrepr.h: no such file or directory.
39 | #include <longintrepr.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

@terry-fee
Copy link
Contributor

Are you using Python 3.12? In Python 3.12, the header file longintrepr.h is in the directory /usr/include/python3.12/cpython/ whereas for the earlier Python versions, the same file is in /usr/include/python3.XX/. I would suggest using Python versions 3.8 to 3.10 instead for the time being. There are other things in Python 3.12 that will break the Charm library, so it is probably better to wait until someone resolves those issues before using Charm on Python 3.12.

@luoky69
Copy link

luoky69 commented Feb 14, 2025

Are you using Python 3.12? In Python 3.12, the header file longintrepr.h is in the directory /usr/include/python3.12/cpython/ whereas for the earlier Python versions, the same file is in /usr/include/python3.XX/. I would suggest using Python versions 3.8 to 3.10 instead for the time being. There are other things in Python 3.12 that will break the Charm library, so it is probably better to wait until someone resolves those issues before using Charm on Python 3.12.

There is no longintrepr.h in directory cpython when I use python 3.8 or 3.10 in Conda, and when I add longintrepr.h manually, make error "no member named 'long_value'" will show up, how can I fix this?

@terry-fee
Copy link
Contributor

@luoky69 To resolve issues like this, you would need to make the C program look for different folders and maybe also use different methods depending on the installed Python version, such as the following.

#if PY_MINOR_VERSION <= 10
  #include <longintrepr.h>
#else
  #include <cpython/longintrepr.h>                             
#endif

#if PY_MINOR_VERSION <= 11
  #define MY_MACRO(l) l->ob_digit
#else
  #define MY_MACRO(l)  l->long_value.ob_digit
#endif

If you look inside the header file longintrepr.h, Python 3.11 and below has the following definition.

struct _longobject {
    PyObject_VAR_HEAD
    digit ob_digit[1];
};

But Python 3.12 has an additional field long_value.

typedef struct _PyLongValue {
    uintptr_t lv_tag; /* Number of digits, sign and flags */
    digit ob_digit[1];
} _PyLongValue;

struct _longobject {
    PyObject_HEAD
    _PyLongValue long_value;
};

Anyway, this issue has been fixed.

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

3 participants