linux 安装SVM灯时出错

svdrlsy4  于 2023-02-03  发布在  Linux
关注(0)|答案(2)|浏览(160)

我尝试在我正在使用的群集上安装SVM-Light,但收到以下错误:

svm_hideo.o:(.bss+0x38): multiple definition of `verbosity'; svm_common.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: svm_learn_hideo] Error 1

我为安装所做的步骤如下(我遵循了这个tutorial):

wget https://download.joachims.org/svm_light/current/svm_light.tar.gz

gunzip -c svm_light.tar.gz | tar xvf -

ls
kernel.h     Makefile        svm_common.c  svm_hideo.c  svm_learn.h       svm_light.tar.gz
LICENSE.txt  svm_classify.c  svm_common.h  svm_learn.c  svm_learn_main.c  svm_loqo.c

 make
gcc -c  -O3                      svm_learn_main.c -o svm_learn_main.o
gcc -c  -O3                      svm_learn.c -o svm_learn.o
gcc -c  -O3                      svm_common.c -o svm_common.o
svm_common.c: In function ‘read_model’:
svm_common.c:600:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  600 |   fscanf(modelfl,"SVM-light Version %s\n",version_buffer);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:605:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  605 |   fscanf(modelfl,"%ld%*[^\n]\n", &model->kernel_parm.kernel_type);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:606:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  606 |   fscanf(modelfl,"%ld%*[^\n]\n", &model->kernel_parm.poly_degree);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:607:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  607 |   fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.rbf_gamma);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:608:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  608 |   fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.coef_lin);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:609:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  609 |   fscanf(modelfl,"%lf%*[^\n]\n", &model->kernel_parm.coef_const);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:610:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  610 |   fscanf(modelfl,"%[^#]%*[^\n]\n", model->kernel_parm.custom);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:612:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  612 |   fscanf(modelfl,"%ld%*[^\n]\n", &model->totwords);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:613:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  613 |   fscanf(modelfl,"%ld%*[^\n]\n", &model->totdoc);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:614:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  614 |   fscanf(modelfl,"%ld%*[^\n]\n", &model->sv_num);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:615:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  615 |   fscanf(modelfl,"%lf%*[^\n]\n", &model->b);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svm_common.c:623:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  623 |     fgets(line,(int)ll,modelfl);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -c  -O3                      svm_hideo.c -o svm_hideo.o
gcc  -O3                      svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o -o svm_learn -L. -lm      
/mnt/netapp1/Optcesga_FT2_RHEL7/2020/gentoo/22072020/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: svm_hideo.o:(.bss+0x38): multiple definition of `verbosity'; svm_common.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: svm_learn_hideo] Error 1

我甚至试过用conda安装它,但没有成功。

conda create myenv
conda activate myenv
conda install -c bioconda svmlight
conda list
# packages in environment:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
_openmp_mutex             5.1                       1_gnu
libgcc-ng                 11.2.0               h1234567_1
libgomp                   11.2.0               h1234567_1
svmlight                  6.02                 hec16e2b_4    bioconda

但是当我检查软件包是否安装成功时...没有找到。

python

Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import svmlight
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/.local/lib/python3.9/site-packages/svmlight.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyCObject_Check

我还尝试使用不同的方式安装它:

conda install -c "bioconda/label/cf201901" svmlight
conda install -c bioconda svmlight 
pip install svmlight
pip install --no-cache-dir --upgrade svmlight

但是没有...
有人知道怎么解决吗?
先谢了

eit6fx6z

eit6fx6z1#

解决方案:
要安装svm-light,必须使用以下代码安装gcc 8.5.0:

conda create myenv
conda activate myenv
conda install -c conda-forge gcc=8.5.0
b4qexyjb

b4qexyjb2#

Bioconda Package 采用非常具体的通道规格构建,即:

# .condarc
channels:
  - conda-forge
  - bioconda
  - defaults

为了正确使用Bioconda软件包,必须遵守通道规范。也就是说,软件包应该像这样安装

## note that one can give packages to the `create` command
conda create -n myenv -c conda-forge -c bioconda svmlight

另外,注意有两个包,svmlight,它是编译的C++库,和pysvmlight,它是Python Package 器(只支持Python 2.7)。

相关问题