LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2579|回复: 23

交叉编译时找不到gtk库时改怎么办

[复制链接]
发表于 2006-3-6 16:47:17 | 显示全部楼层 |阅读模式
交叉编译一个gtk程序时错误如下:
[root@localhost gqcam-0.9]# make
/usr/local/arm/3.3.2/bin/arm-linux-gcc `gtk-config --libs gthread` -ljpeg -lpthread -lpng gqcam.o frontend.o save.o color.o greyscale.o timer.o filters.o preferences.o -o gqcam
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipping incompatible /usr/lib/libgtk.so when searching for -lgtk
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipping incompatible /usr/lib/libgtk.a when searching for -lgtk
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find -lgtk
collect2: ld returned 1 exit status
make: *** [gqcam] Error 1
请问该如何在交叉编译环境中配置gtk的库文件??
 楼主| 发表于 2006-3-6 17:01:41 | 显示全部楼层
我用的是网上下载的现成的交叉编译环境,如果说要重新编译那些库改怎么操作?
回复 支持 反对

使用道具 举报

发表于 2006-3-6 17:15:08 | 显示全部楼层
我没有交叉编译过GTK程序,但是我在移植MiniGUI程序的时候,是这么做的:
首先交叉编译MiniGUI的库,并安装到arm-linux-gcc的相关目录下,比如我的arm-linux-gcc是在/usr/local/arm/3.3.2/目录下的,那么我就把minigui的库prefix到这个目录,于是当我交叉编译基于minigui的应用程序的时候,arm-linux-xxx就可以自动找到minigui的库,并进行连接了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-6 21:48:10 | 显示全部楼层
交叉编译MiniGUI的库是怎么操作的
具体代码是怎么样,例如说我要交叉编译libgtk.so这个库该怎么办?
回复 支持 反对

使用道具 举报

发表于 2006-3-7 13:35:59 | 显示全部楼层
为了交叉编译并安装minigui的库,只要在libminigui(minigui的开发库的名字)的代码目录中

  1. CC=/usr/local/arm/3.3.2/bin/arm-linux-gcc \
  2. ./configure \
  3. --prefix=/usr/local/arm/3.3.2
复制代码

然后

  1. make && make install
复制代码


所以楼主如果想交叉安装gtk的库,我想首先也要先获得gtk相关的库的源码并进行类似的操作.或者gtk的主页上也可能提供预编译好(针对Arm)的包,那么直接下载并使用也行
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-7 14:34:23 | 显示全部楼层
谢谢你的回复
我按你的提示出现如下提示:
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
然后我加上了--host=arm-linux --build=i686-linux
然后出现如下提示:
checking for growing stack pointer... configure: error: cannot run test program while cross compiling
See `config.log' for more details.
回复 支持 反对

使用道具 举报

发表于 2006-3-7 15:19:35 | 显示全部楼层
can you upload your config.log?
回复 支持 反对

使用道具 举报

发表于 2006-3-7 15:41:19 | 显示全部楼层
cross 编译的,一般都是不能check的,我觉得很正常的。

一开始的问题,是没有为 ARM 编译的 gtk。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-7 17:20:16 | 显示全部楼层
config.log is as fellow:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:655: checking for a BSD compatible install
configure:708: checking whether build environment is sane
configure:765: checking whether make sets ${MAKE}
configure:804: checking for working aclocal
configure:817: checking for working autoconf
configure:830: checking for working automake
configure:843: checking for working autoheader
configure:856: checking for working makeinfo
configure:928: checking host system type
configure:949: checking build system type
configure:969: checking for ranlib
configure:999: checking for gcc
configure:1112: checking whether the C compiler (gcc  ) works
configure:1128: gcc -o conftest    conftest.c  1>&5
configure:1154: checking whether the C compiler (gcc  ) is a cross-compiler
configure:1159: checking whether we are using GNU C
configure:1187: checking whether gcc accepts -g
configure:1230: checking for ld used by GCC
configure:1323: checking if the linker (/usr/bin/ld) is GNU ld
configure:1339: checking for BSD-compatible nm
configure:1375: checking command to parse /usr/bin/nm -B output
configure:1535: checking for _ prefix in compiled symbols
configure:1578: checking whether ln -s works
ltconfig:552: checking for object suffix
ltconfig:553: gcc -c -g -O2  conftest.c 1>&5
ltconfig:674: checking if gcc PIC flag -fPIC works
ltconfig:675: gcc -c -g -O2 -fPIC -DPIC  conftest.c 1>&5
ltconfig:709: checking if gcc supports -c -o file.o
ltconfig:710: gcc -c -g -O2 -c -o conftest2.o  conftest.c 1>&5
ltconfig:737: checking if gcc supports -c -o file.lo
ltconfig:738: gcc -c -g -O2 -c -o conftest.lo  conftest.c 1>&5
ltconfig:789: checking if gcc supports -fno-rtti -fno-exceptions
ltconfig:790: gcc -c -g -O2 -fno-rtti -fno-exceptions -c conftest.c  conftest.c 1>&5
ltconfig:833: checking if gcc static flag -static works
ltconfig:834: gcc -o conftest -g -O2   -static conftest.c  1>&5
GNU ld version 2.13.90.0.18 20030206
ltconfig:1425: checking if global_symbol_pipe works
ltconfig:1426: gcc -c -g -O2  conftest.c 1>&5
ltconfig:1429: eval "/usr/bin/nm -B conftest.o | sed -n -e 's/^.* [ABCDGISTUW] \([_A-Za-z][_A-Za-z0-9]*\)$/\1 \1/p' > conftest.nm"
ltconfig:1487: gcc -o conftest -g -O2 -fno-builtin -fno-rtti -fno-exceptions   conftest.c conftestm.o 1>&5
configure:1843: checking whether to enable maintainer-specific portions of Makefiles
configure:1873: checking host system type
configure:1973: checking whether build environment is sane
configure:2015: checking for gcc
configure:2128: checking whether the C compiler (gcc -g -O2 ) works
configure:2144: gcc -o conftest -g -O2   conftest.c  1>&5
configure:2170: checking whether the C compiler (gcc -g -O2 ) is a cross-compiler
configure:2175: checking whether we are using GNU C
configure:2203: checking whether gcc accepts -g
configure:2235: checking for POSIXized ISC
configure:2259: checking for gcc option to accept ANSI C
configure:2347: checking for a BSD compatible install
configure:2400: checking whether make sets ${MAKE}
configure:2454: checking for mawk
configure:2488: checking for perl5
configure:2522: checking for indent
configure:2560: checking how to run the C preprocessor
configure:2640: checking for ANSI C header files
configure:2744: checking for working const
configure:2819: checking for inline
configure:2859: checking for off_t
configure:2892: checking for size_t
configure:2927: checking for working alloca.h
configure:2960: checking for alloca
configure:3162: checking for unistd.h
configure:3201: checking for getpagesize
configure:3254: checking for working mmap
configure:3430: checking for argz.h
configure:3430: checking for limits.h
configure:3430: checking for locale.h
configure:3430: checking for nl_types.h
configure:3430: checking for malloc.h
configure:3430: checking for string.h
configure:3430: checking for unistd.h
configure:3430: checking for sys/param.h
configure:3470: checking for getcwd
configure:3470: checking for munmap
configure:3470: checking for putenv
configure:3470: checking for setenv
configure:3470: checking for setlocale
configure:3470: checking for strchr
configure:3470: checking for strcasecmp
configure:3470: checking for strdup
configure:3470: checking for __argz_count
configure:3470: checking for __argz_stringify
configure:3470: checking for __argz_next
configure:3589: checking for LC_MESSAGES
configure:3622: checking whether NLS is requested
configure:3654: checking for libintl.h
configure:3681: checking for gettext in libc
configure:3807: checking for msgfmt
configure:3841: checking for dcgettext
configure:3896: checking for gmsgfmt
configure:3932: checking for xgettext
configure:3972: gcc -o conftest -g -O2 -Wall   conftest.c  1>&5
configure:4248: checking for catalogs to be installed
configure:4351: checking for gettext
configure:4452: checking for extra flags to get ANSI library prototypes
configure:4465: gcc -o conftest -g -O2 -Wall   conftest.c  -lm 1>&5
configure:4506: checking for extra flags for POSIX compliance
configure:4515: gcc -c -g -O2 -Wall  conftest.c 1>&5
configure: In function `main':
configure:4511: warning: unused variable `dir'
configure:4608: checking for glib-config
configure:4643: checking for GLIB - version >= 1.2.0
configure:4742: gcc -o conftest -g -O2 -Wall -I/usr/include/glib-1.2 -I/usr/lib/glib/include -D_REENTRANT   conftest.c -L/usr/lib -rdynamic -lgmodule -lgthread -lglib -lpthread -ldl  1>&5
configure:4882: checking for X
configure:5196: checking for dnet_ntoa in -ldnet
configure:5237: checking for dnet_ntoa in -ldnet_stub
configure:5285: checking for gethostbyname
configure:5383: checking for connect
configure:5475: checking for remove
configure:5567: checking for shmat
configure:5668: checking for IceConnectionNumber in -lICE
configure:5731: checking for XOpenDisplay in -lX11
configure:5775: checking for XShmAttach in -lXext
configure:5861: checking for XShapeCombineMask in -lXext
configure:5910: checking for XConvertCase in -lX11
configure:5956: checking for XUnregisterIMInstantiateCallback in -lX11
configure:6060: checking for sys/ipc.h
configure:6097: checking for sys/shm.h
configure:6135: checking X11/extensions/XShm.h
configure:6156: checking need -DX_LOCALE
configure:6174: gcc -o conftest -g -O2 -Wall   conftest.c  1>&5
configure:6194: checking for ANSI C header files
configure:6300: checking for working const
configure:6377: checking return type of signal handlers
configure:6421: checking for unistd.h
configure:6460: checking for getpagesize
configure:6513: checking for working mmap
configure:6686: checking for fd_set
configure:6695: gcc -c -g -O2 -Wall  conftest.c 1>&5
configure: In function `main':
configure:6691: warning: unused variable `readMask'
configure:6691: warning: unused variable `writeMask'
configure:6838: checking for wchar.h
configure:6845: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:6870: checking for wctype.h
configure:6877: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:6902: checking for iswalnum
configure:6994: checking if iswalnum() and friends are properly defined
configure:7016: gcc -o conftest -g -O2 -Wall   conftest.c   1>&5
configure: In function `main':
configure:7011: warning: implicit declaration of function `isalnum'
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-7 17:22:52 | 显示全部楼层
./configure --host=arm-linux --build=i686-linux \
-with-cc=/usr/local/arm/2.95.3/bin/arm-linux-gcc \
-with-linker=/usr/local/arm/2.95.3/bin/arm-linux-ld \
--prefix=/usr/local/arm/2.95.3
make
make install
出来的libgtk.so.0.0.1出来不是arm版本的,而是intel的,是不是哪里出错了?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表