davee_x

导航

kmod编译找不到函数kmod_log

编译报错:

/usr/bin/ld: Warning: gc-sections option ignored
libkmod/.libs/libkmod-util.a(libkmod-util.o): In function `underscores':
/root/rpmbuild/BUILD/kmod-7/libkmod/libkmod-util.c:117: undefined reference to `kmod_log'
/root/rpmbuild/BUILD/kmod-7/libkmod/libkmod-util.c:117: undefined reference to `kmod_log'
/root/rpmbuild/BUILD/kmod-7/libkmod/libkmod-util.c:111: undefined reference to `kmod_log'
/root/rpmbuild/BUILD/kmod-7/libkmod/libkmod-util.c:111: undefined reference to `kmod_log'
collect2: ld returned 1 exit status
make[2]: *** [tools/kmod] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f tools/.deps/tools_kmod_nolib-kmod-depmod.Tpo tools/.deps/tools_kmod_nolib-kmod-depmod.Po
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.2gp1LL (%build)

 

解决办法,将kmod_log函数引出

patch:

libkmod/libkmod.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 36ca629..74fd9ef 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -85,9 +85,9 @@ struct kmod_ctx {
unsigned long long indexes_stamp[_KMOD_INDEX_MODULES_SIZE];
};

-void kmod_log(const struct kmod_ctx *ctx,
-    int priority, const char *file, int line, const char *fn,
-    const char *format, ...)
+KMOD_EXPORT void kmod_log(const struct kmod_ctx *ctx,
+    int priority, const char *file, int line,
+    const char *fn, const char *format, ...)
{
va_list args;

 

posted on 2016-08-18 14:12  Wigde.Xiao  阅读(426)  评论(0编辑  收藏  举报