Overview

Request 1006602 revoked

fix build by disabling gcc error options -Werror=implicit-function-declaration and -Werror=incompatible-pointer-types; re-enable FORTIFY_SOURCE=3

Loading...

Dirk Mueller's avatar

This is problematic as fortify relies on not having implicit function declarations. isn't there a better way to fix this by e.g. working on the implicit function declarations being fixed by adding the right includes?


Aaron Puchert's avatar

I think you need the changes from https://github.com/lxc/lxc/pull/4179, e.g. the first change "build: detect where struct mount_attr is declared" should fix the incompatible pointers. Some of the subsequent changes look like they are adding includes to get explicit function declarations.

In any event, be careful with disabling these warnings, they are just warnings because traditionally C is very permissive (they are hard errors in C++) and detect type mismatches that can result in all kinds of undefined behavior.


Aaron Puchert's avatar

Though updating to version 5 should also fix the errors, it seems that contains these changes already.


Aaron Puchert's avatar

Or maybe not, given that you're seeing the errors in your branch on version 5. But e.g. this change

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index ffbe74c2f6..4193cd07f5 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2885,7 +2885,7 @@ static int __lxc_idmapped_mounts_child(struct lxc_handler *handler, FILE *f)
        struct lxc_mount_options opts = {};
        int dfd_from;
        const char *source_relative, *target_relative;
-       struct lxc_mount_attr attr = {};
+       struct mount_attr attr = {};

        ret = parse_lxc_mount_attrs(&opts, mntent.mnt_opts);
        if (ret < 0)

should most definitely fix

../src/lxc/conf.c:2993:37: error: passing argument 4 of ‘mount_setattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 2993 |                                     &attr,
      |                                     ^~~~~
      |                                     |
      |                                     struct lxc_mount_attr *

by changing the type of attr.


Aleksa Sarai's avatar

LXC 5.0 switched to meson for builds so we need to switch to that as well...


Johannes Kastl's avatar

Yes, that is the reason why fixing the build was not that easy.

I have too little experience with meson and could not get it building in the little time I had to spend on this.

See https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_Virtualization_containers/lxc where I started converting the package to meson...


Aleksa Sarai's avatar

I've already got something that's mostly working, the main issue is the custom template files we have. We can drop missing_setuid.txt.in since Leap 15.1 has long since stopped being supported, and I suspect we can just sed the one variable being used by lxc-createconfig.in.



Johannes Kastl's avatar

Please see the new SR#1029999

I backported the fix that Aaron mentioned.

Request History
Johannes Kastl's avatar

ojkastl_buildservice created request

fix build by disabling gcc error options -Werror=implicit-function-declaration and -Werror=incompatible-pointer-types; re-enable FORTIFY_SOURCE=3


Johannes Kastl's avatar

ojkastl_buildservice revoked request

openSUSE Build Service is sponsored by