Skip to content

xsimd install with xtensor dependency results in a broken CMake target file #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amyspark opened this issue Dec 12, 2022 · 4 comments · Fixed by #875
Closed

xsimd install with xtensor dependency results in a broken CMake target file #869

amyspark opened this issue Dec 12, 2022 · 4 comments · Fixed by #875

Comments

@amyspark
Copy link
Contributor

👋

I've just been told at Krita that Debian (and Ubuntu by extension)'s packaging of xsimd does not work to build Krita. I see in the Debian source that they're using -DENABLE_XTL_COMPLEX=ON to enable the xtl dependency, but in the xsimd-targets.cmake file, I read

add_library(xsimd INTERFACE IMPORTED)

set_target_properties(xsimd PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_14"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "xtl"
)

with absolutely no reference to xtl-targets.cmake or the relevant find_package line.

I'm not sure if this is a xsimd or Debian packaging issue, but reporting it FYI.

@JohanMabille
Copy link
Member

JohanMabille commented Dec 12, 2022

Thanks for reporting! I think we should add the missing properties in the CMakeLists.txt when -DENABLE_XTL_COMPLEX=ON rather than in the targets file. However, the dependency on the xtl is already there.

@amyspark
Copy link
Contributor Author

CMake doesn't generate find_package lines for dependencies, the project needs to generate its own Config template. I had the notes ready for a potential fix, but I fell sick and lost them...

@JohanMabille
Copy link
Member

JohanMabille commented Dec 27, 2022

Actually the call to find_dependency(xtl) is done in the xsimdConfig.cmake file so I'm confused why Krita does not build with xsimd. I tried a local build of xtensor with a dependency on xsimd where ENABLE_XTL_XOMPLEX was set and had no issue. Do you have the logs of the error?

I had the notes ready for a potential fix, but I fell sick and lost them

Sorry to read that, I hope you're feeling better!

@amyspark
Copy link
Contributor Author

Actually the call to find_dependency(xtl) is done in the xsimdConfig.cmake file so I'm confused why Krita does not build with xsimd. I tried a local build of xtensor with a dependency on xsimd where ENABLE_XTL_XOMPLEX was set and had no issue. Do you have the logs of the error?

https://forum.kde.org/viewtopic.php?f=288&t=176722&p=459505#p459505 and compile line looks like https://invent.kde.org/-/snippets/2224. Both point to xtl being passed over as-is without the library being resolved to its proper path.

amyspark added a commit to amyspark/xsimd that referenced this issue Dec 27, 2022
PR xtensor-stack#788 fixes xtl lookup by adding the corresponding find_dependency
call. However, there are still two issues remaining:

- If xtl is not found, the INTERFACE_LINK_LIBRARIES property will
  make CMake interpret "xtl" as a .lib, pass it as a -l flag, and cause
  the build to fail.

- If xtl is used, the required definition XSIMD_ENABLE_XTL_COMPLEX=1 is
  never passsed to downstream consumers.

This commit fixes both issues, ensuring that if xtl was required at
compile time, the Config module with not load unless xtl is also found.

Fixes xtensor-stack#869
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants