ampl / gsl

GNU Scientific Library with CMake build support and AMPL bindings
https://gsl.ampl.com
GNU General Public License v3.0
558 stars 213 forks source link

How to build without sudoer right? #78

Open DooYal opened 1 year ago

DooYal commented 1 year ago

In "build" step, the process interrput with the following information:

[100%] Built target spmatrix_test [100%] Building C object CMakeFiles/splinalg_test.dir/splinalg/test.c.o [100%] Linking C executable bin/splinalg_test [100%] Built target splinalg_test Install the project... -- Install configuration: "Release" -- Installing: /usr/local/lib/libgsl.a CMake Error at cmake_install.cmake:46 (file): file INSTALL cannot copy file "/public/home/dy/bin/gsl/build/libgsl.a" to "/usr/local/lib/libgsl.a": Permission denied.

Unfortunately, I have no sudoer right, and I used opam install gpl which also meet with the same error

Let opam run your package manager to install the required system packages? (answer 'n' for other options) [Y/n] y

However, I can install gsl without build step by my own prefix So, how should I do to change the prefix in build step?

phetdam commented 9 months ago

Hi,

How are you running the installation command? /usr/local by default requires sudo; you can install into your own user directory, e.g. using ~ or ~/local as you desire. If using CMake, e.g. cmake --install, you can change the installation root via the --prefix argument. For example, using ~ as the install root, you can install like this:

cmake --install build_dir --prefix $HOME

Your final installation tree in your user directory ~ should then look something like this:

~/
    include/
        gsl/
    lib/
        libgsl.a
        libgslcblas.a
    bin/
        gsl-config

Of course, you can replace $HOME with $HOME/local or anywhere you have permission to write to.