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

Build failure in JasGetStdcVersion.cmake #364

Closed eyalroz closed 7 months ago

eyalroz commented 7 months ago

I'm trying to build Jasper 4.1.0, from the release source tarball. While configuring the build with CMake (v3.27.6) I get:

CMake Error at build/cmake/modules/JasGetStdcVersion.cmake:13 (try_run):
  Failed to open

    /usr/local/src/jasper-version-4.1.0/build/build/cmake/src/CMakeFiles/CMakeTmp/CMakeLists.txt

  Not a directory
Call Stack (most recent call first):
  CMakeLists.txt:437 (jas_get_stdc_version)

CMake Error at CMakeLists.txt:439 (message):
  Cannot determine the value of __STDC_VERSION__.

My system is Devuan GNU/Linux excalibur (like Debian trixie without systemd).

mdadams commented 7 months ago

It is impossible to give any useful help since you have not specified exactly how you are building JasPer. Please provide more information.

eyalroz commented 7 months ago

It is impossible to give any useful help since you have not specified exactly how you are building JasPer. Please provide more information.

Is this sufficient? If not, please let me know what additional information you need

ccmake options:

ALLOW_IN_SOURCE_BUILD            OFF
 BUILD_TESTING                    ON
 CMAKE_BUILD_TYPE
 CMAKE_INSTALL_PREFIX             /usr/local
 JAS_DEFAULT_MAX_MEM_USAGE        1073741824
 JAS_ENABLE_32BIT                 OFF
 JAS_ENABLE_ASAN                  OFF
 JAS_ENABLE_BMP_CODEC             ON
 JAS_ENABLE_CONFORMANCE_TESTS     OFF
 JAS_ENABLE_CXX                   OFF
 JAS_ENABLE_DANGEROUS_INTERNAL_   OFF
 JAS_ENABLE_DOC                   ON
 JAS_ENABLE_HEIC_CODEC            OFF
 JAS_ENABLE_HIDDEN                ON
 JAS_ENABLE_JP2_CODEC             ON
 JAS_ENABLE_JPC_CODEC             ON
 JAS_ENABLE_JPG_CODEC             ON
 JAS_ENABLE_LATEX                 ON
 JAS_ENABLE_LIBHEIF               ON
 JAS_ENABLE_LIBJPEG               ON
 JAS_ENABLE_LSAN                  OFF
 JAS_ENABLE_MIF_CODEC             OFF
 JAS_ENABLE_MSAN                  OFF
 JAS_ENABLE_MULTITHREADING_SUPP   ON
 JAS_ENABLE_NON_THREAD_SAFE_DEB   OFF
 JAS_ENABLE_OPENGL                ON
 JAS_ENABLE_PGX_CODEC             ON
 JAS_ENABLE_PIC                   ON
 JAS_ENABLE_PNM_CODEC             ON
 JAS_ENABLE_PROGRAMS              ON
 JAS_ENABLE_RAS_CODEC             ON
 JAS_ENABLE_SHARED                ON
 JAS_ENABLE_TSAN                  OFF
 JAS_ENABLE_UBSAN                 OFF
 JAS_INCLUDE_BMP_CODEC            ON
 JAS_INCLUDE_HEIC_CODEC           ON
JAS_INCLUDE_JP2_CODEC            ON
 JAS_INCLUDE_JPC_CODEC            ON
 JAS_INCLUDE_JPG_CODEC            ON
 JAS_INCLUDE_MIF_CODEC            ON
 JAS_INCLUDE_PGX_CODEC            ON
 JAS_INCLUDE_PNM_CODEC            ON
 JAS_INCLUDE_RAS_CODEC            ON
 JAS_PREFER_PTHREAD               ON
 JAS_PREFER_PTHREAD_TSS           OFF
 JAS_STRICT                       OFF
 JAS_USE_JAS_INIT                 OFF
 JAS_WASM                         OFF

cmake output:

# cmake
Software version: 4.1.0
Shared library ABI version: 7
Shared library build version: 7.0.0
CMAKE_VERSION: 3.27.6
CMAKE_C_COMPILER_ID: GNU
CMAKE_C_COMPILER_VERISON: 13.2.0
JAS_MULTICONFIGURATION_GENERATOR FALSE
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
mdadams commented 7 months ago

Perhaps, the most important thing is the exact manner in which you are running CMake. Sometimes people who do not understand how to use CMake do insane things like telling CMake to use the build directory in the JasPer source tree as the CMake binary/build directory, which can break things badly.

eyalroz commented 7 months ago

Ah. I see the problem now. I used the (rather common) cmake -B build, and because build/ seems to be part of the source tree, that messed things up.

So, you can close this bug, but perhaps you would consider adding a couple of CMake lines to give a warning/error message about this kind of situation?

jubalh commented 7 months ago

We could mention it in the INSTALL file. But we had this issue already several times. Did you look for closed issues before opening this one? If I search for __STDC_VERSION__ I find the old requests.

eyalroz commented 7 months ago

@jubalh : I see #319 , but a cursory glance mentioned some patching, so it didn't seem like what I needed. #358 also has this phrase, but doesn't seem related. But #356 is a dupe of this issue, I think. People tend to search open bugs, not closed ones (which supposedly no longer occur).

A note in INSTALL.txt... it's better than nothing, but probably won't cut it. README.md is even better, but still not that great. I would still make this idiot-proof by comparing ${CMAKE_BINARY_DIR} to ${CMAKE_SOURCE_DIR}/build .

jubalh commented 7 months ago

People tend to search open bugs, not closed ones (which supposedly no longer occur).

They don't. Usually they search both to see if their issue is already solved.

eyalroz commented 7 months ago

ok, s/people/many people/ ...

mdadams commented 7 months ago

It seems that GitHub ate my earlier comment so I will re-type it here:

I have changed the build for JasPer so that it disallows the CMake binary directory being anywhere in the source tree. Previously, JasPer only complained if CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR were equal. Now, it is more strict. (I do, however, allow for some special cases as exceptions, which are deliberately undocumented and for the JasPer development team only.) As a consequence of these changes, JasPer now requires CMake 3.20 or later. This will probably inconvenience some users, but CMake is already at 3.28 so people using older versions should upgrade anyways.

eyalroz commented 7 months ago

This is excellent and I am sure others who need to build Jasper will thank you (albeit in the form of not bothering you with repetitive reports of the same problem...)