On 2025-05-10 01:56, Stefan Heinzmann via Iup-users wrote:
> Hi all,
> 
> I am building the libraries with mixed success on Linux. My problems 
> appear to originate with the system detection built into tecmake. For a 
> reason I can't find an explanation for, the Linux kernel version appears 
> to play a major role. I wonder why, can anyone here enlighten me or 
> point me to a document with the rationale?
> 
> The problem is that you can't determine the versions of libraries 
> installed on the system from the kernel version with any reliability. 
> You can very easily have an up-to-date Ubuntu running on an old kernel, 
> for example when using containers. Containers don't include a kernel, 
> they use the kernel on the host. Having older kernels run a newer 
> distribution in the container is a common situation, and the opposite 
> also happens. Hence, the kernel version really should have no bearing at 
> all on the build process.
> 
> Given the tecmake system as it is, I would at least need a simple way to 
> "fake" or bypass the kernel detection in a way that would match the 
> distribution used, so that the dependencies are determined correctly.
> 
> I guess I would be able to figure this out from the tecmake sources, but 
> I was hoping there's an easier way somebody already knows about.
> 
> Thanks for any light you can shed on the matter.
> 
> Cheers
> Stefan

G'day Stefan,

I've been working to bring GNU/Linux, Lua, and Tecgraf IM/CD/IUP
together.

I have a SourceForge project called lglicua:

        L -- Lua
        G -- GNU/Linux
        I -- IM
        C -- CD
        U -- IUP
        A -- Assistant

        https://sourceforge.net/projects/lglicua/

This has been mostly my own project, with help from Tecgraf and
PUC-Rio Lua folks.  Because it's failed to catch the imagination,
I'm only calling it a "beta" version.  In practice,

        https://sourceforge.net/projects/lglicua/files/

shows that releases have spanned early May 2021 to end July 2024.
Releases are often connected to Lua and/or LuaRocks releases
and/or bugfixes, as I whitelist these versions in the Assistant.

You can get a "hello, world" modal dialog box in only two lines:

```
        #!/bin/bash ../support/play-lua-tec
        iup=require("iuplua"); iup.Message("MyApp", "hello, world")
```
You don't specify the GNU/Linux distribution you are using.
Lglicua has been tested (briefly) on [as per 0.1-beta2 release]:

        * Debian/Ubuntu family:
                - Debian
                - Kali,
                - Linux Mint,
                - MX, and
                Ubuntu;

        *Red Hat family:
                - CentOS,
                - CentOS-Stream, and
                - Rocky

Whitelisting by name and major version number is used.

        ** CentOS: Core-7, Stream-8 and Stream-9;
        ** Debian 12.5;
        ** Kali 2024.2;
        ** Linux Mint 19.3, 20.3, 21.3 and newly-released 22;
        ** MX 23.3_ahs_x64;
        ** Rocky: 8.10, 9.3 and 9.4; and
        ** Ubuntu: 22.04.4, 23.10 and 24.04.

Linux kernels include 3.10, 4.18, 5.4, 5.14, 5.15, 6.1, 6.5, 6.8, 6.8.11 and 
6.9.8.

GCC versions span 4.8.5 (CentOS Core-7) to 13.2 (Linux Mint-22 and Ubuntu 
24.04).

(Although GNU/Linux Mint 22.1 has been released, I haven't tested
lflicua against it).

------------------------------------------------

The Tecgraf sources for IM/CD/IUP nominate Ubuntu as the model
distribution for GNU/Linux releases.  Looking at the sources,
there looks to be acknowledgement for many different OSes,
especially in "project/src/tecmake.mak".

I've looked into dependencies of libraries (GTK etc), and have
tailored these according to distribution+release version.

--------

To your immediate difficulties:  I've encountered very similar problems
when preparing lglicua for the wide range of distributions and
release versions.  Two items stand out:

        1. I've replaced the IM/CD/IUP "tecmake.mak" with a rewritten
           version of my own.  This greatly streamlines GNU/Linux
           support, and, especially, adds support for all kernels 6.x
           (and, hopefully,) up to 9.x.

           Library versions have a maze of dependencies, and do refer
           to non-Linux platforms, so my rewrite may break things
           on non-GNU/Linux platforms -- but (of course), given that
           lglicua is, by definition, GNU/Linux, this doesn't matter.
           In particular, look at GTK selection.  The rewritten
           "tecmake.mak" uses (having just identified "Linux" as
           "TEC_SYSNAME"):

                   ifneq ($(filter 3 4 5 6 7 8 9, $(TEC_SYSVERSION)), )
                        USE_GTK3 = Yes
                   else # [...]

           whereas the Tecgraf-shipped version uses a verbose chain
           of Makefile "$(findstring ...)" to do the identification,
           and this chain hasn't been updated to include Kernel 6:

                   ifneq ($(findstring Linux5, $(TEC_UNAME)), )
                     USE_GTK3 = Yes
                   endif

          The practical upshot of not identifying Kernel 6.x as
          being compatible with GTK3 is that tecmake.mak gets confused
          and lapses back to GTK2, and then library selection and
          linking break.


-------- Newer tecmake.mak: --------

> # Refine GTK default request:  Newer GNU/Linux systems get GTK3,
> # unless GTK2 is specifically defined.
> # 240510: CHANGED in lglicua: We incorporate a modified change of the
> # Tecgraf IUP' r5950 change (r4.21->r4.22); the parent tested for
> # Linux31, and only selected USE_GTK3 if, in addition, TEC_DIST is
> # CentOS.  Here, we run this test (and, by extension, the following cygw
> # test) if TEC_SYSNAME is Linux, but TEC_SYSVERSION is (effectively)
> # less than 4.
> ifdef GTK_DEFAULT
>   ifndef USE_GTK2
>     ifneq ($(filter linux Linux, $(TEC_SYSNAME)), )
>       ifneq ($(filter 3 4 5 6 7 8 9, $(TEC_SYSVERSION)), )
>         USE_GTK3 = Yes
>       else ifneq ($(filter centos CentOS, $(TEC_DIST)), )
>         USE_GTK3 = Yes
>       endif
>     else ifneq ($(filter cygw CYGW, $(TEC_UNAME)), )
>       USE_GTK3 = Yes
>     endif
>   endif
> endif

-------- Tecgraf-shipped tecmake.mak: --------

> ifneq ($(findstring Linux24, $(TEC_UNAME)), )
>   NO_GTK_DEFAULT = Yes
> endif
> ifeq ($(TEC_UNAME), Linux26)
>   NO_GTK_DEFAULT = Yes
> endif
> ifeq ($(TEC_UNAME), Linux26_64)
>   NO_GTK_DEFAULT = Yes
> endif
> 
> ifndef NO_GTK_DEFAULT
>   ifneq ($(findstring cygw, $(TEC_UNAME)), )
>     GTK_DEFAULT = Yes
>   endif
>   ifneq ($(findstring CentOS, $(TEC_UNAME)), )
>     GTK_DEFAULT = Yes
>   endif
>   ifneq ($(findstring Linux, $(TEC_UNAME)), )
>     GTK_DEFAULT = Yes
>   endif
>   ifneq ($(findstring MacOS, $(TEC_UNAME)), )
>     GTK_DEFAULT = Yes
>   endif
>   ifneq ($(findstring FreeBSD, $(TEC_UNAME)), )
>     GTK_DEFAULT = Yes
>   endif
>   ifneq ($(findstring SunOS, $(TEC_UNAME)), )
>     ifeq ($(TEC_SYSARCH), x86)
>       GTK_DEFAULT = Yes
>     endif
>   endif
> endif
> 
> ifdef GTK_DEFAULT
>   ifndef USE_GTK2
>     ifneq ($(findstring Linux5, $(TEC_UNAME)), )
>       USE_GTK3 = Yes
>     endif
>     ifneq ($(findstring Linux4, $(TEC_UNAME)), )
>       USE_GTK3 = Yes
>     endif
>     ifneq ($(findstring Linux31, $(TEC_UNAME)), )
>       USE_GTK3 = Yes
>     endif
>     ifneq ($(findstring cygw, $(TEC_UNAME)), )
>       USE_GTK3 = Yes
>     endif
>     #Homebrew
>     #ifneq ($(findstring MacOS10, $(TEC_UNAME)), )
>     #  USE_GTK3 = Yes
>     #endif
>   endif
> endif
> 


-------- end of tecmake.mak comparison --------



        2. I had serious trouble trying to match GNU/Linux
           distributions, Release versions and libraries,
           so I extended tec_uname to help out:  For example,
           see how WebKit is chosen according to distribution
           name and version.  [There may be redundancies that
           can be merged/eliminated in a future release.]:

           $ ./tec_uname webkit


> ReportWebkitItems()
> {
>     local I
>     local L
> 
>     # At the time of writing (240726), GetLinuxDistro sets TEC_DISTID,
>     # but *not* GTK.
>     GTK="/usr/"
>     GetLinuxDistro
> 
>     # Use short names to keep line lengths under control.
>     I="${GTK}include/"
>     L="${GTK}lib/"
> 
>     # (Note to self: We rely on the package manager to pull in
>     # dependencies for the package list only, notably
>     # libsoup-2.4-dev[el] or libsoup-3.0-dev[el].  However, we probably
>     # still have to name them explicitly for #include directories.)
>     case "${TEC_DISTID}" in
>         centos-core.7 )
>             WK_PACKAGES="webkitgtk4-devel"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         centos-stream.8 )
>             WK_PACKAGES="webkit2gtk3-devel"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         centos-stream.9 )
>             WK_PACKAGES="webkit2gtk3-devel"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         debian.12 )
>             WK_PACKAGES="webkit2gtk-4.0-dev"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         kali.2024 )
>             WK_PACKAGES="webkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         linuxmint.19 )
>             WK_PACKAGES="libwebkit2gtk-4.0-dev"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         linuxmint.20 )
>             # LM20.3 does not have wk-4.1 etc.
>             WK_PACKAGES="libwebkit2gtk-4.0-dev"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         linuxmint.21 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         linuxmint.22 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         MX.23 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         rocky.8 )
>             WK_PACKAGES="webkit2gtk3-devel"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         rocky.9 )
>             # Works for both Rocky 9.3 and 9.4.
>             WK_PACKAGES="webkit2gtk3-devel"
>             WK_INCLUDES="${I}libsoup-2.4 ${I}webkitgtk-4.0"
>             WK_LIBRARIES="webkit2gtk-4.0"
>             ;;
> 
>         ubuntu.22 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         ubuntu.23 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         ubuntu.24 )
>             WK_PACKAGES="libwebkit2gtk-4.1-dev"
>             WK_INCLUDES="${I}libsoup-3.0 ${I}webkitgtk-4.1"
>             WK_LIBRARIES="webkit2gtk-4.1"
>             ;;
> 
>         * )
>             echo "Warning:__Ignoring__${TEC_DISTID}"
>             return 42
>     esac
> 
>     # ?? WARNING:  Several consumers of one-liner output use the text as
>     # a subfield within another field.  While the client could edit out
>     # the trailing whitespace (Bash or Lua versions), it's easier on
>     # them, and gives more readable code, if we use "echo -n" here.
> 
>     case "$1" in
>         webkit )
>             cat <<EOF
> WK_DISTID=${TEC_DISTID}
> WK_PACKAGES=${WK_PACKAGES}
> WK_INCLUDES=${WK_INCLUDES}
> WK_LIBRARIES=${WK_LIBRARIES}
> EOF
>             ;;
> 
>         webkit-packages )
>             echo -n "$WK_PACKAGES"
>             ;;
> 
>         webkit-includes )
>             echo -n "$WK_INCLUDES"
>             ;;
> 
>         webkit-libraries )
>             echo -n "$WK_LIBRARIES"
>             ;;
> 
>         default )
>             echo "Unknown ReportWebkitItems selection: ${1}"
>             ;;
>     esac
> }

-------- end of tec_uname snippet --------

(There are more build/include/library dependencies in
"LGLICUA/svn/assistant-database.lua", but I'll omit these
as this message is getting too long.]

--

Cheers,

sur-behoffski (Brenton Hoff)
programmer, Grouse Software


_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to