This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1072 - CMAKE_INSTALL_PREFIX is set but 'make install' is writing to /usr/local
Summary: CMAKE_INSTALL_PREFIX is set but 'make install' is writing to /usr/local
Status: RESOLVED DUPLICATE of bug 1100
Alias: None
Product: Eigen
Classification: Unclassified
Component: Interoperability (show other bugs)
Version: 3.2
Hardware: All All
: Normal Unknown
Assignee: Nathan
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-25 22:47 UTC by don bright
Modified: 2019-12-04 14:57 UTC (History)
5 users (show)



Attachments
use share dir on non-root install (1.33 KB, patch)
2015-09-27 13:59 UTC, Nathan
no flags Details | Diff
refactoring of .pc file installation (3.84 KB, patch)
2015-09-28 12:53 UTC, Gael Guennebaud
no flags Details | Diff
install pc independent of pkgconfig (3.01 KB, patch)
2015-10-04 15:40 UTC, Nathan
nathan.yonkee: review?
Details | Diff

Description don bright 2015-09-25 22:47:54 UTC
The CMAKE system is broken when CMAKE_INSTALL_PREFIX is set. It is attempting to install files to /usr/local/lib. It should be installing all files to $PREFIX

I also tried it with EIGEN_INCLUDE_INSTALL_DIR set. Same issue.

Error message follows:

Install the project...
-- Install configuration: "Release"
-- Up-to-date: /export/home/bright/openscad_deps/include/eigen3/signature_of_eigen3_matrix_library
-- Installing: /usr/local/lib/pkgconfig/eigen3.pc
CMake Error at cmake_install.cmake:51 (file):
  file INSTALL cannot copy file
  "/export/home/bright/openscad_deps/src/eigen-eigen-bdd17ee3b1b3/bin/eigen3.pc"
  to "/usr/local/lib/pkgconfig/eigen3.pc".


Workaround is to simply copy the Eigen directory per the INSTALL file in the top directory. 

Cmake version is 3.3.2, OS is SunOS naples 5.10, 

Cmake command is like this:

cmake -DCMAKE_INSTALL_PREFIX=/home/don/sys  ..

See Also https://github.com/openscad/openscad/issues/1125

Thank you.
Comment 1 Nathan 2015-09-27 03:30:56 UTC
It looks like CMake is trying to install pkg config files to "$ENV{PKG_CONFIG_LIBDIR}" instead of "${CMAKE_INSTALL_PREFIX}/share". If you have the environment variable PKG_CONFIG_LIBDIR set, unset it and try again. It should use the share folder in this case. 
 
If it still doesn't install, set the EIGEN_BUILD_PKGCONFIG option off. If it compiles with this off, then we know it's an issue with the value in ${pkg_config_install_dir}.
Comment 2 don bright 2015-09-27 04:43:32 UTC
This workaround works. 

cmake -DEIGEN_BUILD_PKGCONFIG=off 


However the install process should never attempt to write to /usr/local, or any other path that is not CMAKE_INSTALL_PREFIX, regardless of any environment variable. 

Thanks
Comment 3 Nathan 2015-09-27 10:08:31 UTC
I'm glad that you got it working! I agree, it should install to "${CMAKE_INSTALL_PREFIX}/share" for non-root installations. Thanks for pointing this out.
Comment 4 Nathan 2015-09-27 13:59:58 UTC
Created attachment 606 [details]
use share dir on non-root install

This is my first time doing this, so bear with me...

This changes the pkg-config path to the ./share directory when the user specifies a non-default install prefix but maintains current behavior otherwise. This allows for non-root installs even when the PKG_CONFIG_LIBDIR variable is set to a root location.
Comment 5 Gael Guennebaud 2015-09-28 12:53:25 UTC
Created attachment 607 [details]
refactoring of .pc file installation

It seems that the previous patch disable the installation of .pc files for non standard install prefix...

Anyway, I think that this part requires some deeper cleanup (naming, windows support, miss usage of PKG_CONFIG_LIBDIR, etc), and the respective install directory must be configurable independently of CMAKE_INSTALL_PREFIX. This is what does the attached patch. I also renamed EIGEN_BUILD_PKGCONFIG to EIGEN_INSTALL_PKGCONFIG. The variable EIGEN_INSTALL_PKGCONFIG_DIR permits to customize the installation directory. Its name is grammatically not very nice, but this permits to have both variables next to each other in cmake's UIs.
Comment 6 Nathan 2015-10-04 15:40:47 UTC
Created attachment 608 [details]
install pc independent of pkgconfig

It would be much simpler and more consistent to install the pc file independently of pkg-config. A user might have multiple local installs of Eigen, as well as a system install, and multiple local installs of pkg-config in addition to a system install. It should be the job of pkg-config and upstream projects to find specific eigen3.pc files in case there are multiple unique builds.

By default, pkg-config checks */lib/pkgconfig and */share/pkgconfig so both are equally viable. 

I left the "if(NOT WIN32)" guard in because I don't have a Windows platform to test on.
Comment 7 Gael Guennebaud 2015-12-10 15:18:44 UTC
Fixed in bug 1100

*** This bug has been marked as a duplicate of bug 1100 ***
Comment 8 Nobody 2019-12-04 14:57:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1072.

Note You need to log in before you can comment on or make changes to this bug.