[英]Build 'libconfig' as a 32-bit library
I am trying to use the libconfig ( http://www.hyperrealm.com/libconfig/ ) for a little utility I am trying to write. 我正在尝试将libconfig( http://www.hyperrealm.com/libconfig/ )用于我尝试编写的一个小工具。 I am trying to build libconfig then copy the library file (libconfig.a) to my utility's directory. 我正在尝试构建libconfig,然后将库文件(libconfig.a)复制到我的实用程序目录中。 When I build my utility I get warnings about the architecture being incompatible. 构建实用程序时,会收到有关体系结构不兼容的警告。 Here is one of the specific warning messages I receive. 这是我收到的特定警告消息之一。
/usr/bin/ld: warning: i386:x86-64 architecture of input file 'libconfig.a(libconfig_la-libconfig.o)' is incompatible with i386 output
I am building on a Red Hat Enterprise Linux Server release 5.10 machine ( uname -m
produces 'x86_64'
). 我在Red Hat Enterprise Linux Server版本5.10机器上构建( uname -m
产生'x86_64'
)。 I tried building libconfig with the following: 我尝试使用以下命令构建libconfig:
configure --disable-cxx CFLAGS='-m32' LDFLAGS='-m32'
But unfortunately, this didn't seem to produce the correct library as I still see the same warnings. 但是不幸的是,这似乎没有产生正确的库,因为我仍然看到相同的警告。 There are other utilities that are created during the build process and all utilities share make common make directives which are specifying CFLAGS = -m32 -Wextra -Wall -Werror -Os
and LDFLAGS = -m32
, so I am unable to change this behavior. 在构建过程中CFLAGS = -m32 -Wextra -Wall -Werror -Os
创建其他实用程序,并且所有实用程序共享通用的make伪指令,这些伪指令指定CFLAGS = -m32 -Wextra -Wall -Werror -Os
和LDFLAGS = -m32
,因此我无法更改此行为。
I have also tried configure --disable-cxx CFLAGS='-arch i386' LDFLAGS='-arch i386
, but this command line will not build the library. 我也尝试过configure --disable-cxx CFLAGS='-arch i386' LDFLAGS='-arch i386
,但是此命令行不会构建该库。
Does anyone know how to build the libconfig as a 32-bit library to be consumed correctly. 有谁知道如何将libconfig构建为32位库以正确使用。
Thanks, 谢谢,
Mark 标记
The configure
script will ignore arguments like CFLAGS=
when passed on the command line. 当在命令行中传递时, configure
脚本将忽略CFLAGS=
类的参数。 You need to set them for the invocation of configure, ie something like: 您需要为调用configure设置它们,例如:
env CFLAGS=-m32 LDFLAGS=-m32 ./configure --disable-cxx
When this is done, all the symbols listed in the resulting lib/.libs/libconfig.a
are listed with 32-bit addresses when the library is rebuilt. 完成此操作后,在重建库时,列出的结果lib/.libs/libconfig.a
中列出的所有符号都带有32位地址。
Note in the configure script help output it does say: 请注意,在configure脚本帮助输出中,它确实说:
Some influential environment variables: 一些有影响力的环境变量:
which means that they need to be environment variables, not passed in as parameters to the command 这意味着它们必须是环境变量,而不是作为参数传递给命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.