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

Tests fail on Apple Silicon #52

Closed
frewsxcv opened this issue Dec 9, 2020 · 7 comments · Fixed by #80
Closed

Tests fail on Apple Silicon #52

frewsxcv opened this issue Dec 9, 2020 · 7 comments · Fixed by #80

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Dec 9, 2020

% cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.08s
     Running target/debug/deps/proj-6a37e3d3cad5067a

running 14 tests
test proj::test::test_definition ... ok
test proj::test::test_conversion_error ... FAILED
test proj::test::test_conversion ... FAILED
test proj::test::test_error_recovery ... FAILED
test proj::test::test_inverse_projection ... FAILED
test proj::test::test_london_inverse ... FAILED
test proj::test::test_searchpath ... ok
test proj::test::test_projection ... FAILED
test proj::test::test_area_of_use ... ok
test proj::test::test_array_convert ... ok
test proj::test::test_from_crs ... FAILED
test proj::test::test_input_order ... FAILED
test proj::test::test_set_endpoint ... ok
proj_create: unrecognized format / unknown name
test proj::test::test_init_error ... ok

failures:

---- proj::test::test_conversion_error stdout ----
thread 'proj::test::test_conversion_error' panicked at 'called `Result::unwrap_err()` on an `Ok` value: MyPoint { x: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021451195286, y: 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057 }', src/proj.rs:1057:14

---- proj::test::test_conversion stdout ----
thread 'proj::test::test_conversion' panicked at 'assertion failed: f > 0.99999', src/proj.rs:885:9

---- proj::test::test_error_recovery stdout ----
thread 'proj::test::test_error_recovery' panicked at 'assertion failed: nad83_m.convert(MyPoint::new(0.0, 0.0)).is_ok()', src/proj.rs:1077:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- proj::test::test_inverse_projection stdout ----
thread 'proj::test::test_inverse_projection' panicked at 'assertion failed: f > 0.99999', src/proj.rs:885:9

---- proj::test::test_london_inverse stdout ----
thread 'proj::test::test_london_inverse' panicked at 'assertion failed: f > 0.99999', src/proj.rs:885:9

---- proj::test::test_projection stdout ----
thread 'proj::test::test_projection' panicked at 'assertion failed: f > 0.99999', src/proj.rs:885:9

---- proj::test::test_from_crs stdout ----
thread 'proj::test::test_from_crs' panicked at 'assertion failed: f > 0.99999', src/proj.rs:885:9

---- proj::test::test_input_order stdout ----
thread 'proj::test::test_input_order' panicked at 'assertion failed: `(left == right)`
  left: `6693625.67217475`,
 right: `0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005`', src/proj.rs:1110:9


failures:
    proj::test::test_conversion
    proj::test::test_conversion_error
    proj::test::test_error_recovery
    proj::test::test_from_crs
    proj::test::test_input_order
    proj::test::test_inverse_projection
    proj::test::test_london_inverse
    proj::test::test_projection

test result: FAILED. 6 passed; 8 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

error: test failed, to rerun pass '--lib'
@michaelkirk
Copy link
Member

I've reproduced this. Taking a look now.

@michaelkirk
Copy link
Member

I haven't solved this yet, but some notes:

On arm64 mac:

  • Reproduced this failure using homebrew proj (7.2.1)
  • Reproduced this failure using bundled proj (7.1.0)
    • This first required resolving a "'libtiff' couldn't be found" compiler error. I think this was due to homebrew switching it's root from /usr/local -> /opt/homebrew.
  • Successfully built and passed test suite using homebrew proj 7.2.1 on rosetta (x86_64 emulator) and x86_64 toolchain

@frewsxcv
Copy link
Member Author

I made a minimal reproduction of the issue here: https://github.com/georust/proj/blob/frewsxcv-min/src/main.rs in this draft PR #63

I have absolutely no idea what's going on 😔

@urschrei
Copy link
Member

I think we should cast the net wider and see whether the PROJ maintainers (or anyone else in the community) have begun to test on M1, and if they have, whether they can repro this using analogous c or cpp (which I cannot write at all) wrapping the API calls. I just don't see what's wrong on the Rust side.

@michaelkirk
Copy link
Member

michaelkirk commented Jan 17, 2021

I don't currently have access to my M1 machine, but IIRC I was able to build and pass the proj test suite (the c++ one).

I think it was as simple as running ctest from the root of the libproj directory, but my memory is fickle.

My best guess was that it had to do with how we were managing pointers, similar to what @urschrei fixed in #56 but I don't yet have any real evidence or solution.

@frewsxcv
Copy link
Member Author

This is probably the underlying bug: rust-lang/rust-bindgen#1973

@frewsxcv
Copy link
Member Author

This is probably the underlying bug: rust-lang/rust-bindgen#1973

Confirmed this is the bug. I got tests passing on my Macbook Air M1 with these changes: #65

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 a pull request may close this issue.

3 participants