我已將包https://github.com/alex-mcdaniel/RX-DMFIT克隆到計算集群目錄。
它需要我從https://www.gnu.org/software/gsl/下載的 GNU 計算庫。
問題是 因為我在集群上沒有管理員權限,所以我想將庫安裝在make install 我有權訪問的檔案夾中,并告訴包在哪里查找。cannot create directory '/usr/local/include/gsl': Permission deniedgslRX-DMFIT
的make檔案RX-DMFIT是
FILES = Constants.cpp Target.cpp bfield.cpp DM_profile.cpp \
greens.cpp diffusion.cpp dist.cpp psyn.cpp pIC.cpp \
emissivity.cpp surface_brightness_profile.cpp \
flux.cpp calc_sv.cpp run.cpp
# prefix should point to location of darksusy
prefix = /global/scratch/projects/general/RX-DMFIT/darksusy-6.3.1
LDLIBS = -lgsl -lgslcblas -ldarksusy -lFH -lHB -lgfortran
example1: $(FILES) example1.cpp
$(CXX) -o example1 $(FILES) example1.cpp \
-I/${prefix}/include -L/${prefix}/lib \
$(LDLIBS)
example2: $(FILES) example2.cpp
$(CXX) -o example2 $(FILES) example2.cpp \
-I/${prefix}/include -L/${prefix}/lib \
$(LDLIBS)
我該怎么做,以及需要對 makefile 進行哪些修改?
uj5u.com熱心網友回復:
這個問題包含兩個部分:如何將 Gsl 安裝到自定義目錄,以及如何修改 MakefileRX-DMFIT以使用自定義目錄中的 Gsl。
將 Gsl 安裝到自定義前綴
要將 Gsl 安裝到自定義目錄中,請將其配置為在運行之前使用自定義前綴make和make install.
# Create a directory to be used as the custom prefix
mkdir -p /path/to/custom/prefix
# Configure gsl to use the custom prefix
./configure --prefix=/path/to/custom/prefix
# Build and install
make && make install
使用自定義前綴中的 Gsl
要使用自定義前綴中的 Gsl,請將-I/path/to/custom/prefix/include和添加-L/path/to/custom/prefix/lib到傳遞給編譯器的命令列引數。該-I標志告訴編譯器在自定義前綴下搜索頭檔案,該-L標志告訴編譯器在鏈接程式時搜索(共享)庫。
在 Makefile 中有很多方法可以做到這一點,這里是其中之一:
# Add this line under the "prefix = ..." line
gsl_prefix = /path/to/custom/prefix
# Add this line under every "-I/${prefix}/include -L/${prefix}/lib \" line
# Be sure to include the "\" at the end
-I${gsl_prefix}/include -L${gsl_prefix}/lib \
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/523353.html
標籤:C 安装包裹依赖关系
