Fóruns: Ajuda (Thread #39859)

Can not build akari kernel module - "static declaration follows non static declaration" (2018-08-25 01:34 by intika #81763)

Hello,

First of all thank you for your amazing work ! i am a log time user of tomoyo and your lsm us just amazing so thank you a million for creating it :)

i am currently working on a firewall gui for linux that is using tomoyo/akari https://github.com/intika/ccs-queryd-gui... the project is very young but i am willing to make some advanced firewall application... for desktop usage

i am having some trouble to build akari the compiler give the error "static declaration follows non static declaration"
gcc version : 5.5
kernel version : 4.14.62

here is some infos about the bug
https://stackoverflow.com/questions/3148244/how-to-solve-static-declaration-follows-non-static-declaration-in-gcc-c-code

instead of editing the code i would first post something about it here first to let you know :)

Thanks a lot for your help !

Here is the make output :

[intika@localhost 4.14.62-intika-libre-minimal-tomoyo-ccs]$ make modules SUBDIRS=akari

WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.

make[1]: Warning: File 'tools/objtool/objtool' has modification time 656888 s in the future
CC [M] akari/test.o
CC [M] akari/probe.o
LD [M] akari/akari_test.o
CC [M] akari/permission.o
CC [M] akari/gc.o
CC [M] akari/memory.o
CC [M] akari/policy_io.o
CC [M] akari/realpath.o
CC [M] akari/load_policy.o
CC [M] akari/lsm.o
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:239:12: error: static declaration of ‘ccs_file_open’ follows non-static declaration
static int ccs_file_open(struct file *f, const struct cred *cred)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:30:5: note: previous declaration of ‘ccs_file_open’ was here
int ccs_file_open(struct file *file, const struct cred *cred);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:255:12: error: static declaration of ‘ccs_path_chown’ follows non-static declaration
static int ccs_path_chown(const struct path *path, kuid_t user, kgid_t group)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:40:5: note: previous declaration of ‘ccs_path_chown’ was here
int ccs_path_chown(const struct path *path, kuid_t uid, kgid_t gid);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:268:12: error: static declaration of ‘ccs_path_chmod’ follows non-static declaration
static int ccs_path_chmod(const struct path *path, umode_t mode)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:39:5: note: previous declaration of ‘ccs_path_chmod’ was here
int ccs_path_chmod(const struct path *path, umode_t mode);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:280:12: error: static declaration of ‘ccs_path_chroot’ follows non-static declaration
static int ccs_path_chroot(const struct path *path)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:41:5: note: previous declaration of ‘ccs_path_chroot’ was here
int ccs_path_chroot(const struct path *path);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:292:12: error: static declaration of ‘ccs_path_truncate’ follows non-static declaration
static int ccs_path_truncate(const struct path *path)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:53:5: note: previous declaration of ‘ccs_path_truncate’ was here
int ccs_path_truncate(const struct path *path);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:337:12: error: static declaration of ‘ccs_inode_getattr’ follows non-static declaration
static int ccs_inode_getattr(const struct path *path)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:26:5: note: previous declaration of ‘ccs_inode_getattr’ was here
int ccs_inode_getattr(const struct path *path);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:354:12: error: static declaration of ‘ccs_path_mknod’ follows non-static declaration
static int ccs_path_mknod(const struct path *dir, struct dentry *dentry,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:46:5: note: previous declaration of ‘ccs_path_mknod’ was here
int ccs_path_mknod(const struct path *dir, struct dentry *dentry, umode_t mode,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:369:12: error: static declaration of ‘ccs_path_mkdir’ follows non-static declaration
static int ccs_path_mkdir(const struct path *dir, struct dentry *dentry,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:44:5: note: previous declaration of ‘ccs_path_mkdir’ was here
int ccs_path_mkdir(const struct path *dir, struct dentry *dentry,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:383:12: error: static declaration of ‘ccs_path_rmdir’ follows non-static declaration
static int ccs_path_rmdir(const struct path *dir, struct dentry *dentry)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:50:5: note: previous declaration of ‘ccs_path_rmdir’ was here
int ccs_path_rmdir(const struct path *dir, struct dentry *dentry);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:396:12: error: static declaration of ‘ccs_path_unlink’ follows non-static declaration
static int ccs_path_unlink(const struct path *dir, struct dentry *dentry)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:54:5: note: previous declaration of ‘ccs_path_unlink’ was here
int ccs_path_unlink(const struct path *dir, struct dentry *dentry);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:410:12: error: static declaration of ‘ccs_path_symlink’ follows non-static declaration
static int ccs_path_symlink(const struct path *dir, struct dentry *dentry,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:51:5: note: previous declaration of ‘ccs_path_symlink’ was here
int ccs_path_symlink(const struct path *dir, struct dentry *dentry,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:426:12: error: static declaration of ‘ccs_path_rename’ follows non-static declaration
static int ccs_path_rename(const struct path *old_dir,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:48:5: note: previous declaration of ‘ccs_path_rename’ was here
int ccs_path_rename(const struct path *old_dir, struct dentry *old_dentry,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:443:12: error: static declaration of ‘ccs_path_link’ follows non-static declaration
static int ccs_path_link(struct dentry *old_dentry, const struct path *new_dir,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:42:5: note: previous declaration of ‘ccs_path_link’ was here
int ccs_path_link(struct dentry *old_dentry, const struct path *new_dir,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:724:12: error: static declaration of ‘ccs_socket_listen’ follows non-static declaration
static int ccs_socket_listen(struct socket *sock, int backlog)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:36:5: note: previous declaration of ‘ccs_socket_listen’ was here
int ccs_socket_listen(struct socket *sock, int backlog);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:741:12: error: static declaration of ‘ccs_socket_connect’ follows non-static declaration
static int ccs_socket_connect(struct socket *sock, struct sockaddr *addr,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:34:5: note: previous declaration of ‘ccs_socket_connect’ was here
int ccs_socket_connect(struct socket *sock, struct sockaddr *address,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:759:12: error: static declaration of ‘ccs_socket_bind’ follows non-static declaration
static int ccs_socket_bind(struct socket *sock, struct sockaddr *addr,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:32:5: note: previous declaration of ‘ccs_socket_bind’ was here
int ccs_socket_bind(struct socket *sock, struct sockaddr *address,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:777:12: error: static declaration of ‘ccs_socket_sendmsg’ follows non-static declaration
static int ccs_socket_sendmsg(struct socket *sock, struct msghdr *msg,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:37:5: note: previous declaration of ‘ccs_socket_sendmsg’ was here
int ccs_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:894:12: error: static declaration of ‘ccs_sb_pivotroot’ follows non-static declaration
static int ccs_sb_pivotroot(const struct path *old_path,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:57:5: note: previous declaration of ‘ccs_sb_pivotroot’ was here
int ccs_sb_pivotroot(const struct path *old_path, const struct path *new_path);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:911:12: error: static declaration of ‘ccs_sb_mount’ follows non-static declaration
static int ccs_sb_mount(const char *dev_name, const struct path *path,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:55:5: note: previous declaration of ‘ccs_sb_mount’ was here
int ccs_sb_mount(const char *dev_name, const struct path *path,
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:925:12: error: static declaration of ‘ccs_sb_umount’ follows non-static declaration
static int ccs_sb_umount(struct vfsmount *mnt, int flags)
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:22:5: note: previous declaration of ‘ccs_sb_umount’ was here
int ccs_sb_umount(struct vfsmount *mnt, int flags);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:939:12: error: static declaration of ‘ccs_file_fcntl’ follows non-static declaration
static int ccs_file_fcntl(struct file *file, unsigned int cmd,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:29:5: note: previous declaration of ‘ccs_file_fcntl’ was here
int ccs_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
^
In file included from akari/lsm.c:12:0:
akari/lsm-4.12.c:954:12: error: static declaration of ‘ccs_file_ioctl’ follows non-static declaration
static int ccs_file_ioctl(struct file *filp, unsigned int cmd,
^
In file included from ./include/linux/ccsecurity.h:39:0,
from ./include/linux/security.h:59,
from akari/lsm.c:10:
./include/linux/lsm2ccsecurity.h:28:5: note: previous declaration of ‘ccs_file_ioctl’ was here
int ccs_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
^
scripts/Makefile.build:328: recipe for target 'akari/lsm.o' failed
make[1]: *** [akari/lsm.o] Error 1
Makefile:1523: recipe for target '_module_akari' failed
make: *** [_module_akari] Error 2

Re: Can not build akari kernel module - "static declaration follows non static declaration" (2018-08-25 09:49 by kumaneko #81767)

Hello.

Thank you for using TOMOYO/AKARI.

> In file included from ./include/linux/ccsecurity.h:39:0,
> from ./include/linux/security.h:59,
> from akari/lsm.c:10:

This indicates that you are extracting akari-*.tar.gz into a kernel
source tree where ccs-patch-*.diff (from ccs-patch-1.8-*.tar.gz)
was already applied, for akari does not use include/linux/ccsecurity.h
file. Since AKARI is a subset of TOMOYO 1.8, you don't want to extract
akari-*.tar.gz into a kernel source tree where ccs-patch-1.8-*.tar.gz
was extracted and ccs-patch-*.diff was applied.

Please make sure that 4.14.62-intika-libre-minimal-tomoyo-ccs did not
have ccs-patch-1.8-*.tar.gz extracted if you want to use akari-*.tar.gz .

Regards.
Responder a #81763

Re: Can not build akari kernel module - "static declaration follows non static declaration" (2018-08-25 13:47 by intika #81768)

Thank you very much for your answer it was quick :)

Yeaaahhh it definitely make sens i did not think or debug enough :s

thanks again !

[Reply To Message #81767]
> Hello.
>
> Thank you for using TOMOYO/AKARI.
>
> > In file included from ./include/linux/ccsecurity.h:39:0,
> > from ./include/linux/security.h:59,
> > from akari/lsm.c:10:
>
> This indicates that you are extracting akari-*.tar.gz into a kernel
> source tree where ccs-patch-*.diff (from ccs-patch-1.8-*.tar.gz)
> was already applied, for akari does not use include/linux/ccsecurity.h
> file. Since AKARI is a subset of TOMOYO 1.8, you don't want to extract
> akari-*.tar.gz into a kernel source tree where ccs-patch-1.8-*.tar.gz
> was extracted and ccs-patch-*.diff was applied.
>
> Please make sure that 4.14.62-intika-libre-minimal-tomoyo-ccs did not
> have ccs-patch-1.8-*.tar.gz extracted if you want to use akari-*.tar.gz .
>
> Regards.

Responder a #81767