Skip to content

Fix QNX build#24864

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
zchrissirhcz:fix-qnx-build
Jan 16, 2024
Merged

Fix QNX build#24864
asmorkalov merged 1 commit intoopencv:4.xfrom
zchrissirhcz:fix-qnx-build

Conversation

@zchrissirhcz
Copy link
Copy Markdown
Contributor

@zchrissirhcz zchrissirhcz commented Jan 16, 2024

Based on #24567

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

Build locally

Passing -D OPENCV_SKIP_CMAKE_CXX_STANDARD=ON during cmake configure. 100% build success with commit of 2791bb7:

2791bb7062 2024-01-12 | Merge pull request #24773 from tailsu:sd/pathlike (origin/master) [Stefan Dragnev]

QNX SDP version: 7.1.0, which uses a C++ compiler version 8.3.0:

CMAKE_CXX_COMPILER_VERSION=8.3.0

Due to QNX SDP license, I'm not sure if I can provide its installer.

The latest version of QNX SDP can be obtained from its website https://www.qnx.com/account/login.html (a registered account is required. Not tested with its latest QNX SDP yet).

What build errors this PR fixed?

Compile error

This PR fixed several compile error. A minimal reproduce code, which can cause similar compile error when using QNX SDP as toolchain, is this:

#include <iostream>

int main()
{
    std::cout << "hello world" << std::endl;
    return 0;
}

The errors are:

'pthread_mutexattr_settype' was not declared in this scope

'pthread_cond_timedwait' was not declared in this scope

'nanosleep' was not declared in this scope

'PTHREAD_MUTEX_RECURSIVE' was not declared in this scope

'pthread_mutexattr_settype' was not declared in this scope

'pthread_cond_timedwait' was not declared in this scope

'nanosleep' was not declared in this scope

'O_RDONLY' was not declared in this scope

'open' was not declared in this scope

'Elf64_auxv_t' was not declared in this scope

'auxv' was not declared in this scope

error: 'AT_HWCAP' was not declared in this scope

'AT_HWCAP2' was not declared in this scope

'close' was not declared in this scope

The solution is: -D OPENCV_SKIP_CMAKE_CXX_STANDARD=ON

Link error

[ 52%] Linking CXX executable ../../bin/opencv_perf_core
/opt/qnx710/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-ld: ../../lib/libopencv_ts.a(ts_gtest.cpp.o): in function `testing::internal::RE::PartialMatch(char const*, testing::internal::RE const&)':
ts_gtest.cpp:(.text._ZN7testing8internal2RE12PartialMatchEPKcRKS1_+0x38): undefined reference to `regexec'
collect2: error: ld returned 1 exit status
modules/core/CMakeFiles/opencv_perf_core.dir/build.make:599: recipe for target 'bin/opencv_perf_core' failed
make[2]: *** [bin/opencv_perf_core] Error 1
CMakeFiles/Makefile2:1955: recipe for target 'modules/core/CMakeFiles/opencv_perf_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2

The solutions is:

if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
  ocv_target_link_libraries(${the_module} PUBLIC regex)
endif()

@asmorkalov asmorkalov added platform: other platform: arm ARM boards related issues: RPi, NVIDIA TK/TX, etc labels Jan 16, 2024
@asmorkalov asmorkalov added this to the 4.10.0 milestone Jan 16, 2024
@asmorkalov asmorkalov self-requested a review January 16, 2024 08:55
@asmorkalov asmorkalov self-assigned this Jan 16, 2024
@zchrissirhcz
Copy link
Copy Markdown
Contributor Author

Additional notes for QNX SDP 7.0 (QCC 5.4):

If only setting -D OPENCV_SKIP_CMAKE_CXX_STANDARD=ON in cmake configure, there will be compile error:

error: 'M_PI' was not declared in this scope   // in carotene's code
error: 'posix_memalign' was not declared in this scope

My solution to QNX SDP 7.0:
Passing the following args in cmake configure:

-D OPENCV_SKIP_CMAKE_CXX_STANDARD=ON -DBUILD_opencv_gapi=OFF -DWITH_PROTOBUF=OFF -DC_FLAGS="-std=gnu++11"

@zchrissirhcz
Copy link
Copy Markdown
Contributor Author

@asmorkalov I still have a commit in local. Please don't merge before that.

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov merged commit 582561f into opencv:4.x Jan 16, 2024
@zchrissirhcz zchrissirhcz deleted the fix-qnx-build branch January 16, 2024 11:38
zchrissirhcz added a commit to zchrissirhcz/opencv that referenced this pull request Jan 16, 2024
@zchrissirhcz zchrissirhcz mentioned this pull request Jan 16, 2024
6 tasks
zchrissirhcz added a commit to zchrissirhcz/opencv that referenced this pull request Jan 17, 2024
@asmorkalov asmorkalov mentioned this pull request Jan 23, 2024
JStech pushed a commit to JStech/opencv that referenced this pull request Jan 28, 2024
@xi-guo-0 xi-guo-0 mentioned this pull request Feb 27, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build/install platform: arm ARM boards related issues: RPi, NVIDIA TK/TX, etc platform: other

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants