先用autogen.sh生成configure, 由于该脚本中对于交叉编译部分支持有问题, 需要做一些修改, 基本上就是把类似于这样的代码
  1.     if test "$cross_compiling" = yes; then
  2.   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
  3. See /`config.log' for more details." >&5
  4. echo "$as_me: error: cannot run test program while cross compiling
  5. See /`config.log' for more details." >&2;}
  6. { (exit 1); exit 1; }; }


改为

  1.     if test "$cross_compiling" = yes; then
  2.   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
  3. See /`config.log' for more details." >&5
  4. echo "$as_me: error: cannot run test program while cross compiling
  5. See /`config.log' for more details." >&2;}
  6.     }
  7. #modified: { (exit 1); exit 1; }; }

然后configure,

生成了Makefile和include/config.h等文件, 由于configure的时候用到了HOST系统下的一些头文件, 所以生成config.h中有些地方需要手动修改.我改动过的地方如下:

  1.  797 /* Whether the system has IPv6 support */
  2.  798 //robin: #define HAVE_IPV6 1
  3.  799

  4. 2648 /* Whether seteuid() is available */
  5. 2649 /* #undef USE_SETEUID */
  6. 2650 // rboin:
  7. 2651  #define USE_SETEUID 1

 我使用的如下脚本:

build.sh:

  1. export CFLAGS='-O3 -w -isystem /usr/local/arm-linux/include'
  2. export CPPFLAGS='-O3 -w -isystem /usr/local/arm-linux/include'
  3. export PATH=/usr/local/arm-linux/bin:$PATH
  4. export LD_LIBRARY_PATH=/usr/local/arm-linux/bin/arm-linux-gcc
  5. export CC=/usr/local/arm-linux/bin/arm-linux-gcc
  6. export CPP=/usr/local/arm-linux/bin/arm-linux-cpp

  7. MQARMDIR=/board/bin
  8. MQUSERDIR=/board/config

  9. ./configure  --build=x86-linux --host=arm-linux --target=arm-linux /
  10.         --includedir=/usr/local/arm-linux/include /
  11.         --oldincludedir=/usr/local/arm-linux/include /
  12.         --disable-largefile    /
  13.         --enable-swat=no /
  14.         --enable-cup=no /
  15.         --enable-iprint=no /
  16.         --enable-pie=no /
  17.         --enable-fam=no /
  18.         --enable-static=yes /
  19.         --enable-shared-libs=no /
  20.         --enable-dnssd=no /
  21.         --with-ldap=no /
  22.         --with-ads=no /
  23.         --with-cifsmount=no /
  24.         --with-utmp=no /
  25.         --with-libtalloc=no /
  26.         --with-libtdb=no /
  27.         --with-libnetapi=no /
  28.         --with-libaddns=no /
  29.         --with-libsmbclient=no /
  30.         --with-libsmbsharemodes=no /
  31.         --with-acl-support=no /
  32.         --with-sendfile-support=no /
  33.         --with-winbind=no /
  34.         --with-static-modules=nmbd,smbd,smbclient,smbpasswd /
  35.         --bindir=$MQARMDIR/bin /
  36.         --sbindir=$MQARMDIR/bin /
  37.         --localstatedir=$MQUSERDIR/samba/var /
  38.         --libdir=$MQARMDIR/lib /
  39.         --with-privatedir=$MQUSERDIR/samba/private /
  40.         --with-rootsbindir=$MQARMDIR/bin /
  41.         --with-lockdir=$MQUSERDIR/samba/var/locks /
  42.         --with-configdir=$MQUSERDIR/samba /
  43.         --with-logfilebase=$MQUSERDIR/samba/var /
  44.         --with-piddir=$MQUSERDIR/samba/var

  45. cp config.h include/config.h
  46. make clean
  47. time make

Good luck!

Logo

更多推荐