在64位机器上安装32位PBC库

时间:2012-12-29 17:12:23

标签: build x86 32bit-64bit libraries configure

我想为我的项目安装PBC库。在我的64位系统上,configure脚本很容易安装64位库。但是我必须使用的代码是基于32位的。

我尝试了这个命令(来自对此question的回答):

./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"

但是当我运行'make'时出现这个错误:

/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-field.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-z.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-naivefp.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-fastfp.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-fp.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-fasterfp.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-montfp.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-multiz.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-dlog.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-fieldquadratic.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-poly.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-random.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-init_random.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-darray.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-symtab.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-get_time.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-utils.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-memory.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-extend_printf.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-mpc.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-mnt.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-hilbert.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-curve.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-pairing.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-singular.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-param.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-a_param.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-d_param.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-e_param.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-f_param.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `.libs/libpbc_la-g_param.o' is incompatible with i386 output

' - help'列出了以下标志:

Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
LIBS        libraries to pass to the linker, e.g. -l<library>
CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>
CPP         C preprocessor
Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations.

2 个答案:

答案 0 :(得分:2)

首先,检查:

./configure --help

是否允许覆盖CFALGS / LDFLAGS?

如果是,请按照帮助信息进行操作。 其次,通常,。/ configure会生成makefile,然后发出“make”命令。 你说,配置后你得到了这个错误吗?

如果您在制作之后收到这些错误,那么它 看起来像ld与旧残留物相连。

你有没有尝试过:

make clean;make

答案 1 :(得分:0)

谢谢@ Icarus3。你指出我正确的方向。我使用的命令是:

./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"

我跑的时候

./configure --help

它没有CXXFLAGS。所以我把它改为CPPFLAGS=-m32。它起作用了。