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

0.71.0 Cannot compile for Android #392

Closed
AdrianEddy opened this issue Nov 4, 2022 · 3 comments
Closed

0.71.0 Cannot compile for Android #392

AdrianEddy opened this issue Nov 4, 2022 · 3 comments

Comments

@AdrianEddy
Copy link
Sponsor

Since 4a15ef2 I'm getting the following build error when trying to compile for Android (aarch64-linux-android)

error[E0308]: arguments to this function are incorrect
    --> .cargo\registry\src\github.com-1ecc6299db9ec823\opencv-0.71.0\src\opencv\hub\videoio.rs:1956:12
     |
1956 | ... { sys::cv_VideoWriter_fourcc_char_char_char_char(u8::try_from(c1)? as c_char, u8::try_from(c2)? as c_char, u8::try_from(c3)? as c_char, u8::try_from(c4)? as c_char, o...
     |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------------------  ---------------------------  ---------------------------  --------------------------- expected `i8`, found `u8`
     |                                                      |                            |                            |
     |                                                      |                            |                            expected `i8`, found `u8`
     |                                                      |                            expected `i8`, found `u8`
     |                                                      expected `i8`, found `u8`
     |
note: function defined here
    --> C:\Users\Eddy\.cargo\registry\src\github.com-1ecc6299db9ec823\opencv-0.71.0\src\opencv\hub\sys.rs:4229:10
     |
4229 |         pub fn cv_VideoWriter_fourcc_char_char_char_char(c1: i8, c2: i8, c3: i8, c4: i8, ocvrs_return: *mut Result<i32>);
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
     |
1956 |         unsafe { sys::cv_VideoWriter_fourcc_char_char_char_char((u8::try_from(c1)? as c_char).try_into().unwrap(), u8::try_from(c2)? as c_char, u8::try_from(c3)? as c_char, u8::try_from(c4)? as c_char, ocvrs_return.as_mut_ptr()) };
     |                                                                 +                           +++++++++++++++++++++
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
     |
1956 |         unsafe { sys::cv_VideoWriter_fourcc_char_char_char_char(u8::try_from(c1)? as c_char, (u8::try_from(c2)? as c_char).try_into().unwrap(), u8::try_from(c3)? as c_char, u8::try_from(c4)? as c_char, ocvrs_return.as_mut_ptr()) };
     |                                                                                              +                           +++++++++++++++++++++
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
     |
1956 |         unsafe { sys::cv_VideoWriter_fourcc_char_char_char_char(u8::try_from(c1)? as c_char, u8::try_from(c2)? as c_char, (u8::try_from(c3)? as c_char).try_into().unwrap(), u8::try_from(c4)? as c_char, ocvrs_return.as_mut_ptr()) };
     |                                                                                                                           +                           +++++++++++++++++++++
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
     |
1956 |         unsafe { sys::cv_VideoWriter_fourcc_char_char_char_char(u8::try_from(c1)? as c_char, u8::try_from(c2)? as c_char, u8::try_from(c3)? as c_char, (u8::try_from(c4)? as c_char).try_into().unwrap(), ocvrs_return.as_mut_ptr()) };
     |                                                                                                                                                        +                           +++++++++++++++++++++

0.70.0 compiles and works fine

@twistedfall
Copy link
Owner

Thanks for the report, it should be fixed in v0.72.1!

@dopaminista
Copy link

Hi could you share your env variables and give some tips about CMakeList.txt in your android project

@AdrianEddy
Copy link
Sponsor Author

What exactly do you want to know? I just used the standard env variables + prebuilt android opencv package from https://opencv.org/releases/

$Env:LIBCLANG_PATH = "$PROJECT_DIR\ext\llvm-15-win64\bin"
$Env:OPENCV_LINK_LIBS = "opencv_calib3d,opencv_features2d,opencv_imgproc,opencv_video,opencv_flann,opencv_core,tegra_hal,tbb,ittnotify,z"
$Env:OPENCV_LINK_PATHS = "$PROJECT_DIR\ext\OpenCV-android-sdk\sdk\native\staticlibs\arm64-v8a,$PROJECT_DIR\ext\OpenCV-android-sdk\sdk\native\3rdparty\libs\arm64-v8a"
$Env:OPENCV_INCLUDE_PATHS = "$PROJECT_DIR\ext\OpenCV-android-sdk\sdk\native\jni\include"

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