Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixes to make compilation work #66

Open
zwindler opened this issue Feb 19, 2024 · 0 comments
Open

Fixes to make compilation work #66

zwindler opened this issue Feb 19, 2024 · 0 comments

Comments

@zwindler
Copy link

I've had trouble building lxcri from sources (since there are no package release yet)

In github.com/lxc/lxcri:main, when trying to compile libtool I get the error

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../src -fPIC -DPIC -Wvla -std=gnu11 -fms-extensions -fdiagnostics-color -Wimplicit-fallthrough=5 -Wcast-align -Wstrict-prototypes -fno-strict-aliasing -fstack-clash-protection -fstack-protector-strong --param=ssp-buffer-size=4 -g -fcf-protection -Werror=implicit-function-declaration -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Winit-self -Wunused-but-set-variable -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=return-type -Werror=incompatible-pointer-types -Wformat=2 -Wshadow -Wendif-labels -Werror=overflow -fdiagnostics-show-option -Werror=shift-count-overflow -Werror=shift-overflow=2 -Wdate-time -Wnested-externs -fasynchronous-unwind-tables -pipe -fexceptions -Warray-bounds -Wrestrict -Wreturn-local-addr -Wstringop-overflow -DLXCROOTFSMOUNT=\"/usr/local/lib/lxc/rootfs\" -DLXCPATH=\"/usr/local/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/usr/local/etc/lxc/lxc.conf\" -DLXCINITDIR=\"/usr/local/libexec\" -DLIBEXECDIR=\"/usr/local/libexec\" -DLXCTEMPLATEDIR=\"/usr/local/share/lxc/templates\" -DLXCTEMPLATECONFIG=\"/usr/local/share/lxc/config\" -DLOGPATH=\"/usr/local/var/log/lxc\" -DLXC_DEFAULT_CONFIG=\"/usr/local/etc/lxc/default.conf\" -DLXC_USERNIC_DB=\"/run/lxc/nics\" -DLXC_USERNIC_CONF=\"/usr/local/etc/lxc/lxc-usernet\" -DDEFAULT_CGROUP_PATTERN=\"\" -DRUNTIME_PATH=\"/run\" -DSBINDIR=\"/usr/local/sbin\" -DAPPARMOR_CACHE_DIR=\"/usr/local/var/cache/lxc/apparmor\" -I ../../src -I ../../src/lxc -I ../../src/lxc/storage -I ../../src/lxc/cgroups -DHAVE_APPARMOR -DHAVE_SECCOMP -DHAVE_SELINUX -pthread -g -O2 -Wvla -std=gnu11 -fms-extensions -Werror -MT liblxc_la-conf.lo -MD -MP -MF .deps/liblxc_la-conf.Tpo -c conf.c  -fPIC -DPIC -o .libs/liblxc_la-conf.o
conf.c: In function 'execveat_supported':
conf.c:3470:9: error: argument 3 null where non-null expected [-Werror=nonnull]
 3470 |         execveat(-1, "", NULL, NULL, AT_EMPTY_PATH);
      |         ^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:28,
                 from conf.c:23:
/usr/include/unistd.h:300:12: note: in a call to function 'execveat' declared 'nonnull'
  300 | extern int execveat (int __fd, const char *__path, char *const __argv[],
      |            ^~~~~~~~
cc1: all warnings being treated as errors

This can be fixed but bumping lxc to latest 4.0.x, which is lxc 4.0.12 in build.sh

The second error I get is from lxc-go go bindings

# [gopkg.in/lxc/go-lxc.v2](http://gopkg.in/lxc/go-lxc.v2)
In file included from /root/go/pkg/mod/gopkg.in/lxc/go-lxc.v2@v2.0.0-20210205143421-c4b883be4881/container.go:11:
./lxc-binding.h:50:16: error: redefinition of 'struct lxc_groups_t'
   50 | typedef struct lxc_groups_t {
      |                ^~~~~~~~~~~~
In file included from /usr/local/include/lxc/lxccontainer.h:12,
                 from /root/go/pkg/mod/gopkg.in/lxc/go-lxc.v2@v2.0.0-20210205143421-c4b883be4881/container.go:9:
/usr/local/include/lxc/attach_options.h:80:16: note: originally defined here
   80 | typedef struct lxc_groups_t {
      |                ^~~~~~~~~~~~
In file included from /root/go/pkg/mod/gopkg.in/lxc/go-lxc.v2@v2.0.0-20210205143421-c4b883be4881/container.go:11:
./lxc-binding.h:53:3: error: conflicting types for 'lxc_groups_t'; have 'struct lxc_groups_t'
   53 | } lxc_groups_t;
      |   ^~~~~~~~~~~~
In file included from /usr/local/include/lxc/lxccontainer.h:12,
                 from /root/go/pkg/mod/gopkg.in/lxc/go-lxc.v2@v2.0.0-20210205143421-c4b883be4881/container.go:9:
/usr/local/include/lxc/attach_options.h:83:3: note: previous declaration of 'lxc_groups_t' with type 'lxc_groups_t'
   83 | } lxc_groups_t;
      |   ^~~~~~~~~~~~
make: *** [Makefile:42: lxcri] Error 2
error building at STEP "RUN make install": error while running runtime: exit status 2
ERRO[0136] exit status 2

They have to be upgraded to either latest https://pkg.go.dev/gopkg.in/lxc/go-lxc.v2@v2.0.0-20210307013912-d9b9f727ce0f or even better, update go.mod to use

[github.com/lxc/go-lxc](http://github.com/lxc/go-lxc) v0.0.0-20230926171149-ccae595aa49e
[golang.org/x/sys](http://golang.org/x/sys) v0.12.0

This is what I did when working with https://github.com/drachenfels-de/lxcri:fixes which is ahead of this repository, but x/sys v0.12.0 also needs you to bump go version to 1.17

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant