The solution to the undefined reference to `jpeg_default_qtables' error when compiling opencv4.2

  • Operating system: kylinV10
  • opencv version: 4.2.0

When compiling the version of opencv4.2.0, an error message of undefined reference to `jpeg_default_qtables' appears, which causes the openc compilation to be interrupted and cannot continue to compile, so this error must be resolved.

solution

Check the wrong name. According to the name analysis, it is very likely that the jpeg third-party library is not installed in the current system. Go to http://www.ijg.org/ to download the latest source package jpegsrc.v9e.tar.gz, as follows Start compiling and installing in sequence:

tar -xzvf jpegsrc.v9e.tar.gz 
cd jpeg-9e
 ./configure
 make libdir=/usr/lib64 
  make libdir=/usr/lib64 install

After executing the above command, the final displayed output of the command line is as follows:

make[1]: Entering directory '/data3/deepblue/projects/build/jpeg-9e'
 /usr/bin/mkdir -p '/usr/lib64'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libjpeg.la '/usr/lib64'
libtool: install: /usr/bin/install -c .libs/libjpeg.so.9.5.0 /usr/lib64/libjpeg.so.9.5.0
libtool: install: (cd /usr/lib64 && {
    
     ln -s -f libjpeg.so.9.5.0 libjpeg.so.9 || {
    
     rm -f libjpeg.so.9 && ln -s libjpeg.so.9.5.0 libjpeg.so.9; }; })
libtool: install: (cd /usr/lib64 && {
    
     ln -s -f libjpeg.so.9.5.0 libjpeg.so || {
    
     rm -f libjpeg.so && ln -s libjpeg.so.9.5.0 libjpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libjpeg.lai /usr/lib64/libjpeg.la
libtool: install: /usr/bin/install -c .libs/libjpeg.a /usr/lib64/libjpeg.a
libtool: install: chmod 644 /usr/lib64/libjpeg.a
libtool: install: ranlib /usr/lib64/libjpeg.a
libtool: finish: PATH="/root/.vscode-server/bin/8dfae7a5cd50421d10cd99cb873990460525a898/bin/remote-cli:/data/home/tdsql/jdk/bin:/usr/local/bin:/data/home/tdsql/jdk/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/data/home/tdsql/hadoop/bin:/data/home/tdsql/hadoop/sbin:/usr/local/cuda-11.4/bin:/root/bin:/data/home/tdsql/hadoop/bin:/data/home/tdsql/hadoop/sbin:/usr/local/cuda-11.4/bin:/root/bin:/sbin" ldconfig -n /usr/lib64
ldconfig: /usr/lib64/libLLVM-7.so is not a symbolic link

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib64

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/usr/local/bin'
  /bin/sh ./libtool   --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/cjpeg /usr/local/bin/cjpeg
libtool: install: /usr/bin/install -c .libs/djpeg /usr/local/bin/djpeg
libtool: install: /usr/bin/install -c .libs/jpegtran /usr/local/bin/jpegtran
libtool: install: /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
libtool: install: /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
/bin/sh /data3/deepblue/projects/build/jpeg-9e/install-sh -d /usr/local/include
/usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
 /usr/bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 jerror.h jmorecfg.h jpeglib.h '/usr/local/include'
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 '/usr/local/share/man/man1'
 /usr/bin/mkdir -p '/usr/lib64/pkgconfig'
 /usr/bin/install -c -m 644 libjpeg.pc '/usr/lib64/pkgconfig'
make[1]: Leaving directory '/data3/deepblue/projects/build/jpeg-9e'

It means that jpeg is installed successfully, and opencv can continue to compile.

Guess you like

Origin blog.csdn.net/jndingxin/article/details/124091793