jasper-software / jasper

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

warning: #warning "Your code is being built against an older version of the C standard than JasPer was. #376

Closed bobfriesenhahn closed 6 months ago

bobfriesenhahn commented 6 months ago

After installing CMake 3.22.1 from source code on an Ubuntu 20.04 LTS system, I built JasPer.

This message appeared at the end of the build:

''' [ 98%] Building CXX object src/app/CMakeFiles/test_2.dir/test_2.cpp.o In file included from /home/bfriesen/src/jasper.git/src/app/../libjasper/include/jasper/jasper.h:73, from /home/bfriesen/src/jasper.git/src/app/test_2.cpp:2: /home/bfriesen/src/jasper-build/src/app/../libjasper/include/jasper/jas_config.h:117:2: warning: #warning "Your code is being built against an older version of the C standard than JasPer was. Although this is supported, this may require some extra preprocessor defines when building." [-Wcpp] 117 | #warning "Your code is being built against an older version of the C standard than JasPer was. Although this is supported, this may require some extra preprocessor defines when building." | ^~~



The compiler used is GCC 9.4.0 from 2019.

The error message seems strange and unexpected to me.
mdadams commented 6 months ago

Due to ABI and other issues, most libraries can be used in a way that is inconsistent with the way that they were built and installed. JasPer tries to detect some types of problems of this nature. This particular warning is one example of such a check. This warning is very often benign, but it is better to warn than leave a user scratching their head wondering why their code has gone off the deep end, when the warning is not benign. If the code seems to be working okay, likely the warning is benign, and you can simply ignore it. To avoid the warning, build and install JasPer with the same C language version enabled that you use when building code against JasPer.

bobfriesenhahn commented 6 months ago

As a reminder, this message is coming out of the Jasper CMake build. It is not a case of "other software".

Bob

On Mar 16, 2024, 11:23 PM, at 11:23 PM, Michael Adams @.***> wrote:

Due to ABI and other issues, most libraries can be used in a way that is inconsistent with the way that they were built and installed. JasPer tries to detect some types of problems of this nature. This particular warning is one example of such a check. This warning is very often benign, but it is better to warn than leave a user scratching their head wondering why their code has gone off the deep end, when the warning is not benign. If the code seems to be working okay, likely the warning is benign, and you can simply ignore it. To avoid the warning, build and install JasPer with the same C language version enabled that you use when building code against JasPer.

-- Reply to this email directly or view it on GitHub: https://github.com/jasper-software/jasper/issues/376#issuecomment-2002302596 You are receiving this because you authored the thread.

Message ID: @.***>

mdadams commented 6 months ago

Does the system already have JasPer installed? Picking up headers from an already existing implementation could cause this. Another possibility is that CMake's try_run function is using the wrong -std= option, leading jasPer to deduce the wrong version of the C standard. Another possibility is that JAS_STDC_VERSION is being set manually to the wrong value. Are you setting JAS_STDC_VERSION yourself? If you do, and you set it to the wrong value this could also cause the warning.

bobfriesenhahn commented 6 months ago

The system does have a somewhat older (several months) JasPer already installed.

Jasper is configured using the build script that JasPer provides like this:

./build/build --build-dir /home/bfriesen/src/jasper-build --install-dir /usr/local --multithread --shared --relwithdebinfo

It may be that the JasPer build is not entirely consistent.  GCC 9.4.0 is the default gcc on this system.

Bob

On 3/21/24 10:35, Michael Adams wrote:

Does the system already have JasPer installed? Picking up headers from an already existing implementation could cause this. Another possibility is that CMake's try_run function is using the wrong -std= option, leading jasPer to deduce the wrong version of the C standard. Another possibility is that JAS_STDC_VERSION is being set manually to the wrong value. Are you setting JAS_STDC_VERSION yourself? If you do, and you set it to the wrong value this could also cause the warning.

— Reply to this email directly, view it on GitHub https://github.com/jasper-software/jasper/issues/376#issuecomment-2012673058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVLJJBMZFVHSCXL3PGTSKTYZL433AVCNFSM6AAAAABEZL44WGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSGY3TGMBVHA. You are receiving this because you authored the thread.Message ID: @.***>

mdadams commented 6 months ago

You could try removing the old version of JasPer if this is feasible, as this may resolve the problem. Please note that this warning suggests that you are likely building against the old system-installed headers, not the headers for the version of JasPer that you are building. This can lead to bizarre failures.