Skip to content
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

Install by prefix broken with cmake --install #196

Closed
gaspacio opened this issue Nov 28, 2024 · 3 comments · Fixed by #197
Closed

Install by prefix broken with cmake --install #196

gaspacio opened this issue Nov 28, 2024 · 3 comments · Fixed by #197
Labels
bug:confirmed Something isn't working (confirmed)
Milestone

Comments

@gaspacio
Copy link

Hi! Reporting an issue with the Snitch install behavior with cmake ('main' branch).
Basically, specifying the install prefix with the configuration step will make it work. But specifying it directly along the 'cmake --install [build dir] --prefix [install prefix]' will retain the default install path.

These command will lead to a correct install:

cmake \
	-G Ninja \
	-DCMAKE_BUILD_TYPE="Release" \
	-DCMAKE_EXPORT_COMPILE_COMMANDS=1  --toolchain /opt/share/toolchain-configs/x86_64-multilib-linux-gnu.cmake \
	-DSNITCH_DO_TEST=ON \
	-DCMAKE_INSTALL_PREFIX=/home/user/workdir/install \
	-DSNITCH_ENABLE=ON \
	-S . -B build && \
cmake --build build --target all   && \
cmake --build build --target install

This won't work as intended:

cmake \
	-G Ninja \
	-DCMAKE_BUILD_TYPE="Release" \
	-DCMAKE_EXPORT_COMPILE_COMMANDS=1  --toolchain /opt/share/toolchain-configs/x86_64-multilib-linux-gnu.cmake \
	-DSNITCH_DO_TEST=ON \
	-S . -B build && \
cmake --build build --target all   && \
cmake --install build --prefix install

The error emerged when using a non-privileged OS user (Ubuntu 22:04) as this leads to install fail:

[53/53] Linking CXX executable tests/snitch_runtime_tests
-- Install configuration: "Release"
CMake Error at build/cmake_install.cmake:54 (file):
  file cannot create directory: /usr/local/include/snitch.  Maybe need
  administrative privileges.

I've noticed that calls to 'install()' are always using the 'DESTINATION ${CMAKE_INSTALL_PREFIX}/' prefix. By removing it, the behavior is once again as intended.

Would you consider this a bug or is it by design?

@cschreib
Copy link
Member

Hi and thanks for reporting this. This is the first time I hear about cmake --install [...] --prefix [...]! I always set this up at configure time. So no, this is not by design, it's a bug. I'll create a PR for this, thanks for the hint on the fix (it would have taken me a while to figure it out, the CMake documentation being what it is).

@cschreib cschreib added the bug:confirmed Something isn't working (confirmed) label Nov 30, 2024
@cschreib cschreib added this to the v1.2.6 milestone Nov 30, 2024
@cschreib
Copy link
Member

Should be fixed in #197.

@gaspacio
Copy link
Author

gaspacio commented Dec 1, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:confirmed Something isn't working (confirmed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants