Error compiling Colmap x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.

Error compiling Colmap blockbuster (solved)

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadEXIFDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldReadCount@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetTagExtender@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFCurrentDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadTile@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'

I have been researching for many days and have not been able to solve it. It is said on the Internet that QT5 in anaconda is called. I checked the output of CMAKE and found that there is no anaconda. The following is my modification plan, the pro-test is effective

Note that FreeImage version is 3.18.0 libtiff version: 4.0.4

FreeImage download
libtiff download

Step1: In the ~/colmap/build/ directory, check the found Qt directory and remember that it will be used later. For example, here is /usr/lib/x86_64-linux-gnu

vrlab@vrlab3022:~/qys/colmap/build$ cmake ..

insert image description here

Step2: Enter the following command to manually find the path of all libtiff.so in the current system
(if there is anaconda in the system, more entries will be displayed)

vrlab@vrlab3022:~$ locate libtiff.so

/home/vrlab/qys/lib/tiff-4.0.4/libtiff/.libs/libtiff.so
/home/vrlab/qys/lib/tiff-4.0.4/libtiff/.libs/libtiff.so.5
/home/vrlab/qys/lib/tiff-4.0.4/libtiff/.libs/libtiff.so.5.2.2
/snap/gnome-3-34-1804/72/usr/lib/x86_64-linux-gnu/libtiff.so.5
/snap/gnome-3-34-1804/72/usr/lib/x86_64-linux-gnu/libtiff.so.5.3.0
/snap/gnome-3-34-1804/77/usr/lib/x86_64-linux-gnu/libtiff.so.5
/snap/gnome-3-34-1804/77/usr/lib/x86_64-linux-gnu/libtiff.so.5.3.0
/snap/gnome-3-38-2004/87/usr/lib/x86_64-linux-gnu/libtiff.so.5
/snap/gnome-3-38-2004/87/usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0
/snap/snap-store/547/usr/lib/x86_64-linux-gnu/libtiff.so.5
/snap/snap-store/547/usr/lib/x86_64-linux-gnu/libtiff.so.5.3.0
/snap/snap-store/558/usr/lib/x86_64-linux-gnu/libtiff.so.5
/snap/snap-store/558/usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0
/usr/lib/x86_64-linux-gnu/libtiff.so
/usr/lib/x86_64-linux-gnu/libtiff.so.5
/usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0
/usr/local/lib/libtiff.so
/usr/local/lib/libtiff.so.5
/usr/local/lib/libtiff.so.5.4.0

Step3: Then enter the following command, after finding the dependent file, the next step is to replace the path of the library file in other locations of the file

vrlab@vrlab3022:~/qys/colmap/build$ ldd /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfreeimage.so

insert image description here
Step4: Manually replace the libtiff library files found in Step2 one by one

The reason for compiling colmap error is that when compiling and installing different versions of libtiff, libtiff may generate different names under the system (as shown in the figure below), and the name of the link displayed in Step3 is libtiff.so.5, so it may link to the old version of libtiff . So we need to replace.
insert image description here
An alternative could be to create a soft link

ln -s source file object file

The replacement process is as follows:

1. Delete the original link to the file
vrlab@vrlab3022:~/qys/colmap/build$ sudo rm /usr/local/lib/libtiff.so.5

2. Use soft links to link
sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0 /usr/local/lib/libtiff.so.5

3. Enter the colmap/build directory to compile and see if the compilation is successful. If unsuccessful, continue to replace

Then it should be successfully compiled and installed.
Good luck to everyone!

Guess you like

Origin blog.csdn.net/Fucking_Code0916/article/details/121713303