diff mbox series

[meta-oe] tk: add INCLUDEDIR for tcl9.0

Message ID 20250630151655.3505250-1-f_l_k@t-online.de
State Under Review
Headers show
Series [meta-oe] tk: add INCLUDEDIR for tcl9.0 | expand

Commit Message

Markus Volk June 30, 2025, 3:16 p.m. UTC
this fixes a build error:
| In file included from /home/flk/poky/build/tmp/work/corei7-64-poky-linux/tk/9.0.1/sources/tk9.0.1/unix/../generic/tkPort.h:21,
|                  from /home/flk/poky/build/tmp/work/corei7-64-poky-linux/tk/9.0.1/sources/tk9.0.1/unix/../generic/tkInt.h:19,
|                  from /home/flk/poky/build/tmp/work/corei7-64-poky-linux/tk/9.0.1/sources/tk9.0.1/unix/../generic/tkGrab.c:13:
| /home/flk/poky/build/tmp/work/corei7-64-poky-linux/tk/9.0.1/sources/tk9.0.1/unix/../generic/tk.h:19:10: fatal error: tcl.h: No such file or directory
|    19 | #include <tcl.h>

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta-oe/recipes-devtools/tcltk/tk_9.0.1.bb | 1 +
 1 file changed, 1 insertion(+)

Comments

Alper Ak June 30, 2025, 6:05 p.m. UTC | #1
Hi Markus,

I recently sent a patch similar to yours. Yes, this really solves the problem, but there seem to be two things to think about:

1) if tcl and tk can be upgraded independently (tcl recipe is in poky, tk is in meta-oe), this may cause failure if tcl is upgraded without upgrading tk. We are telling him to look at “-I${STAGING_INCDIR}/tcl${VER}” but when tcl is upgraded, if tk isn't upgraded to the same version, it will probably fail.

2) tk uses pkgconfig that's the way for tcl to tell tk where to find its headers. When I look at the compile logs, it really tells but there is a situation like this in include path:

-I.../recipe-sysroot/usr/include/sources/tcl9.0.1/generic

Somehow, the "sources" is added to the path from somewhere, and it must be /usr/include/tcl9.0.1/generic

I know that the "tcl.h" file is available in both ../recipe-sysroot/usr/include/tcl9.0/ and ../recipe-sysroot/usr/include/tcl9.0.1/generic/  but considering the path provided to the compiler as an include, we should use the generic one.

I have been sick for a while and haven't had much time to look at the situation with pkgconfig. I wanted to write to see if it might help you.
Markus Volk June 30, 2025, 8:47 p.m. UTC | #2
Hi,
as I understand it, tcl is configured in tk by using tclConfig.sh 
crosscript instead of
pkgconfig (at least to some extent) and takes the path specified for 
TLC_SRC_DIR to include tcl.h.

This can be overridden by editing the tk recipe, e.g.
EXTRA_OEMAKE += "TCLDIR=${STAGING_INCDIR}/tcl$whatever"

But this does not solve the problem that tcl $PV must match whatever is 
set in the tk recipe
Maybe we can edit tcl in oe-core like this, but I'm not sure if this 
would break things:

 From c2e5e1e4cb9fb1107db4632c4428607931a1b3b9 Mon Sep 17 00:00:00 2001
 From: Markus Volk <f_l_k@t-online.de>
Date: Mon, 30 Jun 2025 22:03:17 +0200
Subject: [PATCH] tcl: dont use version in includedir

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 .../tcltk/tcl/0004-tcl-update-the-header-location.patch   | 8 ++++----
 meta/recipes-devtools/tcltk/tcl_9.0.1.bb                  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/meta/recipes-devtools/tcltk/tcl/0004-tcl-update-the-header-location.patch 
b/meta/recipes-devtools/tcltk/tcl/0004-tcl-update-the-header-location.patch
index 50a4a27256..1bcdfb3c22 100644
--- 
a/meta/recipes-devtools/tcltk/tcl/0004-tcl-update-the-header-location.patch
+++ 
b/meta/recipes-devtools/tcltk/tcl/0004-tcl-update-the-header-location.patch
@@ -34,7 +34,7 @@ index b5f9ab7..fbc87a2 100644

  # Directory in which to install the include file tcl.h:
 -INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)
-+INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)/tcl$(VERSION)
++INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)/tcl

  # Path to the private tcl header dir:
  PRIVATE_INCLUDE_DIR	= @PRIVATE_INCLUDE_DIR@
@@ -47,7 +47,7 @@ index 43ec7e4..19524d1 100644

  test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(libdir)/tcl$(VERSION)'
 -PRIVATE_INCLUDE_DIR='$(includedir)'
-+PRIVATE_INCLUDE_DIR='$(includedir)/tcl$(VERSION)'
++PRIVATE_INCLUDE_DIR='$(includedir)/tcl'
  HTML_DIR='$(DISTDIR)/html'

  # Note:  in the following variable, it's important to use the absolute
@@ -56,7 +56,7 @@ index 43ec7e4..19524d1 100644

  # Install time header dir can be set via --includedir
 -eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
-+eval "TCL_INCLUDE_SPEC=\"-I${includedir}/tcl${VERSION}\""
++eval "TCL_INCLUDE_SPEC=\"-I${includedir}/tcl\""

  
#------------------------------------------------------------------------
  # tclConfig.sh refers to this by a different name
@@ -69,7 +69,7 @@ index 9c6da82..8aa5ae8 100644
  exec_prefix=@exec_prefix@
  libdir=@libdir@
 -includedir=@includedir@
-+includedir=@includedir@/tcl@PACKAGE_VERSION@
++includedir=@includedir@/tcl
  libfile=@TCL_LIB_FILE@

  Name: Tool Command Language
diff --git a/meta/recipes-devtools/tcltk/tcl_9.0.1.bb 
b/meta/recipes-devtools/tcltk/tcl_9.0.1.bb
index 70aa9b606c..bafea067ed 100644
--- a/meta/recipes-devtools/tcltk/tcl_9.0.1.bb
+++ b/meta/recipes-devtools/tcltk/tcl_9.0.1.bb
@@ -51,13 +51,13 @@ do_install() {
 	ln -sf ./tclsh${VER} ${D}${bindir}/tclsh
 	ln -sf tclsh9.0 ${D}${bindir}/tclsh${VER}
 	sed -i "s;-L${B};-L${STAGING_LIBDIR};g" tclConfig.sh
-	sed -i "s;'${WORKDIR};'${STAGING_INCDIR};g" tclConfig.sh
+	sed -i "s;'${WORKDIR};'${STAGING_INCDIR}/tcl;g" tclConfig.sh
 	install -d ${D}${bindir_crossscripts}
 	install -m 0755 tclConfig.sh ${D}${bindir_crossscripts}
 	install -m 0755 tclConfig.sh ${D}${libdir}
 	for dir in compat generic unix; do
-		install -d ${D}${includedir}/${BPN}${VER}/$dir
-		install -m 0644 ${S}/$dir/*.h ${D}${includedir}/${BPN}${VER}/$dir/
+		install -d ${D}${includedir}/${BPN}/$dir
+		install -m 0644 ${S}/$dir/*.h ${D}${includedir}/${BPN}/$dir/
 	done
 }
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/tcltk/tk_9.0.1.bb b/meta-oe/recipes-devtools/tcltk/tk_9.0.1.bb
index 504b40927e..4da4814f29 100644
--- a/meta-oe/recipes-devtools/tcltk/tk_9.0.1.bb
+++ b/meta-oe/recipes-devtools/tcltk/tk_9.0.1.bb
@@ -30,6 +30,7 @@  S = "${UNPACKDIR}/${BPN}${PV}"
 # Short version format: "8.6"
 VER = "${@os.path.splitext(d.getVar('PV'))[0]}"
 
+CFLAGS += "-I${STAGING_INCDIR}/tcl${VER}"
 LDFLAGS += "-Wl,-rpath,${libdir}/tcltk/${PV}/lib"
 
 inherit autotools features_check pkgconfig