Re: [OpenJPEG] Error while loading shared libraries: libopenjp2.so.

667 views
Skip to first unread message

szuk...@arcor.de

unread,
Aug 23, 2016, 12:56:18 PM8/23/16
to open...@googlegroups.com
Have you called 'ldconfig' or 'sudo /sbin/ldconfig'?

If your system uses 'lib64': what do you see with

ls -l /usr/local/lib64/libopenjp*

If your system uses 'lib': what do you see with

ls -l /usr/local/lib/libopenjp*

winfried

Tomáš Dvořák

unread,
Aug 24, 2016, 2:43:20 AM8/24/16
to OpenJPEG
Thank you for reply.

Command ldconfig or sudo /sbin/ldconfig without parameters had no effect. I tried as a root the command ldconfig -v and I got the list of libraries. But there wasn't libopenjp2.so.7 or anything similar in the list. Just for a try I put ldconfig -v * in path /usr/local/lib and it returned:

ldconfig: relative path 'libopenjp2.so' used to build cache

After ls -l /usr/local/lib64/libopenjp* there is:
ls: cannot access /usr/local/lib64/libopenjp*: No such file or directory

After ls -l /usr/local/lib/libopenjp* there is:
lrwxrwxrwx. 1 root root 15 Aug 23 12:54 /usr/local/lib/libopenjp2.so -> libopenjp2.so.7
-rwxr-xr-x. 1 root root 357315 Aug 23 12:54 /usr/local/lib/libopenjp2.so.2.1.1
lrwxrwxrwx. 1 root root 19 Aug 23 12:54 /usr/local/lib/libopenjp2.so.7 -> libopenjp2.so.2.1.1

Tomáš Dvořák

unread,
Aug 24, 2016, 5:06:45 AM8/24/16
to OpenJPEG
I found some solution in URL: https://codeyarns.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/

I set export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib and the error message of shared libraries dissapeared.

Now when I put command:
 opj_compress -i image.tif -o image.jp2

I get the message:
Unable to load file: got no image

But there is the image.tif in the directory.

szuk...@arcor.de

unread,
Aug 24, 2016, 1:44:30 PM8/24/16
to open...@googlegroups.com
On Wed, 24 Aug 2016 02:06:45 -0700 (PDT), Tomas Dvorak wrote:

>Now when I put command:
> opj_compress -i image.tif -o image.jp2
>
>I get the message:
>Unable to load file: got no image
>
>But there is the image.tif in the directory.

opj_compress.c, line 1782:

/* Can happen if input file is TIFF or PNG
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
*/
if( !image) {
fprintf(stderr, "Unable to load file: got no image\n");
return 1;
}

So, I suppose you do not have the TIFF library installed. Or CMAKE
can not find it. cmake-3.5 uses the file:

/usr/share/cmake-3.5/Modules/FindTIFF.cmake


This could be the contents of an opj-cmake.sh:

----------------------------------------
#!/bin/sh
cmake -DBUILD_DOC:bool=on -DBUILD_PKGCONFIG_FILES:bool=on \
-DCMAKE_BUILD_TYPE:string="Release" -DBUILD_VIEWER:bool=off \
-DBUILD_JAVA:bool=off \
-DBUILD_JPIP_SERVER:bool=off -DBUILD_JPIP:bool=off \
-DBUILD_SHARED_LIBS:bool=on -DBUILD_MJ2:bool=on \
-DBUILD_JP3D:bool=on -DBUILD_JPWL:bool=on \
-DBUILD_THIRDPARTY:bool=on ..
---------------------------------------

Copy this shell script to the subdirectory BUILD:

cp opj-cmake.sh openjpeg-2.1.1
cd openjpeg-2.1.1
mkdir BUILD
cd BUILD
cp ../opj-cmake.sh .
./opj-cmake-sh

Then, if the compilation succeeds, try:

bin/opj_compress -i image.tif -o image.jp2

If you have installed the TIFF library, you can add in opj-cmake.sh:

-DTIFF_INCLUDE_DIR:path="path/to/include/"

where the files

tiff.h tiffconf.h tiffio.h tiffio.hxx tiffvers.h

are installed. And do not forget to change '-DBUILD_THIRDPARTY:bool=on'
to '-DBUILD_THIRDPARTY:bool=off'.

winfried

Tomáš Dvořák

unread,
Sep 1, 2016, 7:47:58 AM9/1/16
to OpenJPEG
Hello Winfried, you are right.

The TIFF library were not installed. After installation and repeated compilation with your script the program works.

Thank you once more for your help!
Reply all
Reply to author
Forward
0 new messages