Skip to content

core: try to solve warnings caused by Apple's new LAPACK interface#24804

Merged
asmorkalov merged 8 commits intoopencv:4.xfrom
fengyuentau:fix_lapack_warnings
May 21, 2024
Merged

core: try to solve warnings caused by Apple's new LAPACK interface#24804
asmorkalov merged 8 commits intoopencv:4.xfrom
fengyuentau:fix_lapack_warnings

Conversation

@fengyuentau
Copy link
Copy Markdown
Member

@fengyuentau fengyuentau commented Jan 2, 2024

Resolves #24660

Apple's BLAS documentation: https://developer.apple.com/documentation/accelerate/blas?language=objc

New interface since macOS >= 13.3, iOS >= 16.4.

Todo:

  • Detect macOS version.
  • Detect iOS versions (major and minor version). No calling of Accelerate New LAPACK on iOS.
  • Solve calling cblas_cgemm and cblas_zgemm.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov
Copy link
Copy Markdown
Contributor

See https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html for the first item. Looks like it's what you need.

@asmorkalov

This comment was marked as resolved.

@asmorkalov

This comment was marked as resolved.

@fengyuentau

This comment was marked as resolved.

@fengyuentau

This comment was marked as resolved.

@asmorkalov asmorkalov added this to the 4.10.0 milestone Mar 31, 2024
@fengyuentau fengyuentau marked this pull request as ready for review April 17, 2024 04:38
@fengyuentau fengyuentau self-assigned this Apr 17, 2024
@fengyuentau
Copy link
Copy Markdown
Member Author

@vpisarev @asmorkalov @opencv-alalek Could you review and merge if no further changes are needed?

@asmorkalov asmorkalov merged commit 49f80cb into opencv:4.x May 21, 2024
@fengyuentau fengyuentau deleted the fix_lapack_warnings branch May 22, 2024 06:44
Junyan721113 pushed a commit to plctlab/opencv that referenced this pull request May 22, 2024
core: try to solve warnings caused by Apple's new LAPACK interface opencv#24804

Resolves opencv#24660

Apple's BLAS documentation: https://developer.apple.com/documentation/accelerate/blas?language=objc

New interface since macOS >= 13.3, iOS >= 16.4.

Todo:

- [x] Detect macOS version.
- [x] ~Detect iOS versions (major and minor version).~ No calling of Accelerate New LAPACK on iOS.
- [x] Solve calling `cblas_cgemm` and `cblas_zgemm`.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
Comment on lines +115 to +117
execute_process(COMMAND sw_vers -productVersion
OUTPUT_VARIABLE MACOS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem... it checks the version of macOS on the machine doing the compiling, it does not check the version of macOS that's actually running the code (at runtime). It's common for a developer to be using a new macOS but wanting his code to still run on an old macOS, and that's why these kinds of checks are inappropriate.

Instead, we must check against the 'deployment target' chosen by the developer, set in CMAKE_OSX_DEPLOYMENT_TARGET.

Could we revert this merge, or correct this quickly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me take care of this. cc @asmorkalov @opencv-alalek

asmorkalov pushed a commit that referenced this pull request May 30, 2024
core: deployment compatibility for old mac after Accelerate New LAPACK fix #25625

Attempt to fix #24804 (comment)

We may need to explicitly add build option `-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0` or environment variable (`export MACOSX_DEPLOYMENT_TARGET=12.0`) for mac builds (python package most probably) on builders with new macOS (>= 13.3).

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
@mshabunin mshabunin mentioned this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS] Apple is deprecating CLAPACK interface since macOS 13.3

3 participants