← All tasks
cppOpenXRay/xray-16 #788Not a task: not reproduced

CMake refactoring partially broke GNUInstallDirs variables

envgap__OpenXRay__xray-16-788

01 / FAILURE SIGNATURE

As reported upstream

file cannot create directory: /usr/lib/mimalloc-1.6.  Maybe need
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
06d63310d7c7883743428d05f36ba6e8bd5712a3
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

OpenXRay/xray-16 #788 · read the original issue
**Describe the bug**

Since b8ce8d735cd4b581f7300c90ead6b1d06bd95d49 (Refactor CMake files), the GNUInstallDirs directory flags our build process passes to CMake aren't being used properly: (e.g. `CMAKE_INSTALL_LIBDIR` / `CMAKE_INSTALL_PREFIX` to change where libraries get installed to)



```

cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/share/doc/OpenXRay -DCMAKE_INSTALL_INFODIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/include -DCMAKE_INSTALL_SBINDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/strip -DCMAKE_RANLIB=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/ranlib -DCMAKE_AR=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13 -DCMAKE_INCLUDE_PATH=/nix/store/zzi38sk41zcddx581ns6xahr6iqdqklv-cryptopp-5.6.5/include/cryptopp

…

-- Override standard malloc (MI_OVERRIDE=ON)

--

-- Library base name: mimalloc

-- Build type       : release

-- Install directory: /usr/lib/mimalloc-1.6

…

Install the project...

-- Install configuration: "Release"

-- Installing: /nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib/xrLuajit.so

-- Installing: /nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib/xrLuabind.so

-- Installing: /nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib/OPCODE.so

-- Installing: /nix/store/al6bvhm8dd2cmnji67w4yvrngbx5qr1m-openxray-unstable-2021-01-13/lib/libODE.so

CMake Error at Externals/mimalloc/cmake_install.cmake:60 (file):

  file cannot create directory: /usr/lib/mimalloc-1.6.  Maybe need

  administrative privileges.

Call Stack (most recent call first):

  Externals/cmake_install.cmake:77 (include)

  cmake_install.cmake:47 (include)





make: *** [Makefile:127: install] Error 1

```



In edbaac6c3639077e89f4e568145489630c2ce41c (822-december-preview) and 46b2227c3966955202ae02eefd0ff0ae60edaeea (Removed xrManagedApi and xrPostprocessEditor), this still worked properly:



```

cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/share/doc/OpenXRay -DCMAKE_INSTALL_INFODIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/include -DCMAKE_INSTALL_SBINDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/strip -DCMAKE_RANLIB=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/ranlib -DCMAKE_AR=/nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06 -DCMAKE_INCLUDE_PATH=/nix/store/zzi38sk41zcddx581ns6xahr6iqdqklv-cryptopp-5.6.5/include/cryptopp

…

-- Override standard malloc (MI_OVERRIDE=ON)

-- 

-- Library base name: mimalloc

-- Build type       : release

-- Install directory: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6

…

Install the project...

-- Install configuration: "Release"

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/xrLuajit.so

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/xrLuabind.so

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/OPCODE.so

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/libODE.so

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/libmimalloc.so.1.6

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/libmimalloc.so

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/libmimalloc.a

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/include/mimalloc.h

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/include/mimalloc-override.h

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/include/mimalloc-new-delete.h

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/cmake/mimalloc-config.cmake

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/cmake/mimalloc-config-version.cmake

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/cmake/mimalloc.cmake

-- Installing: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/mimalloc-1.6/cmake/mimalloc-release.cmake

-- Symbolic link: /nix/store/26hxqw8d7cngvdr6y1i7yypm1cvp7zmd-openxray-unstable-2021-01-06/lib/libmimalloc.so -> mimalloc-1.6/libmimalloc.so.1.6

…

```



**To Reproduce**

Steps to reproduce the behavior:

1. Checkout 46b2227c3966955202ae02eefd0ff0ae60edaeea

2. `mkdir -p target/lib`

3. Configure a build with `-DCMAKE_INSTALL_PREFIX=$PWD/target/ -DCMAKE_INSTALL_LIBDIR=$PWD/target/lib/`

4. The printed install directory for mimalloc should be `$PWD/target/lib/mimalloc-1.6`, `make && make install` should install everything into `$PWD/target/`

5. Checkout b8ce8d735cd4b581f7300c90ead6b1d06bd95d49

6. Configure another build with `-DCMAKE_INSTALL_PREFIX=$PWD/target/ -DCMAKE_INSTALL_LIBDIR=$PWD/target/lib/`

7. mimalloc should print `/usr/lib/mimalloc-1.6` as its install directory. `make && make install` will spread the files across `$PWD/target/` and `/usr`, or error out due to missing permissions in `/usr`



**Expected behavior**

Changing the installation prefixes via the variables exposed by [CMake's GNUInstallDirs module](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) should continue to work like it did before.



**Screenshots**

n/a



**BugTrap error report**

n/a



**Desktop (please complete the following information):**

 - OS: Linux 5.11.13, NixOS, 20.09.3888.4263ba5e133 (Nightingale), x86_64-linux

 - OpenXRay build version: b8ce8d735cd4b581f7300c90ead6b1d06bd95d49 & 66c87237858186b7b4d5e4e0db95ddf7888e306c



**Additional context**

Full build logs:



[46b2227c3966955202ae02eefd0ff0ae60edaeea.log (last code change that worked)](https://github.com/OpenXRay/xray-16/files/6437966/46b2227c3966955202ae02eefd0ff0ae60edaeea.log)

[b8ce8d735cd4b581f7300c90ead6b1d06bd95d49.log (first code change that started to misbehave)](https://github.com/OpenXRay/xray-16/files/6437967/b8ce8d735cd4b581f7300c90ead6b1d06bd95d49.log)

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]