跑他人代码中遇到的流程和问题记录

最近开始在Ubuntu上(我是在虚拟机上跑的)跑GLSLIM模型,从https://github.com/echristakopoulou/glslim下载了glslim.tar.gz。然后开始根据readme来跑。

前提

需要安装gcc(我安装的4.4), CMake (我安装的2.8), gsl and openmip。根据网上的一些教程安装好了这些,这里面也有踩到一些坑,我前面的博客也有写。

第二步

在readme里有如下的一句话:

First, the the BCLS library needs to be compiled and then we copy the
necessary files to the folder BCLSlib:

看起来是需要让我对文件中的bcsl1.0进行安装操作,但我在网上搜了下并没找到有关于这个的安装教程,但无非就是./configure&&make&&make install这一系列。(后来我在bcsl里的readme里找的教程也就是这样的)

但按这一套下来,报了很多错。我就仔细看了下bcsl1.0里的readme发现还需要安装一些前提软件:

  1. A C compiler. The BCLS sources are written in ISO (C99) conforming C.

  2. GNU make. Probably other versions of make will work with the provided Makefile’s, but I haven’t tried them. If you don’t have
    GNU Make, do yourself a favor: get it!

  3. Optional: Reference BLAS (and its C interface, CBLAS) are provided in this distribution. But a machine-specific implementation will
    be much more efficient.

  4. Optional: Matlab. A Matlab MEX interface to BCLS is provided.

安完之后,继续make&&make install,还是报错,报的错大概就是 找不到bcversion.o文件gcc: error: .libs/bcversion.o: No such file or directory估计是在make的时候没有成功编译bcversion.c文件。

我就自己单独用gcc bcversion.c -o bcversion.o编译,但报了一些找不到头文件的错误,我发现那些头文件都被保存在另一个文件夹include里,而这个c文件在src里,所以图方便,我就直接将include中需要的.h文件复制到src中。

然后发现重新编译还是报错,发现引入头文件用的是#include这样的。。我就把类似的都改成了#include"bcversion.h"

然而继续报错 (.text+0x20): undefined reference to `main’ collect2: error: ld returned。 这个就加个int mian(){}就解决了。

第三步

编译成功后,我看到readme的下一句:

then we copy the necessary files to the folder BCLSlib:。

将你需要的文件拷到BCLSlib中,然而下载下的文件中已经有BCLSlib这个文件了,而且里面已经有了文件。。我突然发现我前面似乎不需要对bcls1.0做啥,作者好像已经做好了。。

第四步

运行build.sh:./build.sh
我打开这个文件看了下,里面就以下几个命令:

cd bcls-0.1/ 
./configure 
make 
cd .. 
mkdir BCLSlib 
cd BCLSlib 
cp ../bcls-0.1/include/* . 
cp ../bcls-0.1/src/.libs/*a . 
cd .. 
mkdir build 
cd build 
cmake .. 
make

我前几步都做了,所以就直接从创建build文件夹开始做了,最后运行完,
跑他人代码中遇到的流程和问题记录_第1张图片
大概就是成功了。耗时两天,不容易呀。特发此文纪念一下

你可能感兴趣的:(跑他人代码中遇到的流程和问题记录)