Ubuntu

在最新的 UBUNTU 上安裝舊的 32 位軟體

  • March 18, 2019

我正在嘗試在 64 位 LINUX HPC 集群上安裝舊版軟體(32 位)。這是 2005 年以來相當古老的軟體。

軟體位於https://www.drive5.com/pals/

作業系統詳細資訊是PRETTY_NAME="Ubuntu 18.04.2 LTS"

make 給出:

g++ -c -O3 -march=pentiumpro -mcpu=pentiumpro -funroll-loops -Winline -DNDEBUG=1  aligntraps.cpp -o aligntraps.o
g++: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
cc1plus: error: CPU you selected does not support x86-64 instruction set
Makefile:22: recipe for target 'aligntraps.o' failed
make: *** [aligntraps.o] Error 1

有人可以就如何更改 Makefile 提出建議,如下所示,以便我的軟體編譯 make 步驟將成功完成?

CFLAGS = -O3 -march=pentiumpro -mcpu=pentiumpro -funroll-loops -Winline -DNDEBUG=1
LDLIBS = -lm -static
# LDLIBS = -lm

OBJ = .o
EXE =

RM = rm -f
CP = cp

GPP = g++
LD = $(GPP) $(CFLAGS)
CPP = $(GPP) -c $(CFLAGS) 
CC = gcc -c $(CFLAGS) 

all: pals

CPPSRC = $(sort $(wildcard *.cpp))
CPPOBJ  = $(subst .cpp,.o,$(CPPSRC))

$(CPPOBJ): %.o: %.cpp
   $(CPP) $< -o $@

pals: $(CPPOBJ)
   $(LD) -o pals $(CPPOBJ) $(LDLIBS)

注意 - 雖然您的問題的標題是關於“安裝舊的 32 位軟體”,但似乎沒有特別的理由不將該程序建構為原生 64 位軟體。但是,如果您確實需要建構一個 32 位版本(用於基準測試,或用於精確複製以前發布的結果),那麼這裡是方法。


並不是說我的系統是帶有 gcc/g++ 7 的 64 位 Ubuntu 18.04

$ uname -a
Linux t400s 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

在這種特殊情況下,您嘗試建構libm.ag++-multilib軟體似乎沒有使用.gcc-multilib``libc6-dev-x32``CFLAGS``-m32

所以

sudo apt install g++-multilib

然後

$ head -3 Makefile 
CFLAGS = -m32 -O3 -march=pentiumpro -mcpu=pentiumpro -funroll-loops -Winline -DNDEBUG=1
LDLIBS = -lm -static
# LDLIBS = -lm

$ make

你會收到一些警告

g++: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead

但是pals程序應該建立:

$ file pals
pals: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=1b9e369acf2aa7c6448b4132a203b8dccde16a7d, not stripped

並執行

$ ./pals

PALS v1.0
http://www.drive5.com/pals
Written by Bob Edgar and Gene Myers.
This software is donated to the public domain.
Please visit web site for requested citation.


Usage:
   pals -target <fastafile> -query <fastafile>
   pals -self <fastafile>

Options:
   -out <outfile>       (default standard output)
   -fwdonly             don't align reverse strand
   -filterout <file>    save filter hits to file

Alignment parameters can be specified in three ways:
   (1) Defaults         -length 400 -pctid 94
   (2) Specify -length <minhitlength> -pctid <minhitid>
   (3) Specify all filter and d.p. parameters:
          -wordsize     Filter word size
          -seedlength   Seed hit length
          -seeddiffs    Max #diffs in seed hit
          -length       Min length of final hit
          -pctid        Min %id of final hit
          -tubeoffset   (Optional)

For further information, please see the User Guide.

Must specify either -self or both -target and -query

引用自:https://unix.stackexchange.com/questions/506528