Chinaunix首页 | 论坛 | 博客
  • 博客访问: 14688
  • 博文数量: 4
  • 博客积分: 155
  • 博客等级: 入伍新兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-28 18:28
文章分类
文章存档

2011年(4)

我的朋友

分类: LINUX

2011-03-16 21:17:51

[issue]

squashfs最后连接时找不到get_nprocs(),这个接口不包含在uClibc中。

unsquashfs.o: In function `initialise_threads’:

unsquashfs.c:(.text+0xb27): undefined reference to `get_nprocs’

collect2: ld returned 1 exit status

 

[analysis]

get_nprocs()可以直接用sysconf(_SC_NPROCESSORS_CONF)来实现。

 

[resolution]

修改squashfs-tools/mksquashfs.c和unsquashfs.c,用sysconf(_SC_NPROCESSOR_CONF)替代get_nprocs();

 

diff --git a/package/squashfs/squashfs-4.0-mksquashfs-get_nprocs.patch b/package/squashfs/squashfs-4.0-mksquashfs-get_nprocs.patch new file mode 100644 index 0000000..8a19923 --- /dev/null +++ b/package/squashfs/squashfs-4.0-mksquashfs-get_nprocs.patch @@ -0,0 +1,37 @@ +[PATCH] squashfs-tools: Don't use get_nprocs() + +get_nprocs() is a GNU extension, not supported on E.G. uClibc. It is a +simple wrapper around sysconf(_SC_NPROCESSORS_CONF), so use that instead. + +Signed-off-by: Peter Korsgaard <> +--- + squashfs-tools/mksquashfs.c | 2 +- + squashfs-tools/unsquashfs.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: squashfs4.0/squashfs-tools/mksquashfs.c +=================================================================== +--- squashfs4.0.orig/squashfs-tools/mksquashfs.c ++++ squashfs4.0/squashfs-tools/mksquashfs.c +@@ -3705,7 +3705,7 @@ void initialise_threads() + processors = 1; + } + #else +- processors = get_nprocs(); ++ processors = sysconf(_SC_NPROCESSORS_CONF); + #endif + } + +Index: squashfs4.0/squashfs-tools/unsquashfs.c +=================================================================== +--- squashfs4.0.orig/squashfs-tools/unsquashfs.c ++++ squashfs4.0/squashfs-tools/unsquashfs.c +@@ -1811,7 +1811,7 @@ void initialise_threads(int fragment_buf + processors = 1; + } + #else +- processors = get_nprocs(); ++ processors = sysconf(_SC_NPROCESSORS_CONF); + #endif + } +

 

[reference]

[1].

阅读(1828) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~