mike22437120 / openwrt-for-embedded

Automatically exported from code.google.com/p/openwrt-for-embedded
0 stars 0 forks source link

mysql-5.1.53编译出错 #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
编译qt4时用到mysql-5.1.53,编译出错:
configure: WARNING: unrecognized options: --disable-nls, --without-raid, 
--without-mysqlfs, --without-vio, --without-bench
configure: loading site script include/site/arm-openwrt-linux-gnueabi
checking build system type... i686-pc-linux-gnu
checking host system type... arm-openwrt-linux-gnu
checking target system type... arm-openwrt-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk 
checking whether make sets $(MAKE)... yes
checking for arm-openwrt-linux-strip... arm-openwrt-linux-gnueabi-strip
checking how to create a ustar tar archive... gnutar
checking for style of include used by make... GNU
checking for arm-openwrt-linux-gcc... arm-openwrt-linux-gnueabi-gcc
checking for C compiler default output file name... 
configure: error: in `build_dir/target-arm_v7-a_glibc-2.6.1_eabi/mysql-5.1.53':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[3]: *** 
[build_dir/target-arm_v7-a_glibc-2.6.1_eabi/mysql-5.1.53/.configured_] Error 77
make[3]: Leaving directory `feeds/packages/libs/mysql'
make[2]: *** [package/feeds/packages/mysql/compile] Error 2

1 glibc和eglibc都编译出错!
2 uClibc编译通过!
3 openwrt-dreambox情况和openwrt-for-embedded情况一样!

Original issue reported on code.google.com by richard....@gmail.com on 1 Jun 2012 at 2:39

GoogleCodeExporter commented 9 years ago
config.log中关于出错的记载:

configure:3682: checking for C compiler default output file name
configure:3704: arm-openwrt-linux-gnueabi-gcc -O2 -pipe -march=armv7-a 
-mtune=cortex-a8 -funit-at-a-time -mfpu=vfp -mfloat-abi=softfp -fhonour-copts 
-msoft-float -fpic  
-I./staging_dir/target-arm_v7-a_glibc-2.6.1_eabi/usr/include 
-I./staging_dir/target-arm_v7-a_glibc-2.6.1_eabi/include 
-I./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/usr/include 
-I./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/include  
-I./staging_dir/target-arm_v7-a_glibc-2.6.1_eabi/usr/include/uClibc++ 
-L./staging_dir/target-arm_v7-a_glibc-2.6.1_eabi/usr/lib 
-L./staging_dir/target-arm_v7-a_glibc-2.6.1_eabi/lib 
-L./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/usr/lib 
-L./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/lib  
conftest.c -nodefaultlibs -luClibc++ -lm 
-L./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/lib -lgcc_s >&5
./staging_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_glibc-2.6.1_eabi/usr/lib/gcc/arm-o
penwrt-linux-gnueabi/4.3.3/../../../../arm-openwrt-linux-gnueabi/lib/crt1.o: In 
function `_start':
init.c:(.text+0x2c): undefined reference to `__libc_csu_fini'
init.c:(.text+0x34): undefined reference to `__libc_csu_init'
collect2: ld returned 1 exit status
configure:3708: $? = 1
configure:3746: result:
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "MySQL Server"
| #define PACKAGE_TARNAME "mysql"
| #define PACKAGE_VERSION "5.1.53"
| #define PACKAGE_STRING "MySQL Server 5.1.53"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "mysql"
| #define VERSION "5.1.53"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3752: error: in 
`./build_dir/target-arm_v7-a_glibc-2.6.1_eabi/mysql-5.1.53':
configure:3755: error: C compiler cannot create executables
See `config.log' for more details.

Original comment by richard....@gmail.com on 1 Jun 2012 at 2:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
在build_dir/toolchain-arm_v7-a_gcc-4.3.3+cs_eglibc-2.8_eabi下:
grep -r "__libc_csu_fini" ./
查找相关信息。

1. 下面是有关于__libc_csu_fini的定义,它是个全局变量?!:
./eglibc-2.8-r8587/libc/sysdeps/sh/elf/start.S: .long   __libc_csu_fini

2. arm中有使用:
./eglibc-2.8-r8587/libc/ports/sysdeps/arm/elf/start.S:  ldr ip, =__libc_csu_fini
./eglibc-2.8-r8587/ports/sysdeps/arm/elf/start.S:   ldr ip, =__libc_csu_fini

3. 关于__libc_csu_fini的说明
./eglibc-2.8-r8587/libc/ChangeLog.14:   and __libc_csu_fini in place of _fini.
./eglibc-2.8-r8587/libc/ChangeLog.16:   * csu/elf-init.c (__libc_csu_fini): 
Pretty printing.
./eglibc-2.8-r8587/libc/ChangeLog.16:   * csu/elf-init.c (__libc_csu_fini): 
Enable if LIBC_NONSHARED
./eglibc-2.8-r8587/libc/ChangeLog.16:   * csu/elf-init.c (__libc_csu_fini): Don't 
do anything here.

Original comment by richard....@gmail.com on 1 Jun 2012 at 5:58

GoogleCodeExporter commented 9 years ago
编译sdlpal仙剑游戏时用到了__libc_csu_fini:(build_dir/target-xx目�
��下)
./sdlpal-61376/dist/Debug/GNU-Linux-arm/sdlpal.map:                             

/home/richardnee/2.OpenWRT/0-OpenWRT-for-Embedded/trunk-10.03.1/staging_dir/tool
chain-arm_v7-a_gcc-4.3.3+cs_eglibc-2.8_eabi/usr/lib/gcc/arm-openwrt-linux-gnueab
i/4.3.3/../../../../arm-openwrt-linux-gnueabi/lib/crt1.o (__libc_csu_fini)
./sdlpal-61376/dist/Debug/GNU-Linux-arm/sdlpal.map:                0x0005de84   
             __libc_csu_fini

Original comment by richard....@gmail.com on 1 Jun 2012 at 6:01

GoogleCodeExporter commented 9 years ago
编译busybox时也用到了__libc_csu_fini:(build_dir/target-xx目录下)
./busybox-1.15.3/busybox_unstripped.map:                              
/home/richardnee/2.OpenWRT/0-OpenWRT-for-Embedded/trunk-10.03.1/staging_dir/tool
chain-arm_v7-a_gcc-4.3.3+cs_eglibc-2.8_eabi/usr/lib/gcc/arm-openwrt-linux-gnueab
i/4.3.3/../../../../arm-openwrt-linux-gnueabi/lib/crt1.o (__libc_csu_fini)
./busybox-1.15.3/busybox_unstripped.map:                0x00064ce8              
  __libc_csu_fini

Original comment by richard....@gmail.com on 1 Jun 2012 at 6:02

GoogleCodeExporter commented 9 years ago
详见:http://www.linuxquestions.org/questions/linux-general-1/undefined-refer
ence-to-%60__libc_csu_fini-849247/
TOOLCHAINDIR/usr/lib/crt1.o中的__libc_csu_fini,__libc_csu_init函数没有��
�义(是引用外部函数的)
使用objdump -x crt1.o命令可以查看的到:
00000000 l       .text  00000000 $a
00000000 l       .data  00000000 $d
0000002c l       .text  00000000 $d
00000000 l    df *ABS*  00000000 init.c
00000000 l       .rodata.cst4   00000000 $d
00000000         *UND*  00000000 __libc_csu_fini
00000000         *UND*  00000000 abort
00000000 g     F .text  00000000 _start
00000000         *UND*  00000000 __libc_csu_init
00000000         *UND*  00000000 main
00000000  w      .data  00000000 data_start
00000000 g     O .rodata.cst4   00000004 _IO_stdin_used
00000000         *UND*  00000000 __libc_start_main
00000000 g       .data  00000000 __data_start

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE              VALUE 
00000024 UNKNOWN           __libc_start_main
00000028 UNKNOWN           abort
0000002c UNKNOWN           __libc_csu_fini
00000030 UNKNOWN           main
00000034 UNKNOWN           __libc_csu_init

实际上他们最终是要使用应该定义在TOOLCHAINDIR/usr/lib/libc.so(该
文件定义了这两个函数),
而实际上eglibc/glibc中的TOOLCHAINDIR/usr/lib/libc.so是一个文本文件�
��
cat TOOLCHAINDIR/usr/lib/libc.so

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )

而uClibc使用的是链接到../../lib/libc.so,而又再链接到../../lib/li
buClibc-0.9.30.1.so,所以在uClibc中会成功编译!!!!!!!!�
��(eglibc/glibc的../../lib/libc.so仍为内容相同的文本文件!!)

实际上下面两个静态库定义了这两个函数:(从libc.so文本文�
��中也可以看得出!)
TOOLCHAINDIR/usr/lib/libc_nonshared.a
TOOLCHAINDIR/usr/lib/libc.a

所以,解决办法:
1 使用-L$TOOLCHAINDIR/usr/lib/libc.a -L$TOOLCHAINDIR/usr/lib/libc_nonshared.a
2 把libc_nonshared.a,libc.a,链接出.so的软链接?

Original comment by richard....@gmail.com on 4 Jun 2012 at 1:42

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
1 使用判断语句,是否是真的二进制库?
如果是,不动,如果不是则链接!

2 或者判断使用的是uClibc还是eglibc/glibc来解决这个问题

Original comment by richard....@gmail.com on 4 Jun 2012 at 3:07

GoogleCodeExporter commented 9 years ago
1 之后又出现ld:cannot found 
uClibc++.so(因为它依赖uClibc++,先make下把uClibc++编译了就行)�
��
2 libc.so这个脚本是用来链接到libc.so.6 libc_nonshared.a!

Original comment by richard....@gmail.com on 4 Jun 2012 at 4:28

GoogleCodeExporter commented 9 years ago
我擦,网友在尝试各种方法后,该网友尝试加了 
-lc(指定使用libc.so或者libc.a),编译成功!!!!!!!!!��
�!
详见:http://sourceware.org/ml/libc-help/2009-12/msg00017.html

我尝试了下,可以通过编译!!!!!!!!!
不知运行是不是也可以?理论上应该可以(虽说不是使用的��
�态libc.so,是使用的静态libc.a)

Original comment by richard....@gmail.com on 4 Jun 2012 at 5:25