当前位置:网站首页>Reinstall opencv and step on the pit.

Reinstall opencv and step on the pit.

2022-06-13 01:22:00 Zhao_| adult

Write it at the front : This installation is on Ubuntu 16.04 Platform installation , Not only do you need to configure opencv You also need to configure annaconda, Because it was installed before , Therefore, there are many errors reported this time .

summary : To avoid potential Python Or others Conflict , You should install opencv To configure annaconda Environmental Science , otherwise Can lead to annaconda The configuration in the environment is the same as that of other installations Configuration conflict , Such conflicts are generally difficult to detect , So before that, open ~ .bashrc Document notes are related to annaconda Configuration and related Python Configuration of ( Only note the installed , Do not comment on its system configuration );

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\[email protected]\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to [email protected]:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\[email protected]\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi


##  Note the following things 
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/mrzhao/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/home/mrzhao/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/mrzhao/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/home/mrzhao/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH

export PYTHONHOME=/home/mrzhao/anaconda3/envs/DPT

1. Question 1

../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::~RE()': ts_gtest.cpp:(.text._ZN7testing8internal2RED2Ev+0xf): undefined reference to `regfreeA' ts_gtest.cpp:(.text._ZN7testing8internal2RED2Ev+0x18): undefined reference to `regfreeA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::FullMatch(char const*, testing::internal::RE const&)':
ts_gtest.cpp:(.text._ZN7testing8internal2RE9FullMatchEPKcRKS1_+0x32): undefined reference to `regexecA' ../../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_+0x32): undefined reference to `regexecA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::DeathTestImpl::Passed(bool)':
ts_gtest.cpp:(.text._ZN7testing8internal13DeathTestImpl6PassedEb+0x457): undefined reference to `regexecA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::Init(char const*)': ts_gtest.cpp:(.text._ZN7testing8internal2RE4InitEPKc+0x72): undefined reference to `regcompA' ts_gtest.cpp:(.text._ZN7testing8internal2RE4InitEPKc+0x94): undefined reference to `regcompA'
collect2: error: ld returned 1 exit status
modules/core/CMakeFiles/opencv_perf_core.dir/build.make:551: recipe for target 'bin/opencv_perf_core' failed
make[2]: *** [bin/opencv_perf_core] Error 1
CMakeFiles/Makefile2:3102: recipe for target 'modules/core/CMakeFiles/opencv_perf_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
[ 63%] Linking CXX executable ../../bin/opencv_test_core
../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::~RE()': ts_gtest.cpp:(.text._ZN7testing8internal2RED2Ev+0xf): undefined reference to `regfreeA' ts_gtest.cpp:(.text._ZN7testing8internal2RED2Ev+0x18): undefined reference to `regfreeA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::FullMatch(char const*, testing::internal::RE const&)':
ts_gtest.cpp:(.text._ZN7testing8internal2RE9FullMatchEPKcRKS1_+0x32): undefined reference to `regexecA' ../../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_+0x32): undefined reference to `regexecA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::DeathTestImpl::Passed(bool)':
ts_gtest.cpp:(.text._ZN7testing8internal13DeathTestImpl6PassedEb+0x457): undefined reference to `regexecA' ../../lib/libopencv_ts.a(ts_gtest.cpp.o): In function `testing::internal::RE::Init(char const*)': ts_gtest.cpp:(.text._ZN7testing8internal2RE4InitEPKc+0x72): undefined reference to `regcompA' ts_gtest.cpp:(.text._ZN7testing8internal2RE4InitEPKc+0x94): undefined reference to `regcompA'
collect2: error: ld returned 1 exit status
modules/core/CMakeFiles/opencv_test_core.dir/build.make:567: recipe for target 'bin/opencv_test_core' failed
make[2]: *** [bin/opencv_test_core] Error 1
CMakeFiles/Makefile2:3070: recipe for target 'modules/core/CMakeFiles/opencv_test_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_test_core.dir/all] Error 2
Makefile:165: recipe for target 'all' failed

2. resolvent


Refer to the connection

Finally!!!
This undefined bug is because boost and linux system have the same regex.h file. And renaming this file of boost temporally can fix this. ref: https://groups.google.com/forum/#!searchin/caffe-users/regex.h/caffe-users/zTfFsRnNl9c/ckD-bar6BAAJ
So at the end I use my boost 1.59 and opencv2.4.12. and make the right opencv path for denseflow. this bug is fixed.

// This is because boost Kuhe linux system The library has the same regex.h, Delete boost library , Install if necessary ;

3. Question two


//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFReadRGBAI[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' //usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' collect2: error: ld returned 1 exit status modules/viz/CMakeFiles/opencv_test_viz.dir/build.make:184: recipe for target 'bin/opencv_test_viz' failed make[2]: *** [bin/opencv_test_viz] Error 1 CMakeFiles/Makefile2:4984: recipe for target 'modules/viz/CMakeFiles/opencv_test_viz.dir/all' failed
make[1]: *** [modules/viz/CMakeFiles/opencv_test_viz.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs...

/usr/bin/ld: warning: libopencv_core.so.2.4, needed by //usr/lib/x86_64-linux-gnu/libavfilter-ffmpeg.so.5, may conflict with libopencv_core.so.3.1
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' /usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `[email protected]_4.0' collect2: error: ld returned 1 exit status CMakeFiles/rgbd_tum.dir/build.make:171: recipe for target '../Examples/RGB-D/rgbd_tum' failed make[2]: *** [../Examples/RGB-D/rgbd_tum] Error 1 CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/rgbd_tum.dir/all' failed make[1]: *** [CMakeFiles/rgbd_tum.dir/all] Error 2 Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2


4. Solution

Custom build environments are not tested and probably not supported.
TIFF may depend on JPEG codec. You have these libs in different “locations”.,
// In different places , Multiple versions are installed tiff5–> Remove redundant tiff5, see .bashrc Is it in line with what you started to write ;

ps: install tiff5

sudo apt-get install libtiff5-dev

summary : In case of problems Google Browser search , solve the problem It's more efficient ;

原网站

版权声明
本文为[Zhao_| adult]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280553072706.html