From e0406e3df7164d5616a78b2a8d7a95b6fa77d8d5 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Fri, 9 Oct 2020 20:24:08 +0800 Subject: [PATCH] Fix various build problems when building for non-HiSi config Mainly adding missing headers, removing redundant headers that induce undefined symbols or rearranging existing headers according to dependencies betheen them. Also add missing include paths to makefiles and make configs. Note: direct inclusion of pthread.h in disk.h is caused by the latter being used almost everywhere, including third_party libraries. Putting pthread.h there releases us from affecting more code. Basically fixes build for anything that is not default HiSi configuration. Signed-off-by: Zbigniew Bodek Change-Id: Icdcb0874d9fed34d01fa282d33bd2e041c2ac436 --- fs/include/disk.h | 2 ++ fs/vfs/disk/disk.c | 1 - syscall/los_syscall.c | 10 ++++++---- syscall/net_syscall.c | 1 - syscall/time_syscall.c | 1 + tools/build/mk/module.mk | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/include/disk.h b/fs/include/disk.h index 569c0e58..072cc432 100644 --- a/fs/include/disk.h +++ b/fs/include/disk.h @@ -47,6 +47,8 @@ #endif +#include "pthread.h" + #ifdef __cplusplus #if __cplusplus extern "C" { diff --git a/fs/vfs/disk/disk.c b/fs/vfs/disk/disk.c index 99bd612c..590e8327 100644 --- a/fs/vfs/disk/disk.c +++ b/fs/vfs/disk/disk.c @@ -34,7 +34,6 @@ #include "stdlib.h" #include "unistd.h" #include "sys/mount.h" -#include "pthread.h" #include "linux/spinlock.h" #include "inode/inode.h" diff --git a/syscall/los_syscall.c b/syscall/los_syscall.c index 136c2ef0..04bd3784 100644 --- a/syscall/los_syscall.c +++ b/syscall/los_syscall.c @@ -30,6 +30,12 @@ */ #define _GNU_SOURCE +#include "menuconfig.h" +#ifdef LOSCFG_FS_VFS +#include "fs/fs.h" +#include "fs/file.h" +#endif +#include "los_signal.h" #include "los_syscall.h" #include "los_task_pri.h" #include "los_process_pri.h" @@ -40,10 +46,6 @@ #include "mqueue.h" #include "los_futex_pri.h" #include "sys/times.h" -#ifdef LOSCFG_FS_VFS -#include "fs/fs.h" -#include "fs/file.h" -#endif #include "dirent.h" #include "fcntl.h" #include "unistd.h" diff --git a/syscall/net_syscall.c b/syscall/net_syscall.c index f1ac2489..da948df5 100644 --- a/syscall/net_syscall.c +++ b/syscall/net_syscall.c @@ -29,7 +29,6 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "los_syscall.h" #include "los_process_pri.h" #include "lwip/sockets.h" #include diff --git a/syscall/time_syscall.c b/syscall/time_syscall.c index af2188dc..23926157 100644 --- a/syscall/time_syscall.c +++ b/syscall/time_syscall.c @@ -36,6 +36,7 @@ #include "time.h" #include "user_copy.h" #include "sys/times.h" +#include "los_signal.h" #include "los_memory.h" #include "los_strncpy_from_user.h" diff --git a/tools/build/mk/module.mk b/tools/build/mk/module.mk index 7c9c0159..e8916568 100644 --- a/tools/build/mk/module.mk +++ b/tools/build/mk/module.mk @@ -81,7 +81,7 @@ all : $(LIB) $(LOCAL_COBJS): $(OBJOUT)/%.o: %.c $(HIDE)$(OBJ_MKDIR) - $(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) -c $< -o $@ + $(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_INCLUDE) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) -c $< -o $@ $(LOCAL_CPPOBJS): $(OBJOUT)/%.o: %.cpp $(HIDE)$(OBJ_MKDIR)