LinearDesignSoftware / LinearDesign

The LinearDesign mRNA design software.
Other
146 stars 50 forks source link

Resolved: src/Utils/libraries/LinearDesign_linux64.so: cannot open #16

Open eternal-bug opened 1 month ago

eternal-bug commented 1 month ago

之前我使用lineardesign的时候都是先cdLinearDesign项目文件夹然后再执行的,后面想使用python去调用的时候忍不了了就看了一下源码,发现原因是编译文件中的库文件写的是相对路径(The reason is that the .so library files in the compiled file are written in relative paths)。

问题(Question)

在make编译之后,只能在当前的目录下执行:

echo SEQUENCE | ./lineardesign [OPTIONS]

如果去其他文件夹执行lineardesign,就会出现错误:

/home/eternal-bug/Biosofts/LinearDesign/bin/LinearDesign_2D: error while loading shared libraries: src/Utils/libraries/LinearDesign_linux64.so: cannot open shared object file: No such file or directory

解决办法(solution)

LinearDesign的代码下载下来或者git clone下来之后,首先用文本编辑器打开Makefile,将其中的第17行代码更改为(如果是Mac,修改一下第31行的代码就可以),要是不嫌麻烦,可以把22行和39行都加上$(shell pwd)/

    if $(CXX) $(CXXFLAGS) src/linear_design.cpp -o bin/LinearDesign_2D $(shell pwd)/src/Utils/libraries/LinearDesign_linux64.so; then \

到这里其实已经解决了src/Utils/libraries/LinearDesign_linux64.so: cannot open的问题了,但还有一个隐藏的问题,不处理的话可能出现下面的错误(Error):

terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to open coding_wheel file

解决办法是,打开./src/linear_design.cpp文件,将第13行更改为你的LinearDesign文件夹路径+coding_wheel.txt组成绝对路径:

#define CODING_WHEEL "/path/to/your/coding_wheel.txt"

注意:如果你后面移动LinearDesign项目文件夹,那么你需要再次按照上面的步骤更改一下然后再次编辑才能正常使用。

之前有个兄弟提到了这个问题#11,为了更加醒目一些,我单独开一个issues。