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

Fix compilation on Wasm #73

Merged
merged 2 commits into from
Feb 1, 2021
Merged

Conversation

RReverser
Copy link
Contributor

Fix compilation on WebAssembly, as well as any other non-Windows/Unix/Redox targets.

Previously, the functions would be undefined on those targets and the crate would fail to compile with errors like:

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompressInit` in crate `ffi`
   --> src/mem.rs:124:22
    |
124 |                 ffi::BZ2_bzCompressInit(&mut *raw, lvl.level() as c_int, 0, work_factor as c_int),
    |                      ^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompress` in crate `ffi`
   --> src/mem.rs:157:24
    |
157 |             match ffi::BZ2_bzCompress(&mut *self.inner.raw, action as c_int) {
    |                        ^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompressInit` in crate `ffi`
   --> src/mem.rs:215:29
    |
215 |             assert_eq!(ffi::BZ2_bzDecompressInit(&mut *raw, 0, small as c_int), 0);
    |                             ^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompress` in crate `ffi`
   --> src/mem.rs:232:24
    |
232 |             match ffi::BZ2_bzDecompress(&mut *self.inner.raw) {
    |                        ^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompressEnd` in crate `ffi`
   --> src/mem.rs:312:14
    |
312 |         ffi::BZ2_bzCompressEnd(stream)
    |              ^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompressEnd` in crate `ffi`
   --> src/mem.rs:317:14
    |
317 |         ffi::BZ2_bzDecompressEnd(stream)
    |              ^^^^^^^^^^^^^^^^^^^ not found in `ffi`

Fix compilation on WebAssembly, as well as any other non-Windows/Unix/Redox targets.

Previously, the functions would be undefined on those targets and the crate would fail to compile with errors like:
```
error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompressInit` in crate `ffi`
   --> src/mem.rs:124:22
    |
124 |                 ffi::BZ2_bzCompressInit(&mut *raw, lvl.level() as c_int, 0, work_factor as c_int),
    |                      ^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompress` in crate `ffi`
   --> src/mem.rs:157:24
    |
157 |             match ffi::BZ2_bzCompress(&mut *self.inner.raw, action as c_int) {
    |                        ^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompressInit` in crate `ffi`
   --> src/mem.rs:215:29
    |
215 |             assert_eq!(ffi::BZ2_bzDecompressInit(&mut *raw, 0, small as c_int), 0);
    |                             ^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompress` in crate `ffi`
   --> src/mem.rs:232:24
    |
232 |             match ffi::BZ2_bzDecompress(&mut *self.inner.raw) {
    |                        ^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzCompressEnd` in crate `ffi`
   --> src/mem.rs:312:14
    |
312 |         ffi::BZ2_bzCompressEnd(stream)
    |              ^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find function, tuple struct or tuple variant `BZ2_bzDecompressEnd` in crate `ffi`
   --> src/mem.rs:317:14
    |
317 |         ffi::BZ2_bzDecompressEnd(stream)
    |              ^^^^^^^^^^^^^^^^^^^ not found in `ffi`
```
@alexcrichton alexcrichton merged commit 707f85c into alexcrichton:master Feb 1, 2021
@alexcrichton
Copy link
Owner

Thanks!

@RReverser RReverser deleted the patch-1 branch February 1, 2021 17:08
@RReverser
Copy link
Contributor Author

Thanks for merging! Could you tag a minor/patch bump for the bzip2-sys please?

@alexcrichton
Copy link
Owner

Sure thing, done!

@RReverser
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants