* [PATCHv8] boost: Add support for building boost-asio as a shared library
@ 2026-09-04 10:02 Gustav Lindberg
2026-09-04 12:53 ` [OE-core] " Alexander Kanavin
2026-09-05 7:35 ` Mathieu Dubois-Briand
0 siblings, 2 replies; 4+ messages in thread
From: Gustav Lindberg @ 2026-09-04 10:02 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.
This can be enabled by adding `PACKAGECONFIG:append = " asio-shared"` to
`boost_%.bbappend`.
Signed-off-by: Gustav Lindberg <gustali@axis.com>
---
meta/recipes-support/boost/boost.inc | 25 +++++++++++++++++++
.../boost/boost/boost_asio.cpp | 1 +
2 files changed, 26 insertions(+)
create mode 100644 meta/recipes-support/boost/boost/boost_asio.cpp
diff --git a/meta/recipes-support/boost/boost.inc b/meta/recipes-support/boost/boost.inc
index 64a57ddfb2..0267d8e819 100644
--- a/meta/recipes-support/boost/boost.inc
+++ b/meta/recipes-support/boost/boost.inc
@@ -16,6 +16,7 @@ do_configure[cleandirs] = "${B}"
BOOST_LIBS = "\
atomic \
+ asio \
charconv \
chrono \
container \
@@ -51,11 +52,14 @@ BOOST_LIBS = "\
# optional libraries
PACKAGECONFIG ??= "locale python"
+PACKAGECONFIG[asio-shared] = ",,"
PACKAGECONFIG[locale] = ",,icu"
PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
PACKAGECONFIG[mpi] = ",,mpich"
PACKAGECONFIG[python] = ",,python3"
+SRC_URI:append = " ${@bb.utils.contains('PACKAGECONFIG', 'asio-shared', 'file://boost_asio.cpp', '', d)}"
+
inherit python3-dir
PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
@@ -198,6 +202,20 @@ do_compile() {
--debug-configuration
}
+do_compile:append() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'asio-shared', 'true', 'false', d)}; then
+ ${CXX} ${CPPFLAGS} ${CXXFLAGS} \
+ -DBOOST_ASIO_DYN_LINK=1 \
+ -I${S} \
+ -fPIC \
+ -shared \
+ -Wl,-soname,libboost_asio.so.${PV} \
+ ${UNPACKDIR}/boost_asio.cpp \
+ ${LDFLAGS} \
+ -o ${B}/libboost_asio.so.${PV}
+ fi
+}
+
do_install() {
cd ${S}
b2 ${BJAM_OPTS} \
@@ -220,4 +238,11 @@ do_install() {
}
+do_install:append() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'asio-shared', 'true', 'false', d)}; then
+ install -Dm 0755 ${B}/libboost_asio.so.${PV} ${D}${libdir}/libboost_asio.so.${PV}
+ ln -sf libboost_asio.so.${PV} ${D}${libdir}/libboost_asio.so
+ fi
+}
+
BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-support/boost/boost/boost_asio.cpp b/meta/recipes-support/boost/boost/boost_asio.cpp
new file mode 100644
index 0000000000..eb3b7262c3
--- /dev/null
+++ b/meta/recipes-support/boost/boost/boost_asio.cpp
@@ -0,0 +1 @@
+#include <boost/asio/impl/src.hpp>
\ No newline at end of file
--
2.43.0
Rename `asio` packageconfig flag to `asio-shared` and include asio in BOOST_LIBS unconditionally.
> No custom compiler executions please. Building a shared library should
> be done by the boost build system itself, and enabled via a flag to it
> during do_configure (e.g. via PACKAGECONFIG_CONFARGS or BJAM_EXTRA).
> You probably need to patch boost to do this, and send the needed patch
> upstream.
I spent a day trying to get that to work, but it doesn't seem to be possible. Everything I tried either breaks
the header-only version or doesn't build the shared library.
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [OE-core] [PATCHv8] boost: Add support for building boost-asio as a shared library
2026-09-04 10:02 [PATCHv8] boost: Add support for building boost-asio as a shared library Gustav Lindberg
@ 2026-09-04 12:53 ` Alexander Kanavin
2026-09-08 15:10 ` Gustav Lindberg
2026-09-05 7:35 ` Mathieu Dubois-Briand
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2026-09-04 12:53 UTC (permalink / raw)
To: gustali; +Cc: openembedded-core
On Fri, 4 Sept 2026 at 12:02, Gustav Lindberg via
lists.openembedded.org <gustali=axis.com@lists.openembedded.org>
wrote:
> > No custom compiler executions please. Building a shared library should
> > be done by the boost build system itself, and enabled via a flag to it
> > during do_configure (e.g. via PACKAGECONFIG_CONFARGS or BJAM_EXTRA).
> > You probably need to patch boost to do this, and send the needed patch
> > upstream.
>
> I spent a day trying to get that to work, but it doesn't seem to be possible. Everything I tried either breaks
> the header-only version or doesn't build the shared library.
The next step is to ask boost upstream to help, maybe by filing a
ticket, and/or continue maintaining a .bbappend with these changes.
I know boost is horrible, and has a convoluted non-standard
boost-specific build system, but we should not be bypassing that
entirely, especially when no one else is asking for asio-shared for
now.
Adding asio to BOOST_LIBS is fine, and can go in as a separate patch.
Can you send that please?
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCHv8] boost: Add support for building boost-asio as a shared library
2026-09-04 12:53 ` [OE-core] " Alexander Kanavin
@ 2026-09-08 15:10 ` Gustav Lindberg
0 siblings, 0 replies; 4+ messages in thread
From: Gustav Lindberg @ 2026-09-08 15:10 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]
Hi,
I discussed this with my team and we don't think it's worth spending any more time on trying to patch boost. So we will create a recipe in our own code for building the shared library instead of publishing it here.
Best regards,
Gustav Lindberg
________________________________
Från: Alexander Kanavin <alex.kanavin@gmail.com>
Skickat: den 4 september 2026 14:53
Till: Gustav Lindberg <Gustav.Lindberg@axis.com>
Kopia: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Ämne: Re: [OE-core] [PATCHv8] boost: Add support for building boost-asio as a shared library
[You don't often get email from alex.kanavin@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
On Fri, 4 Sept 2026 at 12:02, Gustav Lindberg via
lists.openembedded.org <gustali=axis.com@lists.openembedded.org>
wrote:
> > No custom compiler executions please. Building a shared library should
> > be done by the boost build system itself, and enabled via a flag to it
> > during do_configure (e.g. via PACKAGECONFIG_CONFARGS or BJAM_EXTRA).
> > You probably need to patch boost to do this, and send the needed patch
> > upstream.
>
> I spent a day trying to get that to work, but it doesn't seem to be possible. Everything I tried either breaks
> the header-only version or doesn't build the shared library.
The next step is to ask boost upstream to help, maybe by filing a
ticket, and/or continue maintaining a .bbappend with these changes.
I know boost is horrible, and has a convoluted non-standard
boost-specific build system, but we should not be bypassing that
entirely, especially when no one else is asking for asio-shared for
now.
Adding asio to BOOST_LIBS is fine, and can go in as a separate patch.
Can you send that please?
Alex
[-- Attachment #2: Type: text/html, Size: 3772 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCHv8] boost: Add support for building boost-asio as a shared library
2026-09-04 10:02 [PATCHv8] boost: Add support for building boost-asio as a shared library Gustav Lindberg
2026-09-04 12:53 ` [OE-core] " Alexander Kanavin
@ 2026-09-05 7:35 ` Mathieu Dubois-Briand
1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Dubois-Briand @ 2026-09-05 7:35 UTC (permalink / raw)
To: gustali, openembedded-core
On Fri Sep 4, 2026 at 12:02 PM CEST, Gustav Lindberg via 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.
>
> This can be enabled by adding `PACKAGECONFIG:append = " asio-shared"` to
> `boost_%.bbappend`.
>
> Signed-off-by: Gustav Lindberg <gustali@axis.com>
> ---
Hi Gustav,
It looks like this is not working as expected:
ERROR: boost-1.92.0-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/core2-64-poky-linux/boost/1.92.0/temp/run.do_compile.1669567' failed with exit code 1
...
| notice: Searching '.' for project-config configuration file 'project-config.jam'.
| notice: Loading project-config configuration file 'project-config.jam' from '.'.
| error: wrong library name 'asio' in the --with-<library> option.
| WARNING: exit code 1 from a shell command.
https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/4599
Can you have a look at the issue?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-09 4:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 10:02 [PATCHv8] boost: Add support for building boost-asio as a shared library Gustav Lindberg
2026-09-04 12:53 ` [OE-core] " Alexander Kanavin
2026-09-08 15:10 ` Gustav Lindberg
2026-09-05 7:35 ` Mathieu Dubois-Briand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox