Skip to content

dnn:perf add missing definition __OPENCV_TEST to fix pch - #14196

Merged
opencv-pushbot merged 1 commit into
opencv:3.4from
seiko2plus:issue14195
Mar 31, 2019
Merged

opencv-pushbot merged 1 commit into
opencv:3.4from
seiko2plus:issue14195

Conversation

@seiko2plus

@seiko2plus seiko2plus commented Mar 31, 2019 •

Copy link
Copy Markdown
Contributor

resolves #14195

pw_compilers=clang-4, clang-5, clang-6, gcc-4.9, power9_gcc-5, power9_gcc-6, power9_gcc-7

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@gogogo2018

Copy link
Copy Markdown

Thank you!

@kavfixnel

Copy link
Copy Markdown

I'm having the same issue. Can someone explain what this fix means?

@alalek

alalek commented Apr 1, 2019

Copy link
Copy Markdown
Member

Workaround without fixes: cmake -DENABLE_PRECOMPILED_HEADERS=OFF ...

@alalek alalek mentioned this pull request Apr 1, 2019
@dux-sclavorum

Copy link
Copy Markdown

resolves #14195

pw_compilers=clang-4, clang-5, clang-6, gcc-4.9, power9_gcc-5, power9_gcc-6, power9_gcc-7

Can someone please explain how do I apply this solution? Do I input it as a line in the script or preinstall dependencies? Thank you.

@seiko2plus

Copy link
Copy Markdown
Contributor Author

I'm having the same issue. Can someone explain what this fix means?

@AlexanderProschek, #13932 shared utility functions(print, asserts, etc) in accuracy test with performance test of dnn module by including source code test_common.cpp to performance test's build target, which break pch (precompiled header) that generated during build accuracy test due missing of definition __OPENCV_TEST that only defined by accuracy test's build target.
I fixed this issue by add missing definition __OPENCV_TEST to performance test target but later @alalek rework this fix in #14198 by moving content of "test_common.cpp" into a shareable header file instead.

Can someone please explain how do I apply this solution? Do I input it as a line in the script or preinstall dependencies? Thank you.

@dux-sclavorum, instead of patch or fetch last changes you can workaround this issue by just disable pch using cmake option -DENABLE_PRECOMPILED_HEADERS=OFF just like @alalek mentioned in his previous comment and I apologize I had to mention disable pch as quick fix, however I gonna edit that comment.

@dux-sclavorum

Copy link
Copy Markdown

cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-"$cvVersion" \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ -D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.6/site-packages \ -D WITH_QT=ON \ -D WITH_OPENGL=ON \ -D ENABLE_PRECOMPILED_HEADERS=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ -D BUILD_EXAMPLES=ON ..

When I insert the line in the cmake block, I get this error in the terminal. Thank you for your help thus far. I'm tottaly lost at this point forth.

CMake Error: The source directory "/home/domagoj/opencv/build/ENABLE_PRECOMPILED_HEADERS=OFF" does not exist. Specify --help for usage, or press the help button on the CMake GUI. ./installOpenCV-4-on-Ubuntu-18-04.sh: line 99: -D: command not found make: *** No targets specified and no makefile found. Stop. make: *** No rule to make target 'install'. Stop.

@alalek

alalek commented Apr 2, 2019

Copy link
Copy Markdown
Member

Something is wrong with your command line.
Try to remove space after -D (no idea, because we can't reproduce that)

Anyway, It is enough to update to the latest code for now.

@dux-sclavorum

Copy link
Copy Markdown

This is the script that works for complete installation. The space removal works! Thank you very much!
(change is needed from txt to sh)

installOpenCV-4-on-Ubuntu-18-04.txt

@alalek

alalek commented Apr 2, 2019

Copy link
Copy Markdown
Member

This script has several strange and dangerous parts.

Details
  1. How many aliases do you have at this moment in your profile configuration file?
echo "# Virtual Environment Wrapper" >> ~/.bashrc
echo "alias workoncv-$cvVersion=\"source $cwd/OpenCV-$cvVersion-py3/bin/activate\"" >> ~/.bashrc
  1. Why? CMake Python detection needs this.
    Because of that, the parameter OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.6/site-packages is not needed really.
# quit virtual environment
deactivate
  1. sudo -H pip3 install -U pip numpy before "create virtual environment". You can update your pip in virtualenv only. Main purpose of virtualenv - separate custom python configuration and leave system untouched. This sudo command looks useless.

  2. sudo apt -y install libprotobuf-dev protobuf-compiler - not used (not enabled via OpenCV CMake flags).

  3. sudo apt -y install x264 not used by openCV directly. Probably installed with ffmpeg (avcodec) runtime libraries automatically

  4. No idea why we need this (not used by OpenCV):

sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
  1. Magic? OpenCV don't need this. V4L2 works great.
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
  1. gfortran, yasm - not used

  2. checkinstall - useful, but not used by this script actually

  3. sudo apt -y remove x264 libx264-dev. Removing packages to install something is the primary strange thing really.

  4. rm -rf opencv_contrib/build - where is this directory created?

  5. libjasper1 - probably this command failed due missing package in Ubuntu 18.04. Errors are not handled by script at all.

  6. libxine2-dev package is installed, but corresponding flag is not enabled for OpenCV CMake (-DWITH_XINE=ON)

  7. -D CMAKE_BUILD_TYPE=RELEASE selected automatically.

  8. Provided script may not work because there is "TAB" on the line with ENABLE_PRECOMPILED_HEADERS flag.

@pengyuan-zhou

pengyuan-zhou commented Apr 5, 2019 •

Copy link
Copy Markdown

I'm having the same issue. Can someone explain what this fix means?

@AlexanderProschek, #13932 shared utility functions(print, asserts, etc) in accuracy test with performance test of dnn module by including source code test_common.cpp to performance test's build target, which break pch (precompiled header) that generated during build accuracy test due missing of definition __OPENCV_TEST that only defined by accuracy test's build target.
I fixed this issue by add missing definition __OPENCV_TEST to performance test target but later @alalek rework this fix in #14198 by moving content of "test_common.cpp" into a shareable header file instead.

Can someone please explain how do I apply this solution? Do I input it as a line in the script or preinstall dependencies? Thank you.

@dux-sclavorum, instead of patch or fetch last changes you can workaround this issue by just disable pch using cmake option -DENABLE_PRECOMPILED_HEADERS=OFF just like @alalek mentioned in his previous comment and I apologize I had to mention disable pch as quick fix, however I gonna edit that comment.

Thank you all for the help.

SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
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.

7 participants