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

How to install in custom prefix location and how to refer to capnp from a non-package location #2697

Open
godmar opened this issue Sep 25, 2020 · 5 comments

Comments

@godmar
Copy link

godmar commented Sep 25, 2020

Hi, I am trying to build and run rr on a machine where I lack root access. I am trying to follow the instructions given here.

First, I installed Cap'n Proto using the instructions using the desired prefix directory (which will be the same location for rr as well). However, rr doesn't pick it up when running cmake ../rr:

-- Checking for module 'capnp'
--   Package 'capnp', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:418 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:585 (_pkg_check_modules_internal)
  CMakeLists.txt:189 (pkg_check_modules)


-- Configuring incomplete, errors occurred!

As a second question, I do not know how to tell rr the desired installation prefix where I'd like to install it. In a standard GNU autoconf setup, this would be done using the --prefix parameter, but I'm not familiar enough with CMake to know the equivalent switch here.

The rr installation instructions appear to cover only the case of an installation in a standard, usually root-owned directory (e.g. /usr/local/bin).

If rr does not support installations by non-privileged users, please state so in the documentation. I've checked the System Requirements. Thank you.

@rocallahan
Copy link
Collaborator

I'm not much of an expert on CMake either. You may need to set PKG_CONFIG_PATH to include the path where you installed capnp.

You can definitely run rr unprivileged. You don't actually need to install it, you can just build it and then run it directly.

@khuey
Copy link
Collaborator

khuey commented Sep 26, 2020

cmake -DCMAKE_INSTALL_PREFIX=/foo is the equivalent of ./configure --prefix=/foo IIRC.

@godmar
Copy link
Author

godmar commented Sep 26, 2020

Thanks. I was able to make progress, but see below.

First, in order to pick up the pkg config for capnp, and in order to specify a custom prefix (both ${HOME} in this case), I used:

env PKG_CONFIG_PATH=~/lib/pkgconfig cmake -DCMAKE_INSTALL_PREFIX=${HOME} ../rr

This then asked for Python 3's pexpect, which I provided with a virtualenv.
With this, it built and installed, alas, it's not correctly linked:

$ ldd `which rr`
	linux-vdso.so.1 (0x00007ffeb97f2000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f415d379000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f415d170000)
	libcapnp-0.8.0.so => not found
	libkj-0.8.0.so => not found
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f415cf50000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f415cbbb000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f415c839000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f415c621000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f415c25f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f415d57d000)

So it doesn't run unless you specify the location of these dynamic libraries:

env LD_LIBRARY_PATH=${HOME}/lib ./bin/rr

this works.

I note that ~/lib/pkgconfig/capnp.pc contains libdir=${exec_prefix}/lib.

It appears that a -rpath option is missing somewhere. I can work around this with a script/wrapper which I need for the virtualenv anyway, but unless I invoked cmake wrong I would have expected the build system to take care of adding the proper rpath based on the pkg config. Potentially relevant: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling

@rocallahan
Copy link
Collaborator

Thanks for the diagnosis.

I'd take a pull request to fix the rpath but I don't think anyone is going to work on it otherwise.

@alphamarket
Copy link

FWIW in my case, I did PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake . and I have got my problem fixed. I didn't have this issue with the debian-based OS but for some reason in Redhat and Centos PKG_CONFIG_PATH is not recognized automatically!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants