-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
In Emscripten, sizeof(time_t) != sizeof(int) #10293
Comments
|
How does it determine the size? |
cffi ultimately generates C code for its modules, so it happens via that process -- I can't tell you with more specificity than that without diving into cffi's own code |
Seems to get converted to So probably |
Or some transform that happens replaces |
Based on a very quick grep (I don't know the cffi source code that well unfortunately), I see I think more abstractly, it sounds like the emscripten build process somehow doesn't support this feature of cffi well, possibly. It may make sense to build a minimal reproducer that demonstrates the issue, and bring it to the cffi folks. |
Actually I looked again and import cffi
ffi = cffi.FFI()
ffi.cdef("""
typedef int... time_t;
void g(time_t x);
""")
ffi.set_source("x.c", "void f(time_t b) { g(x); }")
ffi.emit_c_code("abc.c") emits something like: static void _cffi_d_g(time_t x0)
{
g(x0);
} Which just uses The actual problem is in Overriding the libc crate with my patched version fixes the build:
Thanks for the help @alex! |
Glad we figured it out. Will follow on the rust issue. |
In
asn1.py
, cryptography definestime_t
to beint...
:https://github.com/pyca/cryptography/blob/main/src/_cffi_src/openssl/asn1.py#L12
I'm not 100% sure what
int...
means, since the documentation of cffi doesn't directly suggest that the parser would accept this and I haven't looked at the source code. But if it's any ofvoid *
,int *
, orint
these are all 32 bits in Emscripten, buttime_t
is 64 bits.Applying the following patch gets it building again, but I'm not sure how we can upstream this:
The text was updated successfully, but these errors were encountered: