Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/erlang: fix link failure on odbcserver
@ 2026-08-23 21:49 Alexis Lothoré via buildroot
  2026-08-29 21:09 ` Thomas Petazzoni via buildroot
  2026-09-04 12:18 ` Thomas Perale via buildroot
  0 siblings, 2 replies; 4+ messages in thread
From: Alexis Lothoré via buildroot @ 2026-08-23 21:49 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Will Newton, Alexis Lothoré

host-erlang build can fail with the following error:

  make[5]: Nothing to be done for 'opt'.
   MAKE	opt
   CC	../priv/bin/x86_64-pc-linux-gnu/odbcserver
  /usr/bin/ld: ../priv/obj/x86_64-pc-linux-gnu/odbcserver.o: in function `encode_column_dyn':
  odbcserver.c:(.text+0x6b4): undefined reference to `ei_x_encode_tuple_header'
  /usr/bin/ld: odbcserver.c:(.text+0x6c2): undefined reference to `ei_x_encode_tuple_header'
  /usr/bin/ld: odbcserver.c:(.text+0x6d4): undefined reference to `ei_x_encode_ulong'
  /usr/bin/ld: odbcserver.c:(.text+0x6e7): undefined reference to `ei_x_encode_ulong'
  /usr/bin/ld: odbcserver.c:(.text+0x6fa): undefined reference to `ei_x_encode_ulong'
  /usr/bin/ld: odbcserver.c:(.text+0x708): undefined reference to `ei_x_encode_tuple_header'
  /usr/bin/ld: odbcserver.c:(.text+0x71b): undefined reference to `ei_x_encode_ulong'
  /usr/bin/ld: odbcserver.c:(.text+0x72e): undefined reference to `ei_x_encode_ulong'
  [...]

This can be reproduced with the following minimal defconfig (and
libei.so present on host, see details below):

  BR2_x86_64=y
  BR2_TOOLCHAIN_EXTERNAL=y
  BR2_PACKAGE_ERLANG=y

Those missing symbols are part of the erl_interface, exposed by libei.a.
host-erlang builds correctly libei.a _before_ odbcserver.c (it can be
found in lib/erl_interface/obj/x86_64-pc-linux-gnu/libei.a), but the
failure is actually due to the build command generated and used for
odbcserver.c, especially the link arguments:

  /usr/bin/gcc \
  [...]
  -o ../priv/bin/x86_64-pc-linux-gnu/odbcserver \
  ../priv/obj/x86_64-pc-linux-gnu/odbcserver.o \
  -L/usr/lib64 \
  -lodbc \
  -L/home/alexis/src/buildroot/erlang-master/build/host-erlang-custom/lib/erl_interface/obj/x86_64-pc-linux-gnu \
  -lpthread -lei

/usr/lib64 is searched before the path where libei.a has been built, so
if whether a valid libei.a or libei.so is found there, it shadows the
expected libei.a. In the build from which the logs above come, the
notable point is that the host system indeed have a valid libei.so, but
is completely unrelated to erl_interface; it rather exposes the Emulated
Input protocol aimed at Wayland stack; and so it obviously contains none
of the expected ei_* symbols.

Upstream has already identified and fixed the issue, the fix is already
released in versions >= 27.x.y. Erlang 26 (the version currently
packaged in buildroot), isn't supported anymore (only the three latest
releases are supported, see
https://github.com/erlang/otp/blob/master/SECURITY.md), so there won't
be any new minor update that will release this fix.

Pick and backport the fixing patch so that the current version packaged
in buildroot can still build.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
The issue affects 2025.02.x, 2026.05.x and master.

I've also taken a look at updating the erlang package, but:
- I hope the fix to be applied on current LTS, so a package upgrade
  updating to a new major version seems out of scope
- On master branch, while I managed to build host-erlang 29 when
  updating the .mk, I quickly encountered some failures on some erlang
  packages, so it needs more work
---
 ...bs-order-to-avoid-picking-up-system-libei.patch | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/package/erlang/0001-Change-libs-order-to-avoid-picking-up-system-libei.patch b/package/erlang/0001-Change-libs-order-to-avoid-picking-up-system-libei.patch
new file mode 100644
index 000000000000..c21311cbb395
--- /dev/null
+++ b/package/erlang/0001-Change-libs-order-to-avoid-picking-up-system-libei.patch
@@ -0,0 +1,32 @@
+From de58cbe979942308eb8823a526cd68b06d5dc662 Mon Sep 17 00:00:00 2001
+From: Sacha <sachahony@gmail.com>
+Date: Wed, 13 Mar 2024 13:28:41 +0100
+Subject: [PATCH] Change libs order to avoid picking up system libei
+
+Upstream: https://github.com/erlang/otp/commit/de58cbe
+Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
+---
+ lib/odbc/c_src/Makefile.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in
+index d1b26743a6a4..03ed314f6a26 100644
+--- a/lib/odbc/c_src/Makefile.in
++++ b/lib/odbc/c_src/Makefile.in
+@@ -80,10 +80,10 @@ ODBC_INCLUDE = @ODBC_INCLUDE@
+ # ----------------------------------------------------
+ CC =  @CC@
+ CFLAGS = $(TYPEFLAGS) @CFLAGS@ @THR_DEFS@ @DEFS@
+-EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET)
++EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET) $(EI_LIB)
+ LD = @LD@
+-LDFLAGS =  $(ODBC_LIB) $(EI_LDFLAGS)
+-LIBS = @LIBS@ @THR_LIBS@ $(EI_LIB)
++LDFLAGS =  $(EI_LDFLAGS) $(ODBC_LIB)
++LIBS = @LIBS@ @THR_LIBS@
+ INCLUDES = -I. $(ODBC_INCLUDE) $(EI_INCLUDE)
+ TARGET_FLAGS =  @TARGET_FLAGS@
+ 
+-- 
+2.55.0
+

---
base-commit: c3f3705a2fd27206cf2e79fd802b681e77be2cfe
change-id: 20260823-fix-host-erlang-5c0b82ba7a2f

Best regards,
--  
Alexis Lothoré <alexis.lothore@bootlin.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-09-04 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 21:49 [Buildroot] [PATCH] package/erlang: fix link failure on odbcserver Alexis Lothoré via buildroot
2026-08-29 21:09 ` Thomas Petazzoni via buildroot
2026-08-29 21:10   ` Thomas Petazzoni via buildroot
2026-09-04 12:18 ` Thomas Perale via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox