All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv6] boost-asio: Add recipe
@ 2026-09-02  8:38 Gustav Lindberg
  2026-09-02 11:59 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Gustav Lindberg @ 2026-09-02  8:38 UTC (permalink / raw)
  To: openembedded-core; +Cc: Gustav Lindberg

This is needed to build boost asio as a shared library rather than a
header-only library, which is needed to save memory.

Signed-off-by: Gustav Lindberg <gustali@axis.com>
---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../boost/boost-asio/boost_asio.cpp           |  1 +
 .../boost/boost-asio_1.92.0.bb                | 33 +++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-support/boost/boost-asio/boost_asio.cpp
 create mode 100644 meta/recipes-support/boost/boost-asio_1.92.0.bb

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 99242af484..0df2a731a4 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -76,6 +76,7 @@ RECIPE_MAINTAINER:pn-blueprint-compiler = "Liu Yiding <liuyd.fnst@fujitsu.com>"
 RECIPE_MAINTAINER:pn-bluez5 = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-bmaptool = "Trevor Woerner <twoerner@gmail.com>"
 RECIPE_MAINTAINER:pn-boost = "Unassigned <unassigned@yoctoproject.org>"
+RECIPE_MAINTAINER:pn-boost-asio = "Gustav Lindberg <gustali@axis.com>"
 RECIPE_MAINTAINER:pn-boost-build-native = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-bootchart2 = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-bsd-headers = "Khem Raj <raj.khem@gmail.com>"
diff --git a/meta/recipes-support/boost/boost-asio/boost_asio.cpp b/meta/recipes-support/boost/boost-asio/boost_asio.cpp
new file mode 100644
index 0000000000..bf00c8ff26
--- /dev/null
+++ b/meta/recipes-support/boost/boost-asio/boost_asio.cpp
@@ -0,0 +1 @@
+#include <boost/asio/impl/src.hpp>
diff --git a/meta/recipes-support/boost/boost-asio_1.92.0.bb b/meta/recipes-support/boost/boost-asio_1.92.0.bb
new file mode 100644
index 0000000000..e275a3b61b
--- /dev/null
+++ b/meta/recipes-support/boost/boost-asio_1.92.0.bb
@@ -0,0 +1,33 @@
+SUMMARY = "Boost.Asio shared library shim"
+DESCRIPTION = "Builds libboost_asio as a shared library from boost/asio/impl/src.hpp"
+HOMEPAGE = "https://www.boost.org/doc/libs/1_90_0/doc/html/boost_asio.html"
+
+DEPENDS = "boost"
+
+# Reuse Boost source and licensing metadata.
+require recipes-support/boost/boost-${PV}.inc
+
+SRC_URI += " file://boost_asio.cpp;subdir=${BOOST_P}"
+
+MAJOR_VER = "${@oe.utils.trim_version("${PV}", 1)}"
+
+do_compile() {
+	${CXX} ${CPPFLAGS} ${CXXFLAGS} \
+		-std=c++23 \
+		-DBOOST_ASIO_DYN_LINK=1 \
+		-fPIC \
+		-shared \
+		-Wl,-soname,libboost_asio.so.${MAJOR_VER} \
+		${S}/boost_asio.cpp \
+		${LDFLAGS} \
+		-o ${B}/libboost_asio.so.${PV}
+}
+
+do_install() {
+	install -d ${D}${libdir}
+	install -m 0755 ${B}/libboost_asio.so.${PV} ${D}${libdir}/
+	ln -sf libboost_asio.so.${PV} ${D}${libdir}/libboost_asio.so.${MAJOR_VER}
+	ln -sf libboost_asio.so.${MAJOR_VER} ${D}${libdir}/libboost_asio.so
+}
+
+BBCLASSEXTEND = "native"
-- 
2.43.0

Add myself as maintainer


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCHv6] boost-asio: Add recipe
  2026-09-02  8:38 [PATCHv6] boost-asio: Add recipe Gustav Lindberg
@ 2026-09-02 11:59 ` Alexander Kanavin
  2026-09-02 15:11   ` Gustav Lindberg
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2026-09-02 11:59 UTC (permalink / raw)
  To: gustali; +Cc: openembedded-core

On Wed, 2 Sept 2026 at 10:38, Gustav Lindberg via
lists.openembedded.org <gustali=axis.com@lists.openembedded.org>
wrote:
>
> This is needed to build boost asio as a shared library rather than a
> header-only library, which is needed to save memory.

Why specifically asio and nothing else? If we want to build bits of
boost as shared libraries where upstream only supports them as
header-only libs, then there should be a general solution, and ideally
one that is accepted upstream.

I think you need to discuss with boost upstream first before proposing
something custom for core.

Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCHv6] boost-asio: Add recipe
  2026-09-02 11:59 ` [OE-core] " Alexander Kanavin
@ 2026-09-02 15:11   ` Gustav Lindberg
  2026-09-02 15:48     ` Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Gustav Lindberg @ 2026-09-02 15:11 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core@lists.openembedded.org

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

> Why specifically asio and nothing else?

Because it's the only one we need that's set up this way. Not all boost libraries are set up this way, for example boost-json already has a pre-built shared library (and no header-only option). I don't know if there are any other libraries that are set up this way, but if there are, then people who need them can add them.

> If we want to build bits of boost as shared libraries where upstream only supports them as header-only libs, then there should be a general solution, and ideally one that is accepted upstream.

This is the solution that's accepted upstream. Boost-asio is header-only by default for people who don't need a shared library. But it officially supports the BOOST_ASIO_DYN_LINK flag for dynamically linking to a shared library that we have to build ourselves, and they intentionally don't build that shared library since it's not needed by default.

Making these changes upstream would require everyone who uses boost to build the boost-asio shared library whether they need it or not, which would be wasteful. Note that my change doesn't require all openembedded users to build the shared library, it's still possible to use the boost recipe without the boost-asio recipe and get the header-only version of boost-asio without the shared library. The point in making these changes here is that users can decide whether they want to use the header-only version or the shared library by using the correct recipe.


________________________________
Från: Alexander Kanavin <alex.kanavin@gmail.com>
Skickat: Onsdag, 02 september 2026 13:59
Till: Gustav Lindberg <Gustav.Lindberg@axis.com>
Kopia: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Ämne: Re: [OE-core] [PATCHv6] boost-asio: Add recipe

[You don't often get email from alex.kanavin@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

On Wed, 2 Sept 2026 at 10:38, Gustav Lindberg via
lists.openembedded.org <gustali=axis.com@lists.openembedded.org>
wrote:
>
> This is needed to build boost asio as a shared library rather than a
> header-only library, which is needed to save memory.

Why specifically asio and nothing else? If we want to build bits of
boost as shared libraries where upstream only supports them as
header-only libs, then there should be a general solution, and ideally
one that is accepted upstream.

I think you need to discuss with boost upstream first before proposing
something custom for core.

Alex

[-- Attachment #2: Type: text/html, Size: 5161 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [PATCHv6] boost-asio: Add recipe
  2026-09-02 15:11   ` Gustav Lindberg
@ 2026-09-02 15:48     ` Alexander Kanavin
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Kanavin @ 2026-09-02 15:48 UTC (permalink / raw)
  To: Gustav Lindberg; +Cc: openembedded-core@lists.openembedded.org

On Wed, 2 Sept 2026 at 17:11, Gustav Lindberg <Gustav.Lindberg@axis.com> wrote:
> Making these changes upstream would require everyone who uses boost to build the boost-asio shared library whether they need it or not, which would be wasteful. Note that my change doesn't require all openembedded users to build the shared library, it's still possible to use the boost recipe without the boost-asio recipe and get the header-only version of boost-asio without the shared library. The point in making these changes here is that users can decide whether they want to use the header-only version or the shared library by using the correct recipe.

That's not the preferred way. The better way is to keep everything in
a single recipe, and enabled the shared library (or not) with a
PACKAGECONFIG option, ideally one that passes down a command line
option to the boost build system.

Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-03  5:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02  8:38 [PATCHv6] boost-asio: Add recipe Gustav Lindberg
2026-09-02 11:59 ` [OE-core] " Alexander Kanavin
2026-09-02 15:11   ` Gustav Lindberg
2026-09-02 15:48     ` Alexander Kanavin

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.