我正在尝试安装gsl-2.5
-https://www.gnu.org/software/gsl/。我已经使用了该命令sudo ./configure && make && make install
,但仍然遇到权限问题:
libtool: link: ranlib .libs/libgsl.a
libtool: link: rm -fr .libs/libgsl.lax .libs/libgsl.lax
libtool: link: ( cd ".libs" && rm -f "libgsl.la" && ln -s "../libgsl.la" "libgsl.la" )
/bin/bash ./libtool --tag=CC --mode=link gcc -g -O2 -o gsl-randist gsl-randist.o libgsl.la cblas/libgslcblas.la -lm
libtool: link: gcc -g -O2 -o .libs/gsl-randist gsl-randist.o ./.libs/libgsl.so cblas/.libs/libgslcblas.so -lm
/bin/bash ./libtool --tag=CC --mode=link gcc -g -O2 -o gsl-histogram gsl-histogram.o libgsl.la cblas/libgslcblas.la -lm
libtool: link: gcc -g -O2 -o .libs/gsl-histogram gsl-histogram.o ./.libs/libgsl.so cblas/.libs/libgslcblas.so -lm
creating gsl-config
creating gsl.pc
make[2]: Leaving directory '/home/sam/program_files/gsl-2.5'
make[1]: Leaving directory '/home/sam/program_files/gsl-2.5'
Making install in gsl
make[1]: Entering directory '/home/sam/program_files/gsl-2.5/gsl'
make[2]: Entering directory '/home/sam/program_files/gsl-2.5/gsl'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/sam/program_files/gsl-2.5/gsl'
make[1]: Leaving directory '/home/sam/program_files/gsl-2.5/gsl'
Making install in utils
make[1]: Entering directory '/home/sam/program_files/gsl-2.5/utils'
make[2]: Entering directory '/home/sam/program_files/gsl-2.5/utils'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/sam/program_files/gsl-2.5/utils'
make[1]: Leaving directory '/home/sam/program_files/gsl-2.5/utils'
Making install in sys
make[1]: Entering directory '/home/sam/program_files/gsl-2.5/sys'
make[2]: Entering directory '/home/sam/program_files/gsl-2.5/sys'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/include/gsl'
/bin/mkdir: cannot create directory ‘/usr/local/include/gsl’: Permission denied
Makefile:637: recipe for target 'install-pkgincludeHEADERS' failed
make[2]: *** [install-pkgincludeHEADERS] Error 1
make[2]: Leaving directory '/home/sam/program_files/gsl-2.5/sys'
Makefile:918: recipe for target 'install-am' failed
make[1]: *** [install-am] Error 2
make[1]: Leaving directory '/home/sam/program_files/gsl-2.5/sys'
Makefile:963: recipe for target 'install
我猜测,由于某种原因,我的根权限不包括该 /usr/local/include
目录。有谁知道为什么会出现这种情况以及我该如何解决它?
答案1
你的命令
sudo ./configure && make && make install
按顺序运行这三个命令:
sudo ./configure
make
make install
请注意,只有第一个具有 root 权限。
通常,您将作为您自己的用户帐户运行配置/制作阶段,仅为最终安装阶段分配 root 权限:
./configure
make
sudo make install
&&
如果你有胆量,你可以加入这些。就我个人而言,我更喜欢将安装阶段作为一个单独的活动,只有当我很高兴前两个阶段不仅成功而且正确地完成时,我才应用它。