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 failed #356

Closed Marston closed 1 year ago

Marston commented 1 year ago

Trying to build jasper 4.0.0 in WSL2 Windows 11. The build is completely inside Ubuntu 22.0.04 LTS. I have the following STDC installed:

libstdc++-11-dev/jammy-updates,jammy-security,now 11.3.0-1ubuntu1~22.04 amd64 [installed,automatic]
libstdc++6/jammy-updates,jammy-security,now 12.1.0-2ubuntu1~22.04 amd64 [installed,automatic]

But cmake cannot find this lib. Here's the steps that I have done in this install and the error:

$ cmake -B "build" -DCMAKE_INSTALL_PREFIX=/usr/local/jasper-4.0.0
Software version: 4.0.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.3.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
CMake Error at build/cmake/modules/JasGetStdcVersion.cmake:13 (try_run):
  Failed to open
    /home/xx/grib2iolibs/jasper-4.0.0/build/build/cmake/src/CMakeFiles/CMakeTmp/CMakeLists.txt
  Not a directory
Call Stack (most recent call first):
  CMakeLists.txt:426 (jas_get_stdc_version)
CMake Error at CMakeLists.txt:428 (message):
  Cannot determine the value of __STDC_VERSION__.
-- Configuring incomplete, errors occurred!
See also "/home/xx/grib2iolibs/jasper-4.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/xx/grib2iolibs/jasper-4.0.0/build/CMakeFiles/CMakeError.log".

Is the problem libstdc++-11-dev that it is the wrong version? Not sure why this jasper is not finding the library.

mdadams commented 1 year ago

I am at a loss to explain what is happening. The GitHub CI framework builds every pushed commit against Ubuntu 22.04 and 20.04. JasPer builds fine for these platforms. The strange thing is that you did not set JAS_ENABLE_CXX to true. So, the build should not be trying to use the C++ standard library at all. I made a small change to the top-level CMakeLists.txt file in case this might help your situation. Give it a try. It is in commit 354722a9a42e502092c31941913f4552bb72eb63.

Marston commented 1 year ago

Thanks for the response. I did get jasper 4.0 installed via mamba and then I added that path to my PATH. It seemed to work but I'm not done with installing NCEPLIBS-g2c and then installing grib2io, which needs jasper. I'll give it try today, if time permits, but either way I'll let you know if your change works.

Marston commented 1 year ago

@mdadams I simply edited in your changes in jasper-4.0.0/CMakeLists.txt at the lines listed in the commit but and then tried to run sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/jasper-4.0.0 .. but it gives the same error:

 sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/jasper-4.0.0 ..
Software version: 4.0.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.3.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
CMake Error at build/cmake/modules/JasGetStdcVersion.cmake:13 (try_run):
  Failed to open
    /home/mward/grib2iolibs/jasper-4.0.0/build/build/cmake/src/CMakeFiles/CMakeTmp/CMakeLists.txt
  Not a directory
Call Stack (most recent call first):
  CMakeLists.txt:433 (jas_get_stdc_version)

CMake Error at CMakeLists.txt:435 (message):
  Cannot determine the value of __STDC_VERSION__.
-- Configuring incomplete, errors occurred!
See also "/home/mward/grib2iolibs/jasper-4.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/mward/grib2iolibs/jasper-4.0.0/build/CMakeFiles/CMakeError.log".

I was able to install jasper 4.0 via mamba so I'm not I want to pursue this at this time. If I need to install this again, I'll try it in a dockerfile.

mdadams commented 1 year ago

Since you're not going to pursue this matter further, I am closing the issue. If you decide to pursue this matter further at some later point, you should use the code from the master branch (not the 4.0.0 code), since we want to know if the most recent version of JasPer (i.e., the version at the tip of the master branch) has a bug, not 4.0.0 (which is not the most recent version).

ptribble commented 7 months ago

As I found this having hit exactly the same error, I'll add a solution for the next person:

Don't use "build" as the build directory, either via "cmake -B build" or "mkdir build && cd build && cmake ..", because there's already a subdirectory called "build" in the source tree and cmake gets terribly confused. Just use a different name that doesn't conflict, or build outside the source tree entirely (which is what the CI build does, I think).

It's unfortunate that the common pattern of a "build" subdirectory inside the source tree, which is what the cmake documentation itself gives as a standard example, doesn't work in an increasing number of cases like this one.