microsoft / microsoft/mimalloc

CMake install doesn't honor install prefix

Open
#359 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

CMake's install command line allows the user to set a custom prefix after configure / build. The install rules in mimalloc are not written to honor this and unconditionally installs to `/usr/local` (the default `CMAKE_INSTALL_PREFIX`).

```
$ git clone git@github.com:microsoft/mimalloc.git
$ cmake -S mimalloc -B mimalloc-build -DCMAKE_BUILD_TYPE=Release
$ cmake --build mimalloc-build
$ cmake --install mimalloc-build --prefix ./mimalloc-install
-- Install configuration: "Release"
-- Installing: /usr/local/lib/mimalloc-1.6/libmimalloc.so.1.6
-- Installing: /usr/local/lib/mimalloc-1.6/libmimalloc.so
-- Installing: /usr/local/lib/mimalloc-1.6/cmake/mimalloc.cmake
-- Installing: /usr/local/lib/mimalloc-1.6/cmake/mimalloc-release.cmake
-- Installing: /usr/local/lib/mimalloc-1.6/libmimalloc.a
-- Installing: /usr/local/lib/mimalloc-1.6/include/mimalloc.h
-- Installing: /usr/local/lib/mimalloc-1.6/include/mimalloc-override.h
-- Installing: /usr/local/lib/mimalloc-1.6/include/mimalloc-new-delete.h
-- Installing: /usr/local/lib/mimalloc-1.6/cmake/mimalloc-config.cmake
-- Installing: /usr/local/lib/mimalloc-1.6/cmake/mimalloc-config-version.cmake
-- Symbolic link: /usr/local/lib/libmimalloc.so -> mimalloc-1.6/libmimalloc.so.1.6
-- Installing: /usr/local/lib/mimalloc-1.6/mimalloc.o
```

This should have installed to `./mimalloc-install` instead. It is possible to work around this by setting `CMAKE_INSTALL_PREFIX` at configure time, but this should not be necessary.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the listed cmake configure, build, and install commands, then inspect mimalloc's CMake install rules. Verify that `cmake --install mimalloc-build --prefix ./mimalloc-install` places the library, headers, CMake files, and object file under `./mimalloc-install` rather than `/usr/local`.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.