交叉编译samba(mipsel-linux)

这篇文章我从网上下下来的,一直放在草稿箱里,忘了从哪里转来的。感谢原作者,按他的做法能正常移植。

今天完成了交叉编译samba的学习。将samba移植到mipsel-linux平台上。相关工作流程如下。

一:简介

制作mipsel-linux交叉编译工具链;

使用samba-3.3.3.tar.gz源代码;

二:流程

1、在/etc/profile中设置mipsel-linux交叉编译工具路径,执行source指令使之生效;

或者在当前终端标签页中使用export PATH=${bin directory of mipsel-linux}:$PATH

2、解压samba到设定之目录;

3、configure脚本build.sh

***********************************************

#!/bin/bash

export CFLAGS='-O3 -w -isystem /Cross/target/local/mipsel-linux/include'

export CPPFLAGS='-O3 -w -isystem /Cross/target/local/mipsel-linux/include'

export PATH=/Cross/target/local/bin:$PATH

export LD_LIBRARY_PATH=/Cross/target/local/bin/mipsel-linux-gcc

export CC=/Cross/target/local/bin/mipsel-linux-gcc

export CPP=/Cross/target/local/bin/mipsel-linux-cpp

./configure  --build=i686-linux --host=mipsel-linux --target=mipsel-linux \

--includedir=/Cross/target/local/mipsel-linux/include \

--oldincludedir=/Cross/target/local/mipsel-linux/include \

--disable-largefile    \

--enable-swat=no \

--enable-cups=no \

--enable-iprint=no \

--enable-pie=no \

--enable-fam=no \

--enable-static=yes \

--enable-shared-libs=no \

--enable-dnssd=no \

--with-ldap=no \

--with-ads=no \

--with-cifsmount=no \

--with-utmp=no \

--with-libtalloc=no \

--with-libtdb=no \

--with-libnetapi=no \

--with-libaddns=no \

--with-libsmbclient=no \

--with-libsmbsharemodes=no \

--with-acl-support=no \

--with-sendfile-support=no \

--with-winbind=no \

--with-static-modules=nmbd,smbd,smbclient,smbpasswd \

--bindir=$MQARMDIR/bin \

--sbindir=$MQARMDIR/bin \

--localstatedir=$MQUSERDIR/samba/var \

--libdir=$MQARMDIR/lib \

--with-privatedir=$MQUSERDIR/samba/private \

--with-rootsbindir=$MQARMDIR/bin \

--with-lockdir=$MQUSERDIR/samba/var/locks \

--with-configdir=$MQUSERDIR/samba \

--with-logfilebase=$MQUSERDIR/samba/var \

--with-piddir=$MQUSERDIR/samba/var \

--cache-file=mipsel-linux.cache

***********************************************

执行该编译脚本。在编译过程中会出现一些问题,现描述如下:

3.1 error: cannot run test program while cross compiling错误

checking that the C compiler understands negative enum values... configure: error: in `/root/samba-3.3.3/source':

configure: error: cannot run test program while cross compiling

原因:

查找“negative enum values”关键字,就可以找到问题发生的地方。

通常我们configure的时候使用./configure  --build=i686-linux --host=$ARCH-linux --target=$ARCH-linux的形式,但是在configure中有很多的测试程序是不能在HOST上运行的。configure不能为交叉编译检查samba_cv_CC_NEGATIVE_ENUM_VALUES。configure无法在目标机上运行测试程序,自然无法检查,只好手工指定。

解决方法:

#echo samba_cv_CC_NEGATIVE_ENUM_VALUES=yes>mipsel-linux.cache

然后在build.sh脚本中的最后一行添加“--cache-file=mipsel-linux.cache”

如果后面还遇到类似的问题,则之需要找到相关的地方,并将指定的值追加到mipsel-linux.cache文件中。

3.2 configure: error: cannot run test program while cross compiling错误

configure: error: in `/root/samba-3.3.3/source':

configure: error: cannot run test program while cross compiling

See `config.log' for more details.

原因:这个错误是由于configure对交叉编译支持的问题造成的,通过在configure文件中查找,您可以看到原文件中该部分的内容为:

******************************************

{ $as_echo "$as_me:$LINENO: checking for replacing readdir using getdirentries()" >&5

$as_echo_n "checking for replacing readdir using getdirentries()... " >&6; }

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

$as_echo_n "(cached) " >&6

else

if test "$cross_compiling" = yes; then{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compilingSee \`config.log' for more details." >&5$as_echo "$as_me: error: cannot run test program while cross compilingSee \`config.log' for more details." >&2;}{ (exit 1); exit 1; }; }; }

else

cat >conftest.$ac_ext

上面即为问题出现点,红色字体部分是需要修改的地方。修改后的结果如下:

******************************************

{ $as_echo "$as_me:$LINENO: checking for replacing readdir using getdirentries()" >&5

$as_echo_n "checking for replacing readdir using getdirentries()... " >&6; }

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

$as_echo_n "(cached) " >&6

else

if test "$cross_compiling" = yes; then{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compilingSee \`config.log' for more details." >&5$as_echo "$as_me: error: cannot run test program while cross compilingSee \`config.log' for more details." >&2;}

}; }    #新增该行#注销该行   { (exit 1); exit 1; }; }; }

else

cat >conftest.$ac_ext

以关键字“error: cannot run test program while cross compiling”查找configure文件,将其中相关代码都修改过来,即可以解决该问题。

3.3 头文件错误

编译过程中会出现找不到头文件的错误,拷贝/usr/include/linux/dqblk_xfs.h文件到mipsel-linux交叉编译工具链的linux/include目录中;

cp /usr/include/linux/dqblk_xfs.h /Cross/target/local/mipsel-linux/include/linux

3.4 库文件连接错误:找不到-lcups

拷贝交叉编译的cups相关库到mipsel-linux交叉编译工具链的lib目录中

cp /crosstool/test/cups/mips/cups-1.3.9/cups/libcups.a /Cross/target/local/mipsel-linux/lib

cp /crosstool/test/cups/mips/cups-1.3.9/cups/libcups.so* /Cross/target/local/mipsel-linux/lib

以上目录需要自己指定您机器上的目录,以上只是本机的目录。

4、make

执行make指令。

三. 配置

[global]

workgroup = MSHOME

unix charset = UTF8

display charset = UTF8

dos charset = UTF8

netbios name = longjindong

dns proxy = no

domain master = no

local master = Yes

preferred master = Yes

os level = 35

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

interfaces = 192.168.1.1/192.168.1.0

guest account = admin

log level = 0

max log size = 10

security = share

load printers = no

[longjindong]

path = /mnt/usb

writable = yes

guest ok = yes

read only = no

四:后记

参考文档:http://blog.csdn.net/robinqcn/archive/2008/10/23/3132054.aspx

欢迎大家讨论cups+samba到开发板的移植。

linux交叉编译libnet,交叉编译samba(mipsel-linux) samba-3.3.3.tar.gz相关推荐

  1. 如何在Linux下创建与解压zip, tar, tar.gz和tar.bz2文件 .

    这么多年来,数据压缩对我们来说是非常有用的.无论是在邮件中发送的图片用的zip文件还是在服务器压缩数据文件,我们都可以让下载更容易或者有效的节约磁盘空间.某些压缩格式有时允许我们以60%的比率(甚至更 ...

  2. linux系统下tar/gz/7z/xz/bz2/zip等各种格式的打包压缩解压

    linux系统下总会遇到各种格式的压缩包,什么tar/gz/7z/xz/bz2/zip等等,每种格式文件的解压和压缩方法都不完全一致,所携带的参数也都各有千秋,初学者往往会一脸茫然,不知如何是好.于是 ...

  3. linux下终端解压rar,Linux下解压.rar文件

    一.简介 日常我们传到Linux服务器上的文件可能是.zip的文件或者.tar.gz的文件,我们可以用相应的命令对文件进行解压.有的时候会遇到.rar的文件.本次使用rar软件版本是5.6.0.官方网 ...

  4. linux设置用户的执行权限,Linux下ACL权限控制以及用sudo设置用户对命令的执行权限...

    ACL权限分配 1.setfacl命令设置文件权限 setfacl -m u:user1:rw root.txt setfacl -m u:user2:rwx root.txt 2.getfacl命令 ...

  5. Linux下安装JDK笔记与Linux安装Tomcat笔记

    项目需要,又要折腾Linux了,使用了VMware装一下linux,配置java运行环境,首先是配置JDK... OS:CentOS 64bit 一:到Oracle下载最新版的JDK http://w ...

  6. Linux下软件包的分类及deb、rpm、tar.gz的区别

    一.Linux下软件包的内容分类 Linux应用程序的软件包按内容类别可分为两类: 1.可执行文件(编译后的二进制软件包)   解开包后就可以直接运行的.在Windows中所有的软件包都是这种类型.安 ...

  7. linux系统安装.tar.gz文件,Linux中下载、解压、安装.tar.gz文件

    一.将解压包发送到linux服务器上: 1.在windos上下载好.tar.gz文件后,通过winscp等SFTP客户端传送给linux 2.在linux中通过wget命令直接下载 #wget [选项 ...

  8. linux内核arp访欺骗配置,Linux防止ARP欺骗攻击

    之前有介绍ARP攻击测试及查找ARP攻击源,本次记录下如何防止ARP攻击. 1.ARP网关欺骗攻击解决,静态绑定网关MAC与IP.arp -s 192.168.1.1 00:1f:a3:65:55:8 ...

  9. 树莓派linux编译不了动态库,linux系统下的树莓派与Qt 5.12.3源码的交叉编译

    {写在前面:按照这个方法,基本可以成功在linux系统下交叉编译Qt5.12.3,其他版本的源码也编译} 我的环境:Linux Mint 19.1;树莓派 3;Qt源码5.12.3 当两个系统全部安装 ...

  10. 嵌入式linux内核编译感想,嵌入式Linux内核的交叉编译编译-基于2.6.26

    测试环境:Fedora 9 Linux 2.6.26 / gcc 4.3.0 / arm-Linux-gcc 3.4.1 本 文主要介绍如何构建在x86平台上交叉编译各平台上的嵌入式Linux内核.要 ...

最新文章

  1. 血栓清道夫机器人_血栓“清道夫”找到了!洋葱排最后,排在第一很多人并不知道...
  2. sklearn自学指南(part17)--稳健回归-异常值和建模误差
  3. lambda表达式之进化
  4. https open api_Web上的分享(Share)API
  5. windows下WMI使用C++查询用户硬件信息
  6. 前端模板inspinia
  7. LayoutIt! 设计Bootstrap页面
  8. 美的oracle财务系统,美的集团Oracle ERP 系统财务操作手册(pdf 73页)
  9. log4j日志级别配置完成后不生效 系统一直打印debug日志
  10. 带节日和农历的js日历
  11. ArcGIS三维资源收集帖
  12. Origin批量处理多列数据(多列重复相同运算)
  13. Pandas数据分析groupby函数深度总结(1)
  14. 台灣人如何在大陸工作
  15. 深圳云计算培训学习:构建企业级WIKI及工单系统 --【千锋】
  16. 玛雅三维动画制作软件:Maya 2019 for Mac
  17. 面试题之从敲入 URL 到浏览器渲染完成
  18. sql语句-既包含又包含
  19. oracle数据库scn是什么
  20. java实现串的反转

热门文章

  1. 2017年经典hadoop体系课程-徐培成-专题视频课程
  2. 保护心灵窗口——防蓝光软件f.lux
  3. QT界面无法显示中文
  4. ruby入门教程:入门ruby的方法
  5. 商业模式画布 - 天涯的日志 - 网易博客
  6. python爬虫(十一)爬取贴吧图片
  7. Hash 表的时间复杂度为什么是 O(1)(面试版)
  8. 【纯·干货】你会用到的期刊读Paper发论文写论文必备网站及各种小助手,不定期持续更新中~
  9. IDEA反编译java.class文件
  10. 心电信号越界怎么回事_人体心电信号的特点