Rpm

如何在 x86-64 機器上為 i386 目標建構 rpm?

  • July 6, 2021

我正在使用rpmbuild以下命令建構 rpm:

rpmbuild -bb --root <DIRECTORY> --target i386 --define "_topdir <DIRECTORY>" <specfile>.spec

當我使用我的 SLED 10 SP3 x86 機器時,它執行成功。但在我的 SLES 10 SP3 x64 虛擬機上,出現以下錯誤:

error: No compatible architectures found for build

最初我沒有使用--target選項,它仍然在 x86 機器上執行,但在 x64 機器上出現了同樣的錯誤。

請幫我解決這個錯誤

來自 rpm、spec 文件和 rpmbuild 的 Fedora 文件:

The --target option sets the target architecture at build time. Chapter 3,
Using RPM covers how you can use the --ignoreos and --ignorearch options 
when installing RPMs to ignore the operating system and architecture that 
is flagged within the RPM. Of course, this works only if you are installing 
on a compatible architecture.

On the surface level, the --target option overrides some of the macros in 
the spec file, %_target, %_target_arch, and %_target_os. This flags the RPM 
for the new target platform.

Under the covers, setting the architecture macros is not enough. You really 
cannot create a PowerPC executable, for example, on an Intel-architecture 
machine, unless you have a PowerPC cross compiler, a compiler that can make 
PowerPC executables.

http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-rpmbuild.html

因此,正如它所說,請確保您安裝了其他編譯器(例如 gcc.i686 和 gcc.x86_64)。

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