linux - 将 Samba 4.0.5 i686 交叉编译为 MIPS

标签 linux preprocessor

我被指派将 samba 4.0.5 从 i686 交叉编译到 MIPS,以便稍后将其移植到板上。我在 ubuntu 13.04 中编译。

我得到的错误是:

lib/sysquotas_4A.c: In function ‘sys_get_vfs_quota’:
lib/sysquotas_4A.c:107:10: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’
lib/sysquotas_4A.c:124:10: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’
lib/sysquotas_4A.c:170:29: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’
The following command failed:
cc -fno-builtin -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT 
-D_POSIX_PTHREAD_SEMANTICS -I. 
-I/home/constantine/software_forge/2013/5_month/samba/samba-4.0.5/source3 
-I/home/constantine/software_forge/2013/5_month/samba/samba-4.0.5/source3/../lib/popt 
-I/home/constantine/software_forge/2013/5_month/samba/samba-4.0.5/source3/../lib/iniparser/src 
-Iinclude/autoconf -Iautoconf -Iautoconf/source3 -Iinclude -I./include  
-I. -I. -I./../lib/replace -I./../lib/tevent -I../lib/ccan/.. -I./librpc -I./.. 
-I./../lib/tdb_compat -I./../lib/talloc -I../lib/tdb/include -I../lib/ntdb 
-DHAVE_CONFIG_H  -I/~/opt/buildroot-gcc342/include -Iinclude/autoconf -Iautoconf 
-Iautoconf/source3 -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I../lib/ccan/.. 
-I./librpc -I./.. -I./../lib/tdb_compat -I./../lib/popt -DLDAP_DEPRECATED  
-I/home/constantine/software_forge/2013/5_month/samba/samba-4.0.5/source3/lib -I.. 
-I./../lib/ldb/include -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3 -fPIE -c lib/sysquotas_4A.c -o lib/sysquotas_4A.o

我跑

./configure --target=mips-linux-uclibc --host=i686

在此之前我运行这些:

export LD_LIBARY_PATH=~/opt/buildroot-gcc342/lib
export LDFLAGS=-L/~/opt/buildroot-gcc342/lib
export CPPFLAGS=-I/~/opt/buildroot-gcc342/include
export CC=~/opt/buildroot-gcc342/bin/mipsel-linux-uclib-gcc

此外,我已经安装了配额包,删除了 -w 标志(正如来自 OS/X 的 friend 所建议的),但它仍然是一样的。它确实为本地架构编译。我也查看了来源,我看到了这些

#if _LINUX_QUOTA_VERSION < 2
struct dqblk{
   ...
   u_int32_t dqb_curblocks;
   ...
}
#else
#define QIF_BLIMITS     1
#define QIF_SPACE       2
...
struct dqblk{
   ...
}
#endif

并检查了包含的内容,它应该可以正常工作。 我是 linux 和交叉编译的新手,所以如果这个问题很愚蠢,我非常抱歉。然而不知何故,谷歌搜索结果到目前为止无法帮助我。

最佳答案

好的,我找到了解决方案,如果有人遇到类似情况,我会留下答案。

以上步骤完全正确。然而,应该确保 header 是从 MIPS 编译器目录中获取的。所以我通过指定 quota.h 的完整路径更改了 sysquotas_4A.c 的源代码,在我的例子中是 /opt/buildroot-gcc342/include/sys/quota.h 它工作得很好。

干杯, 康斯坦丁

关于linux - 将 Samba 4.0.5 i686 交叉编译为 MIPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16642714/

相关文章:

linux - getuid指的是哪里?

c - 如何在 Linux 内核中打印当前线程堆栈跟踪?

c - C 中的预 fork 模型

r - SparkR(Spark 2.1.0 或 2.2.0)中有 MaxAbsScaler 吗?

使可变长度输入参数无效的 C 宏

linux - 使用 buildroot 和 uboot 配置 initramfs

Linux 命令行到 Windows "ls"

c++ - 定义宏后的哈希符号?

c++ - 标识符和宏有什么区别?

c - 为什么预处理器需要大括号才能有语句?