Skip to content

`'slu_Cnames.h' file not found` when building for Android

Summary

I have a project that uses Eigen, which I download with FetchContent. It builds fine on WSL, for example, but when I try to build it for Android with Android NDK I get this error:

In file included from <my app path>\.cxx\Debug\57v185on\x86_64\_deps\eigen3-src\bench\spbench\sp_solver.cpp:13:
<my app path>\app\.cxx\Debug\57v185on\x86_64\_deps\eigen3-src\Eigen\SuperLUSupport:20:10: fatal error: 'slu_Cnames.h' file not found

I don't use SuperLU and I think I don't really need this bench\spbench\sp_solver.cpp file, but Eigen includes it like this in the main CMakeLists.txt. I don't get why Eigen includes something like this from bench directory even when building benchmarks is disabled. If I remove this add_subdirectory the build goes on and the project works fine.

So, why not move this add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) inside the if(EIGEN_BUILD_BTL) block?

Environment

  • Operating System : Windows 10
  • Architecture : AMD64 on PC, x86_64 on Android (experienced on an emulator)
  • Eigen Version : 3.4.0
  • Compiler Version : clang 14 from Android NDK 25.0.8775105
  • Compile Flags : -std=c++14 plus the default NDK flags
  • Vector Extension : SSE, AVX

Steps to reproduce

  1. Create a C++ project that uses Eigen with -DEIGEN_BUILD_DOC=OFF -DEIGEN_BUILD_PKGCONFIG=OFF -DBUILD_TESTING=OFF.
  2. Use Android NDK to connect it to an Android project.
  3. Try to build the Android project.

What is the current bug behavior?

The following error appears during build for Android:

In file included from <my app path>\.cxx\Debug\57v185on\x86_64\_deps\eigen3-src\bench\spbench\sp_solver.cpp:13:
<my app path>\app\.cxx\Debug\57v185on\x86_64\_deps\eigen3-src\Eigen\SuperLUSupport:20:10: fatal error: 'slu_Cnames.h' file not found

What is the expected correct behavior?

Build should complete without errors.

  • Have a plan to fix this issue.
Edited by Timofey Pushkin