kissfft icon indicating copy to clipboard operation
kissfft copied to clipboard

`make install` attempts to install to system-root (`/kissfft`)

Open JayFoxRox opened this issue 4 years ago • 1 comments
trafficstars

I'm cross-compiling and getting the following:

$ make install
[...]
[100%] Linking C static library libkissfft-float.a
[100%] Built target kissfft
Install the project...
-- Install configuration: ""
-- Installing: /my-custom-toolchain-path/usr/local/lib/libkissfft-float.a
CMake Error at cmake_install.cmake:53 (file):
  file cannot create directory: /kissfft.  Maybe need administrative
  privileges.

This has to do with:

https://github.com/mborgerding/kissfft/blob/8f47a67f595a6641c566087bf5277034be64f24d/CMakeLists.txt#L104-L110

I'm compiling for a "Generic" system (which will probably change as the CMake support in our toolchain improves), and I'm cross-compiling. So GNUInstallDirs is not included.

This breaks the next few lines break, because CMAKE_INSTALL_INCLUDEDIR was never set:

https://github.com/mborgerding/kissfft/blob/8f47a67f595a6641c566087bf5277034be64f24d/CMakeLists.txt#L112-L117

I think it's best to include GNUInstallDirs unconditionally. Although I'm not sure how deployment on Windows works.

It's worth noting that our toolchain is using a GNU toolchain layout with /usr/local/include (but it's also using clang in MSVC compatibility mode to compile for Windows - similar to cygwin/mingw, except it's neither of those).

JayFoxRox avatar May 09 '21 13:05 JayFoxRox

I have same issue with cross compiling on kissfft 131.1.0

Oh, well, I set CMAKE_INSTALL_INCLUDEDIR = $PREFIX DESTDIR = $PREFIX And got little bit further:


Install the project...
-- Install configuration: "Debug"
-- Installing: /opt/e/lib/libkissfft-float.so
-- Up-to-date: /opt/e/kissfft/kiss_fft.h
-- Up-to-date: /opt/e/kissfft/kissfft.hh
-- Up-to-date: /opt/e/kissfft/kiss_fftnd.h
-- Up-to-date: /opt/e/kissfft/kiss_fftndr.h
-- Up-to-date: /opt/e/kissfft/kiss_fftr.h
CMake Error at cmake_install.cmake:107 (file):
  file cannot create directory: /cmake/kissfft.  Maybe need administrative
  privileges.

Update: I was able to workaround this by adding following paths to cmake:

PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
DESTDIR=$PREFIX \
cmake -Wno-dev \
     -DCMAKE_INSTALL_PREFIX=$PREFIX \
     -DCMAKE_INSTALL_LIBDIR=$PREFIX/lib \
     -DCMAKE_INSTALL_INCLUDEDIR=$PREFIX/include \

ernestp avatar May 23 '25 01:05 ernestp

I suggest to replace the section in question with the more conservative approach, since this will not interfere with a native windows toolchain. I've tested this with the MXE crossbuild tools.

if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" AND NOT CMAKE_CROSSCOMPILING)
    include(GNUInstallDirs)
elseif(CMAKE_SYSTEM_NAME MATCHES "^Windows$" AND MINGW)
    include(GNUInstallDirs)
endif()

oe1rsa avatar Jun 09 '25 16:06 oe1rsa

As I said in #91, GNUInstallDirs is not supposed to be used conditionally. As a distro maintainer who specialises in cross-compiling, I've seen it used in countless projects, but never conditionally like this. It's never been a problem. I don't know why you would even consider excluding it when cross-compiling.

chewi avatar Jun 09 '25 16:06 chewi

@chewi I absolutely agree! Its about GNU directories and not Linux or Unix or the like. Given the long standing pull request without having been merged I just thought possibly the merge will happen sooner if the scope of possible changes is smaller.

oe1rsa avatar Jun 10 '25 15:06 oe1rsa