# Error building from Linux tutorial

**URL:** <https://forum.opencv.org/t/error-building-from-linux-tutorial/13251>\
**Category:** C++\
**Tags:** highgui, build, imgcodecs\
**Created:** [May 21, 2023, 12:39am UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251 "2023-05-21T00:39:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtsysin](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mtsysin](https://forum.opencv.org/u/mtsysin)\
**Post date:** [May 21, 2023, 12:39am UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251/1 "2023-05-21T00:39:44Z")

</div>

I was trying to follow the Liunx instructions here: [OpenCV: Installation in Linux](https://docs.opencv.org/4.7.0/d7/d9f/tutorial_linux_install.html), but in the build stage I get the following error:

```auto
[22%] Linking CXX shared library ../../lib/libopencv_imgcodecs.so
CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg.cpp.o: In function `cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x6db): undefined reference to `jpeg_default_qtables'
CMakeFiles/opencv_imgcodecs.dir/src/grfmt_png.cpp.o: In function `cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x3cb): undefined reference to `png_get_eXIf_1'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x491): undefined reference to `png_get_eXIf_1'
/usr/bin/ld: link errors found, deleting executable `../../lib/libopencv_imgcodecs.so.4.7.0'
/usr/bin/sha1sum: ../../lib/libopencv_imgcodecs.so.4.7.0: No such file or directory
collect2: error: ld returned 1 exit status
gmake[2]: *** [lib/libopencv_imgcodecs.so.4.7.0] Error 1
gmake[1]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
gmake: *** [all] Error 2

```

Do you have any suggestions? I tried to modify LD\_LIBRARY\_PATH to point to libpng.so, but this didn’t help.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 21, 2023, 5:43am UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251/2 "2023-05-21T05:43:13Z")

</div>

looks like there’s an unexpected png version installed on your box. try to use the 3rd party version, that comes with the opencv src code:

```
cmake -DBUILD_PNG=ON ....

```

(so it won’t rely on your system’s libpng anymore)

---

<div class="post-metadata">

**Author:** ![mtsysin](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mtsysin](https://forum.opencv.org/u/mtsysin)\
**Post date:** [May 21, 2023, 6:35pm UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251/3 "2023-05-21T18:35:25Z")

</div>

Thanks, I did the same for JPEG and TIFF:  
cmake -DBUILD\_ZLIB=ON -DBUILD\_JPEG=ON -DBUILD\_PNG=ON -DBUILD\_TIFF=ON …/opencv-master  
It looks like it helped, but now I’m stuck with a different error:

```auto
[72%] Linking CXX executable ../../bin/opencv_test_highgui
/usr/lib64/libfontconfig.so: undefined reference to `uuid_parse@UUID_1.0'
/usr/lib64/libfontconfig.so: undefined reference to `uuid_generate_random@UUID_1.0'
/usr/lib64/libfontconfig.so: undefined reference to `uuid_unparse@UUID_1.0'
/usr/lib64/libfontconfig.so: undefined reference to `uuid_copy@UUID_1.0'
/usr/bin/ld: link errors found, deleting executable `../../bin/opencv_test_highgui'
/usr/bin/sha1sum: ../../bin/opencv_test_highgui: No such file or directory
collect2: error: ld returned 1 exit status
gmake[2]: *** [bin/opencv_test_highgui] Error 1
gmake[1]: *** [modules/highgui/CMakeFiles/opencv_test_highgui.dir/all] Error 2
gmake: *** [all] Error 2

```

I’m working on a remote server.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 22, 2023, 4:58am UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251/4 "2023-05-22T04:58:56Z")

</div>

> [@mtsysin](#):
>
> I’m working on a remote server.

hmm do you _really_ need _any_ gui there ?

also, just curious, do you have **root** access on that box ?  
(more info on that server, please !)

how do you plan to use it, c++ dev ? python ?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [May 22, 2023, 7:09am UTC](https://forum.opencv.org/t/error-building-from-linux-tutorial/13251/5 "2023-05-22T07:09:56Z")

</div>

if you run your program on a remote server, you will **not** get **any GUI** on your local computer from that program.

the truth is that yes there are ways but it’s a bad idea and “no” is the answer that doesn’t complicate your situation further.
