Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6793 Discussions

CMake variable IPP_VERSION broken since at least 2022.0.0

frayien
Beginner
231 Views

Hello !

 

Since 2022.0.0 (including 2022.0.0 and 2022.1.0), the IPP_VERSION variable set by the "IPPConfigVersion.cmake" script is wrongly overridden in the "IPPConfig.cmake" script.

 

The CMake "find_package(IPP <version>)" command is set to find IPP with it's INTERFACE verison (the version of the shared library)
For example, "find_package(IPP 11.1)" finds IPP 2022.1.0

In accordance with the CMake specification, the "IPPConfigVersion.cmake" match the IPP version 11.1, and set the PACKAGE_VERSION variable to 11.1 as the provided version.

CMake then uses this to set the IPP_VERSION variable to 11.1.

 

The "IPPConfig.cmake" file is then processed by CMake.

Now, since 2022.0.0, the line

include("${CMAKE_CURRENT_LIST_DIR}/IPPUtils.cmake")

has been added to the "IPPConfig.cmake" script at line 50, and this line wrongly overrides the IPP_VERSION variable to 2022.0.0 (or 2022.1.0) ...

 

cf CMake documentation : https://cmake.org/cmake/help/latest/command/find_package.html#cmake-script

At least 2021.8.0 was fine, I do not have a 2021.12.0 at hand at the moment to check if it is affected.

Thanks !

0 Kudos
4 Replies
frayien
Beginner
162 Views

Can confirm that 2021.12.0 was fine

0 Kudos
Ruqiu_C_Intel
Moderator
84 Views

Thank you for posting the issue. 

Looks there isn't issue with my simple code test.cpp compiled by IPPCMake file in my end. My experimental as below, can you share out a simple reproducer as well as the steps for us to reproduce your issue?


:~/ipp_example/build$ vi ../CMakeLists.txt

cmake_minimum_required(VERSION 3.16)
project(MyProject)

# set IPP path
set(IPP_ROOT "/path/to/ipp")

# include IPP header file
include_directories(${IPP_ROOT}/include)

# search IPP lib
find_package(IPP REQUIRED CONFIG)

# create exe file
add_executable(MyProject test.cpp)

# link to IPP
target_link_libraries(MyProject PRIVATE ${IPP_LIBRARIES})



:~/ipp_example/build$ cmake ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/rcao/ipp_example/build
rcao@tce-adl-dg2:~/ipp_example/build$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile
rcao@tce-adl-dg2:~/ipp_example/build$ make
[ 50%] Building CXX object CMakeFiles/MyProject.dir/test.cpp.o
[100%] Linking CXX executable MyProject
[100%] Built target MyProject
rcao@tce-adl-dg2:~/ipp_example/build$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile MyProject

 

0 Kudos
frayien
Beginner
44 Views

Hi ! No problem, here is a simple reproducer :

CMakeLists.txt

cmake_minimum_required(VERSION 3.16)

project(Main)

# Configure the IPP version I want
set(MY_IPP_REQUIRED_VERSION 11.1)

# Call find_package
find_package(IPP ${MY_IPP_REQUIRED_VERSION} EXACT REQUIRED)

# IPP has been found !
if(${IPP_FOUND})
    message(STATUS "IPP Found !")
endif()

# But the IPP_VERSION variable is not set to the correct value ...
if(${MY_IPP_REQUIRED_VERSION} VERSION_EQUAL ${IPP_VERSION})
    message(STATUS "Version found is version required !")
else()
    message(FATAL_ERROR "Version found and required are different !")
endif()


And that's all, you only need the CMakeLists.txt file (as the issue is within the CMake configuration)
Just run the CMake configuration step :

cmake -B build -S .

(which is exactly equivalent "mkdir build; cd build; cmake ..")

Output :

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- IPP Found !
CMake Error at CMakeLists.txt:16 (message):
  Version found and required are different !


-- Configuring incomplete, errors occurred!


Expected output : (and output up to 2021.12.0)

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- IPP Found !
-- Version found is version required !
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: C:/<REDACTED>/build



0 Kudos
frayien
Beginner
42 Views

Fundamental issue seems to be that some of IPP's CMake configuration wants to use the official IPP version (aka 2022.1.0) as the main version, whereas the rests wants to use the interface/shared library version (aka 11.1) instead ...

We end up in this weird situation where we need to ask CMake to find an IPP version by it's interface version (REQUIRED EXACT 11.1), but IPP declares it found it's official version (2022.1.0) which thus does not match ...

As I see it a solution would be to
- either let CMake set the value of the IPP_VERSION variable with the result of the "IPPConfigVersion.cmake" configuration file (as is intended by CMake ; and as was done up to 2021.12.0) and keep the interface version (11.1) at both ends ; 
- either decide to use the official version in the "IPPConfigVersion.cmake" file (by using IPP_VERSION instead of IPP_INTERFACE_VERSION as the value of PACKAGE_VERSION) to have the official version at both ends. This would be quite a mess as it would change the major version and break the "NOT EXACT" version matching...

Personally, I find that the second solution has the advantage that the required version match the official IPP version and would match what would be naively expected, but would be difficult to deploy as being breaking ... The first solution sounds much easier to justify as it match the previous behavior.

Either way (or anything else you might come up with) is fine by me, as long as the main issue is resolved :
Having the IPP_VERSION variable set by the call to find_package not match the value that was passed to it with EXACT REQUIRED is broken ...

0 Kudos
Reply