Re: [PATCH] libselinux: set CFLAGS for pip installation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 26, 2023 at 12:06 PM Petr Lautrbach <plautrba@xxxxxxxxxx> wrote:
>
> Petr Lautrbach <plautrba@xxxxxxxxxx> writes:
>
> > Christian Göttsche <cgzones@xxxxxxxxxxxxxx> writes:
> >
> >> Explicitly set CFLAGS for the pip install command, similar to calling
> >> setup.py, to ignore known compiler warnings treated as errors, e.g.:
> >>
> >>     selinuxswig_python_wrap.c:3593:19: error: 'sidget' is deprecated [-Werror,-Wdeprecated-declarations]
> >>                 result = (int)sidget(arg1);
> >>                               ^
> >>     selinuxswig_python_wrap.c:15024:1: error: no previous prototype for function 'PyInit__selinux' [-Werror,-Wmissing-prototypes]
> >>             SWIG_init(void) {
> >>             ^
> >>
> >> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> >
> >
> > It looks like a problem in build system - selinuxswig_python_wrap.o is
> > built twice, first time by
> >
> > pywrap: all selinuxswig_python_exception.i
> >       CFLAGS="$(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) setup.py build_ext
> >
> >
> > clang -fdeclspec -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -Werror -Wall -Wextra -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnull-dereference -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -fno-common -I/tmp/destdir/usr/include -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -Wno-error -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-shadow -Wno-uninitialized -Wno-missing-prototypes -Wno-missing-declarations -Wno-deprecated-declarations -fPIC -I../include -I/opt/hostedtoolcache/Python/3.9.16/x64/include/python3.9 -c selinuxswig_python_wrap.c -o build/temp.linux-x86_64-3.9/selinuxswig_python_wrap.o
> >
> >
> > and second time by
> >
> > install-pywrap: pywrap
> >       $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
> >
> > clang -fdeclspec -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -Werror -Wall -Wextra -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnull-dereference -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -fno-common -I/tmp/destdir/usr/include -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -fPIC -I../include -I/opt/hostedtoolcache/Python/3.9.16/x64/include/python3.9 -c selinuxswig_python_wrap.c -o build/temp.linux-x86_64-cpython-39/selinuxswig_python_wrap.o
> >
> >
> > I'd expect that it's built only in pywrap target and install-pywrap
> > would just install it.
>
> So according to the internet, pip install does all setup.py operations
> [build_ext, build, install, ...] on it's own and therefore pywrap target
> with `setup.py build` seems to be useless.
>
> But your change is necessary.
>
> Acked-by: Petr Lautrbach <lautrbach@xxxxxxxxxx>
>

Merged.
Thanks,
Jim

>
>
>
> >
> >
> >> ---
> >> fixes GitHub CI, see https://github.com/SELinuxProject/selinux/pull/388
> >> ---
> >>  libselinux/src/Makefile | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> >> index 36d57122..f9a1e5f5 100644
> >> --- a/libselinux/src/Makefile
> >> +++ b/libselinux/src/Makefile
> >> @@ -187,7 +187,7 @@ install: all
> >>      ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
> >>
> >>  install-pywrap: pywrap
> >> -    $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
> >> +    CFLAGS="$(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
> >>      install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
> >>      ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
> >>
> >> --
> >> 2.40.0
>




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux