当前位置: 首页 > 工具软件 > mk-configure > 使用案例 >

linux编译查错,转载:configure检查错误

赵夕
2023-12-01

在交叉编译的时候总是使用configure --host=arm-linux 嘿嘿但是在CONFIGURE中有很多的测试程序是不可以在HOST上运行的就会出现: error: cannot run test program while cross compiling

类似的错误,可以使用CACHEFILE解决这个问题,还要谢谢ABSURD兄的文章给我的指导。

我是这样解决的第一步:记录下错误的地方如:checking abstract socket namespace... configure: error: cannot run test program while cross compiling

注意到abstract socket namespace在configure中查找abstract socket可以看到类似这样的结构

echo "$as_me:$LINENO: checking abstract socket namespace" >&5

echo $ECHO_N "checking abstract socket namespace... $ECHO_C" >&6

if test "${ac_cv_have_abstract_sockets+set}" = set; then

echo $ECHO_N "(cached) $ECHO_C" >&6

其中ac_cv_have_abstract_sockets是我们要查找的变量

使用echo ac_cv_have_abstract_sockets=yes>arm-linux.cache

然后

./configure --host=arm-linux --cache-file=arm-linux.cache

OK这样就搞定了

还有一篇:

On Jul 23, 2007, at 12:55 PM, Luther138 wrote:

>>I can get it to compile but I still need to apply one hack to the>configure>script.>I always get this error msg:>checking for prctl... yes>configure: error: cannot run test program while cross compiling>>unless I change/comment out the following ... (line 34336 of the>configure)># glibc <= 2.3.2 has a broken getgrouplist>if test "$cross_compiling" = yes; then># { { echo "$as_me:$LINENO: error: cannot run test program>while cross>compiling># See>\`config.log' for more details." >&5># echo "$as_me: error: cannot run test program while cross>compiling># See \`config.log' for more details." >&2;}># { (exit 1); exit 1; }; }>(line added) linux_getgrouplist_ok=no>>So this would imply that the problem is not with prctl but actually>with>linux_getgrouplist_ ok correct?

yep

>But is if set linux_getgrouplist_ok=no>before hand it will still error out. But as long as I do that one>hack to>the configure script all the rest the variables I set seem to work. ie>export SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes ; \>export libreplace_cv_READDIR_GETDIRENTRIES=no ; \>export libreplace_cv_READDIR_GETDENTS=no ; \>export linux_getgrouplist_ok=no ; \>export samba_cv_REPLACE_READDIR=no ; \>export samba_cv_HAVE_WRFILE_KEYTAB=yes ; \>export samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes ; \

Yes, the Linux grouplist test is broken for cross-compiling in the

3.0.25 tree. You can just replace it with the test from the 3.2 tree:

AC_CACHE_CHECK([for a broken Linux getgrouplist API],

linux_getgrouplist_ok,

[

AC_TRY_RUN([

#include #include int main() {

/* glibc up to 2.3 has a broken

getgrouplist */

#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)

int libc_major = __GLIBC__;

int libc_minor = __GLIBC_MINOR__;

if (libc_major < 2)

return 1;

if ((libc_major == 2) && (libc_minor <= 3))

return 1;

#endif

return 0;

}

],

[linux_getgrouplist_ok=yes],

[linux_getgrouplist_ok=no],

[linux_getgrouplist_ok=cross])

])

if test x"$linux_getgrouplist_ok" = x"yes"; then

AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])

fi

>Is this a bug or am I still doing something wrong. FYI I am not>using the>config.site meathod because I only want to add my makefile (i.e.>only one>file) to the directory above /source (i.e. samba 3-0.25b), and this>file>invokes the configure and runs the ../source/Makefile.

just generate config.site from your makefile ...

CONFIG_SITE := `pwd`/config.site

config.site:

SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes >> $@

....

configure: config.site

cd samba/source && env CONFIG_SITE=$(CONFIG_SITE) ./configure --blah

>Thank you again for>your help.>-Robb>-->View this message in context:>Sent from the Samba - samba-technical mailing list archive at>Nabble.com.

--

James Peach |交叉编译场景分析(arm-linux)(八)--编译glib

1.基本信息:软件名称glib

功能简述Glib是GNOME的一个基础库,提供基本的容器、算法、对象系统、OSAPI的适配器等。

下载地址

软件版本glib-2.8.0.tar.gz

依赖关系默认

前置条件源文件位置:$(WORK_DIR)/ glib-2.8.0

2.过程分析

下载的稳定版本,configure已经存在,直接进行配置:

[root@linux glib-2.8.0]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

出现了如下错误:

checking for growing stack pointer... configure: error: cannot run test program while cross compiling

原来configure不能为交叉编译检查glib_cv_stack_grows,glib_cv_stack_grows表示堆栈的增长方向。configure无法在目标机上运行测试程序,自然无法检查,只好手工指定。顺便看一下还哪些相关的变量不能检查的,一起写到cache文件中,并重新配置:

[root@linux glib-2.8.0]# echo ac_cv_type_long_long=yes>$ARCH-linux.cache

[root@linux glib-2.8.0]# echo glib_cv_stack_grows=no>>$ARCH-linux.cache

[root@linux glib-2.8.0]# echo glib_cv_uscore=no>>$ARCH-linux.cache

[root@linux glib-2.8.0]# echo ac_cv_func_posix_getpwuid_r=yes>>$ARCH-linux.cache

[root@linux glib-2.8.0]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache

这回配置成功了,编译:

[root@linux glib-2.8.0]# make && make install

编译成功!

3.构建处方

lglib.mk

GLIB_DIR="glib-2.8.0"

all: clean config build

config:

@cd $(GLIB_DIR) && \

echo ac_cv_type_long_long=yes>$$ARCH-linux.cache && \

echo glib_cv_stack_grows=no>>$$ARCH-linux.cache && \

echo glib_cv_uscore=no>>$$ARCH-linux.cache && \

echo ac_cv_func_posix_getpwuid_r=yes>>$$ARCH-linux.cache &&\

./configure --host=$$ARCH-linux --prefix=$$ROOTFS_DIR/usr --cache-file=$$ARCH-linux.cache && \

echo "config done"

build:

@cd $(GLIB_DIR) && \

make && make install && \

echo "build done"

clean:

@cd $(GLIB_DIR) && \

if [ -e Makefile ]; then make distclean; fi && \

echo "clean done"

在Dmalloc的ARM移植中报错 : Check Block Size

解决:在Configure.ac(有的是Configure.in)中将 Check Block Size 的句子删除,然后再删除原有的Configure文件,并运行autoconf来生成新的Configure,然后运行Configure,产生Makefile

 类似资料: