All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Daniel Burgener <dburgener@linux.microsoft.com>
Cc: Nicolas Iooss <nicolas.iooss@m4x.org>, selinux@vger.kernel.org
Subject: Re: [PATCH v3] Support static-only builds
Date: Thu, 13 Feb 2025 12:48:55 +0100	[thread overview]
Message-ID: <871pw26p5k.fsf@alyssa.is> (raw)
In-Reply-To: <06fd3492-f8b4-4b68-aeef-fd38f6f3587c@linux.microsoft.com>

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

Daniel Burgener <dburgener@linux.microsoft.com> writes:

> On 2/12/2025 10:11 AM, Daniel Burgener wrote:
>> 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?
>
> It occurs to me that I've possibly misunderstood the point of your 
> patch.  This is just about not building the shared libraries, 
> independent of whether the binaries are statically linked?

Yes.  The purpose of this is to make it possible to build using a
compiler that only supports static linking.  In Nixpkgs, we have a
special mode where a package and all its dependencies can be built
statically, and my intention here is to be able to build packages that
depend on libselinux in that mode.

Would it maybe make more sense if I split this patch up, so one patch
just makes it possible to disable building shared libraries, and another
fixes building using only static libraries?  Originally this patch was
only the former, but then it grew…

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2025-02-13 11:49 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
2025-02-12 16:11       ` Daniel Burgener
2025-02-13 11:48         ` Alyssa Ross [this message]
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=871pw26p5k.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=dburgener@linux.microsoft.com \
    --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.