All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Burgener <dburgener@linux.microsoft.com>
To: Alyssa Ross <hi@alyssa.is>
Cc: Nicolas Iooss <nicolas.iooss@m4x.org>, selinux@vger.kernel.org
Subject: Re: [PATCH v3] Support static-only builds
Date: Wed, 12 Feb 2025 10:11:12 -0500	[thread overview]
Message-ID: <d36501b0-e546-4de6-aa73-85613b276366@linux.microsoft.com> (raw)
In-Reply-To: <87a5aro74k.fsf@alyssa.is>

On 2/12/2025 4:16 AM, Alyssa Ross wrote:
> Daniel Burgener <dburgener@linux.microsoft.com> writes:
> 
>> On 2/11/2025 4:16 PM, Alyssa Ross wrote:
>>> diff --git a/policycoreutils/Makefile b/policycoreutils/Makefile
>>> index 32ad0201..7acd51dd 100644
>>> --- a/policycoreutils/Makefile
>>> +++ b/policycoreutils/Makefile
>>> @@ -1,5 +1,10 @@
>>>    SUBDIRS = setfiles load_policy newrole run_init secon sestatus semodule setsebool scripts po man hll unsetfiles
>>>    
>>> +PKG_CONFIG ?= pkg-config
>>> +
>>> +LIBSELINUX_LDLIBS := $(shell $(PKG_CONFIG) --libs libselinux)
>>> +export LIBSELINUX_LDLIBS
>>> +
>>
>> I think that in the DISABLE_SHARED case, the pkg-config command needs
>> --static as well.  I tried your patch, and I get errors that the
>> downstream users of libselinux have undefined references to libpcre2,
>> and they are being build without -lpcre2-8.  Based on the pkg-config man
>> page, it looks like Requires.private libraries are only included if the
>> --static flag is passed.
> 
> I think it's generally expected that the user set
> PKG_CONFIG="pkg-config --static" when they want static linking.  See
> e.g. <https://bugs.freedesktop.org/show_bug.cgi?id=19541#c3>.

Thanks for clarifying.  Yes, this command builds everything for me:

make DESTDIR=~/obj PKG_CONFIG="pkg-config --static" DISABLE_SHARED=y install

However, the binaries still appear dynamically linked when I investigate 
them with the "file" command.  Am I missing some other step?

> 
>> I also see that restorecond is not including -lpcre2-8.  It probably
>> needs the same treatment as policycoreutils/*.
> 
> Does it fail to build for you?  It builds DISABLE_SHARED=y for me

Now that I added PKG_CONFIG="pkg-config --static", restorecond is 
building.  However, as above, it appears dynamically linked.

> 
>> Finally, I was unable to get the install-rubywrap and install-pywrap
>> targets to build with DISABLE_SHARED=y.  I wasn't able to figure out the
>> ultimate issue there.
> 
> I think Ruby and Python bindings need to be shared libraries, so it
> doesn't make sense to build them with DISABLE_SHARED=y.

Fair enough. I think it would be helpful if these caveats could all get 
documented.  I just tried following the README.md instructions and 
adding "DISABLE_SHARED=y", which as mentioned, didn't work.  If 
"DISABLE_SHARED" requires other options to work, it seems like that 
should at a minimum be documented.

-Daniel


  reply	other threads:[~2025-02-12 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 21:16 [PATCH v3] Support static-only builds Alyssa Ross
2025-02-11 22:11 ` Daniel Burgener
2025-02-12  9:16   ` Alyssa Ross
2025-02-12 15:11     ` Daniel Burgener [this message]
2025-02-12 16:11       ` Daniel Burgener
2025-02-13 11:48         ` Alyssa Ross
2025-03-31 15:38 ` James Carter
2025-04-07 18:04   ` James Carter
2025-06-23 12:34 ` [PATCH v3] Support static-only builds - unconditional `-laudit -lbz2` in non-static policycoreutils build Petr Lautrbach
2025-06-25 10:41   ` [PATCH 1/2] libsemanage: add missing libaudit private library Alyssa Ross
2025-06-25 10:41     ` [PATCH 2/2] policycoreutils: use pkg-config for libsemanage Alyssa Ross
2025-06-26 16:54       ` James Carter
2025-06-27 15:04         ` Alyssa Ross
2025-06-27 18:07           ` James Carter
2025-06-28  8:37             ` Alyssa Ross
2025-07-01 15:12       ` James Carter
2025-07-01 15:12     ` [PATCH 1/2] libsemanage: add missing libaudit private library James Carter
2025-07-02 17:34       ` 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=d36501b0-e546-4de6-aa73-85613b276366@linux.microsoft.com \
    --to=dburgener@linux.microsoft.com \
    --cc=hi@alyssa.is \
    --cc=nicolas.iooss@m4x.org \
    --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.