All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: "Christian Göttsche" <cgzones@googlemail.com>, selinux@vger.kernel.org
Subject: Re: [PATCH] libselinux: set CFLAGS for pip installation
Date: Wed, 26 Apr 2023 17:53:58 +0200	[thread overview]
Message-ID: <87edo6myg9.fsf@redhat.com> (raw)
In-Reply-To: <87h6t2n0wb.fsf@redhat.com>

Petr Lautrbach <plautrba@redhat.com> writes:

> Christian Göttsche <cgzones@googlemail.com> 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@googlemail.com>
>
>
> 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@redhat.com>




>
>
>> ---
>> 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


  reply	other threads:[~2023-04-26 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 16:27 [PATCH] libselinux: set CFLAGS for pip installation Christian Göttsche
2023-04-26 15:01 ` Petr Lautrbach
2023-04-26 15:53   ` Petr Lautrbach [this message]
2023-05-03 16:24     ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edo6myg9.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.