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

WASM builds fail on bindings generated by bindgen 0.70.0 or later #156

Closed
ajrcarey opened this issue Aug 25, 2024 · 2 comments
Closed

WASM builds fail on bindings generated by bindgen 0.70.0 or later #156

ajrcarey opened this issue Aug 25, 2024 · 2 comments
Assignees

Comments

@ajrcarey
Copy link
Owner

ajrcarey commented Aug 25, 2024

During import of pdfium_6666 bindings as part of #137, upgraded bindgen dependency to latest 0.70.1 and regenerated bindings using command

cargo build --features "bindings"

WASM builds fail to build with errors:

error[E0080]: evaluation of constant value failed
|    --> /pdfium/src/bindgen/pdfium_6666.rs:652:28
|     |
| 652 |     ["Size of FPDF_BSTR_"][::std::mem::size_of::<FPDF_BSTR_>() - 16usize];
|     |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|    --> /pdfium/src/bindgen/pdfium_6666.rs:809:38
|     |
| 809 |     ["Size of FPDF_LIBRARY_CONFIG_"][::std::mem::size_of::<FPDF_LIBRARY_CONFIG_>() - 48usize];
|     |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `24_usize - 48_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|    --> /pdfium/src/bindgen/pdfium_6666.rs:882:33
|     |
| 882 |     ["Size of FPDF_FILEACCESS"][::std::mem::size_of::<FPDF_FILEACCESS>() - 24usize];
|     |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `12_usize - 24_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|    --> /pdfium/src/bindgen/pdfium_6666.rs:936:35
|     |
| 936 |     ["Size of FPDF_FILEHANDLER_"][::std::mem::size_of::<FPDF_FILEHANDLER_>() - 56usize];
|     |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `28_usize - 56_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1053:35
|      |
| 1053 |     ["Size of FPDF_COLORSCHEME_"][::std::mem::size_of::<FPDF_COLORSCHEME_>() - 32usize];
|      |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `16_usize - 32_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1624:20
|      |
| 1624 |     ["Size of tm"][::std::mem::size_of::<tm>() - 56usize];
|      |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `44_usize - 56_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1649:26
|      |
| 1649 |     ["Size of timespec"][::std::mem::size_of::<timespec>() - 16usize];
|      |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1667:28
|      |
| 1667 |     ["Size of itimerspec"][::std::mem::size_of::<itimerspec>() - 32usize];
|      |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `16_usize - 32_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1695:33
|      |
| 1695 |     ["Size of __locale_struct"][::std::mem::size_of::<__locale_struct>() - 232usize];
|      |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `116_usize - 232_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1898:33
|      |
| 1898 |     ["Size of _UNSUPPORT_INFO"][::std::mem::size_of::<_UNSUPPORT_INFO>() - 16usize];
|      |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:1939:30
|      |
| 1939 |     ["Size of _IFSDK_PAUSE"][::std::mem::size_of::<_IFSDK_PAUSE>() - 24usize];
|      |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `12_usize - 24_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:2514:34
|      |
| 2514 |     ["Size of _IPDF_JsPlatform"][::std::mem::size_of::<_IPDF_JsPlatform>() - 104usize];
|      |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `52_usize - 104_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:2850:36
|      |
| 2850 |     ["Size of _FPDF_FORMFILLINFO"][::std::mem::size_of::<_FPDF_FORMFILLINFO>() - 280usize];
|      |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `140_usize - 280_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:3675:33
|      |
| 3675 |     ["Size of FPDF_FILEWRITE_"][::std::mem::size_of::<FPDF_FILEWRITE_>() - 16usize];
|      |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:3853:31
|      |
| 3853 |     ["Size of _FX_FILEAVAIL"][::std::mem::size_of::<_FX_FILEAVAIL>() - 16usize];
|      |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:3886:35
|      |
| 3886 |     ["Size of _FX_DOWNLOADHINTS"][::std::mem::size_of::<_FX_DOWNLOADHINTS>() - 16usize];
|      |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:4315:35
|      |
| 4315 |     ["Size of _FPDF_SYSFONTINFO"][::std::mem::size_of::<_FPDF_SYSFONTINFO>() - 72usize];
|      |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `36_usize - 72_usize`, which would overflow
| 
| error[E0080]: evaluation of constant value failed
|     --> /pdfium/src/bindgen/pdfium_6666.rs:4349:38
|      |
| 4349 |     ["Size of FPDF_CharsetFontMap_"][::std::mem::size_of::<FPDF_CharsetFontMap_>() - 16usize];
|      |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `8_usize - 16_usize`, which would overflow
@ajrcarey ajrcarey self-assigned this Aug 25, 2024
@ajrcarey
Copy link
Owner Author

Trial and error showed that a change in bindgen introduced in 0.70.0 causes the build failures. Locked bindgen version in Cargo.toml to 0.69.4 while investigation continues. It may be necessary to file an issue upstream at https://github.com/rust-lang/rust-bindgen.

@ajrcarey
Copy link
Owner Author

Added notes to Cargo.toml and README. Change will be included in release 0.8.25.

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

1 participant