jasper-software / jasper

Official Repository for the JasPer Image Coding Toolkit
http://www.ece.uvic.ca/~mdadams/jasper
Other
217 stars 103 forks source link

jas_get_ctx_internal: Assertion `ctx' failed. #373

Closed Kishore-kavi96 closed 5 months ago

Kishore-kavi96 commented 5 months ago

**When we build the source file with default configuration it is building succeed but when i run the I'm getting "jas_get_ctx_internal: Assertion `ctx' failed."

jasper-master version -4.2.0**

cmake -H"/home/mglocadmin/Documents/jasper-version-4.2.0/" -B"/home/mglocadmin/Documents/jasper-version-4.2.0/buildcom" -DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_BUILD_TYPE=Debug -DJAS_ENABLE_MULTITHREADING_SUPPORT=True Software version: 4.2.0 Shared library ABI version: 7 Shared library build version: 7.0.0 CMAKE_VERSION: 3.22.1 CMAKE_C_COMPILER_ID: GNU CMAKE_C_COMPILER_VERISON: 11.4.0 JAS_MULTICONFIGURATION_GENERATOR FALSE CMAKE_BUILD_TYPE: Debug CMAKE_C_COMPILER_ID: GNU CMAKE_C_COMPILER: /usr/bin/cc CMAKE_LINKER: /usr/bin/ld CMAKE_C_FLAGS: -pedantic CMAKE_C_FLAGS_RELEASE: -O3 CMAKE_C_FLAGS_DEBUG: -g STDC_VERSION: 201112L JAS_HAVE_MAX_ALIGN_T: 1 -- Check size of char -- Check size of char - done JAS_SIZEOF_CHAR: 1 -- Check size of int -- Check size of int - done JAS_SIZEOF_INT: 4 -- Check size of long -- Check size of long - done JAS_SIZEOF_LONG: 8 -- Check size of long long -- Check size of long long - done JAS_SIZEOF_LLONG: 8 -- Check size of size_t -- Check size of size_t - done JAS_SIZEOF_SIZE_T: 8 -- Check size of ssize_t -- Check size of ssize_t - done JAS_HAVE_SSIZE_T: -- Check size of int_fast32_t -- Check size of int_fast32_t - done JAS_SIZEOF_INT_FAST32_T: 8 -- Check size of int_least32_t -- Check size of int_least32_t - done JAS_SIZEOF_INT_LEAST32_T: 4 -- Check size of int_fast64_t -- Check size of int_fast64_t - done JAS_SIZEOF_INT_FAST64_T: 8 -- Check size of int_least64_t -- Check size of int_least64_t - done JAS_SIZEOF_INT_LEAST64_T: 8 -- Check size of int128_t -- Check size of int128_t - done JAS_SIZEOF_INT128_T: 16 JAS_ENABLE_MIF_CODEC: OFF Support for all native codecs has been included. Threading support enabled. Threads_FOUND: TRUE Pthread library: /usr/lib/x86_64-linux-gnu/libpthread.a Prefer POSIX threading support: ON Threading support found: TRUE C11 threading support detected: TRUE POSIX threading support detected: TRUE WIN32 threading support detected: FALSE C11 threading support selected: FALSE POSIX threading support selected: TRUE Win32 threading support selected: FALSE Threading library: /usr/lib/x86_64-linux-gnu/libpthread.a _Thread_local: TRUE -- Checking for module 'glut' -- No package 'glut' found target: OpenGL::GL OpenGL::GL: adding include directory /usr/include target: OpenGL::GLU target: GLUT::GLUT GLUT::GLUT: adding include directory /usr/include CMAKE_REQUIRE_INCLUDES /usr/include;/usr/include target: JPEG::JPEG JPEG::JPEG: adding include directory /usr/local/include JAS_INCLUDE_JPG_CODEC: ON JAS_INCLUDE_HEIC_CODEC: ON -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Could NOT find LATEX (missing: LATEX_COMPILER PDFLATEX) PDFLATEX_COMPILER: PDFLATEX_COMPILER-NOTFOUND LATEX_FOUND FALSE -- Configuring done -- Generating done

i use gdb

(gdb) run test_1.jpg test.jp2 Starting program: /home/mglocadmin/Documents/encoder test_1.jpg test.jp2 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". encoder: /home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_init.c:919: jas_get_ctx_internal: Assertion `ctx' failed.

Program received signal SIGABRT, Aborted. __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352660800) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: No such file or directory. (gdb) break Breakpoint 1 at 0x7ffff7c969fc: file ./nptl/pthread_kill.c, line 44. (gdb) backtrace

0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352660800) at ./nptl/pthread_kill.c:44

1 __pthread_kill_internal (signo=6, threadid=140737352660800) at ./nptl/pthread_kill.c:78

2 __GI___pthread_kill (threadid=140737352660800, signo=signo@entry=6) at ./nptl/pthread_kill.c:89

3 0x00007ffff7c42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26

4 0x00007ffff7c287f3 in __GI_abort () at ./stdlib/abort.c:79

5 0x00007ffff7c2871b in __assert_fail_base (fmt=0x7ffff7ddd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7ffff7f758f7 "ctx",

file=0x7ffff7f75248 "/home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_init.c", line=919, function=<optimized out>) at ./assert/assert.c:92

6 0x00007ffff7c39e96 in __GI___assert_fail (assertion=0x7ffff7f758f7 "ctx", file=0x7ffff7f75248 "/home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_init.c", line=919,

function=0x7ffff7f759c0 <__PRETTY_FUNCTION__.0> "jas_get_ctx_internal") at ./assert/assert.c:101

7 0x00007ffff7f3121e in jas_get_ctx_internal () at /home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_init.c:919

8 0x00007ffff7f2b640 in jas_get_ctx () at /home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/include/jasper/jas_init.h:407

9 0x00007ffff7f2d84e in jas_image_lookupfmtbyid (id=65536) at /home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_image.c:980

10 0x00007ffff7f2c081 in jas_image_decode (in=0x7fffffffdfc5, fmt=65536, optstr=0x0) at /home/mglocadmin/Documents/jasper-version-4.2.0/src/libjasper/base/jas_image.c:436

11 0x00005555555552f3 in main (argc=3, argv=0x7fffffffdbc8) at jpeg2000_encoder.c:18

mdadams commented 5 months ago

This assertion failing is an indication that the JasPer library has not been properly initialized. Have you read the documentation on JasPer initialization? How are you initializing the library?

mdadams commented 5 months ago

Since the above assertion failing is an indication that you are not initializing the JasPer library correctly and I have not received any further information from you that would indicate a bug in the JasPer code, I am closing this issue.

Kishore-kavi96 commented 5 months ago

cmake -H"/home/mglocadmin/Documents/jasper-version-4.2.0/" -B"/home/mglocadmin/Documents/jasper-version-4.2.0/buildcom" -DCMAKE_INSTALL_PREFIX="/usr/local" DCMAKE_BUILD_TYPE=Debug -DJAS_ENABLE_MULTITHREADING_SUPPORT=True cmake -H"/home/mglocadmin/Documents/jasper-version-4.2.0/" -B"/home/mglocadmin/Documents/jasper-version-4.2.0/buildcom" -DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_BUILD_TYPE=Debug -DJAS_ENABLE_MULTITHREADING_SUPPORT=True cmake --build /home/mglocadmin/Documents/jasper-version-4.2.0/buildcom ctest --output-on-failure sudo cmake --build /home/mglocadmin/Documents/jasper-version-4.2.0/buildcom --target install

This are the commands which i have used for jasper installion

mdadams commented 4 months ago

As I said before, the assertion that is failing is indicating that the JasPer library has not been properly initialized. How you build the library is not of immediate concern. How are you initializing the JasPer library in your code? Clearly, you are not running the JasPer application programs, since the program that you are debugging with gdb is called "encoder", which is not part of JasPer. So, whoever wrote the "encoder" program (which I presume is you) needs to read the JasPer documentation in order to ensure that they correctly initialize the JasPer library.