• Diagnosing tcl package require

    From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.tcl on Sun Nov 2 15:36:25 2025
    From Newsgroup: comp.lang.tcl

    Hi Folks,

    I have:

    #!/usr/bin/env tclsh
    package require Tcldot

    I get:

    can't find package Tcldot
    while executing
    "package require Tcldot"
    (file "./clgraphs.tcl" line 3)

    I have libtcldot.so and libtcldot_builtin.so on my system, I suppose
    they're not being found.

    Can anyone give some diagnostic steps I can use to understand why?

    eg, an environment variable that shows the package search actions,
    failures, and fallbacks, and other things like that?


    --
    Tristan Wibberley

    The message body is Copyright (C) 2025 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From ted@loft.tnolan.com (Ted Nolan@tednolan to comp.lang.tcl on Sun Nov 2 18:03:47 2025
    From Newsgroup: comp.lang.tcl

    In article <10e7tpp$2610e$1@dont-email.me>,
    Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> wrote: >Hi Folks,

    I have:

    #!/usr/bin/env tclsh
    package require Tcldot

    I get:

    can't find package Tcldot
    while executing
    "package require Tcldot"
    (file "./clgraphs.tcl" line 3)

    I have libtcldot.so and libtcldot_builtin.so on my system, I suppose
    they're not being found.

    Can anyone give some diagnostic steps I can use to understand why?

    eg, an environment variable that shows the package search actions,
    failures, and fallbacks, and other things like that?


    Looks like you are on Linux so you can do an strace to see
    what it's trying to do:

    strace -o tf /path/to/tclsh

    then look at the output file "tf" for stuff like "access", "stat" or "open"

    If it's not looking in the right places you can add the correct directory
    to the Tcl list variable "auto_path".
    --
    columbiaclosings.com
    What's not in Columbia anymore..
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.tcl on Sun Nov 2 19:16:30 2025
    From Newsgroup: comp.lang.tcl

    On 02/11/2025 18:03, Ted Nolan <tednolan> wrote:
    strace -o tf /path/to/tclsh

    then look at the output file "tf" for stuff like "access", "stat" or "open"
    For anybody else using this method, the strace option arguments -e file restricts the contents of "tf" to file-related syscalls:

    strace -e file tf /path/to/tclsh

    If anybody knows of a higher-level diagnostic (tcl concepts level, I
    mean, I know of ltrace too), please do post!

    --
    Tristan Wibberley

    The message body is Copyright (C) 2025 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.tcl on Sun Nov 2 20:25:10 2025
    From Newsgroup: comp.lang.tcl

    On 02/11/2025 18:03, Ted Nolan <tednolan> wrote:

    If it's not looking in the right places you can add the correct directory
    to the Tcl list variable "auto_path".

    I bunged this in before "package require Tcldot" for the moment:

    set auto_path \
    [list {*}$auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/]

    it's sufficient for some draft code

    --
    Tristan Wibberley

    The message body is Copyright (C) 2025 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Sun Nov 2 21:30:22 2025
    From Newsgroup: comp.lang.tcl

    Hi Tristan,
    thanks for the message.

    The normal procedure is:
    all pckIndex.tcl in all folders of the variable auto_path are sourced.
    There are also tcl-modules, but then, you would not have a library.

    I would search for eventual pckIndex.tcl files and what they countain.

    I suppose, the pckIndex.tcl for your library is missing.

    A typical content to load a sh is:

    package ifneeded Tcldot load /var/lib/libtcldot.so

    Take care,
    Harald



    Am 02.11.2025 um 16:36 schrieb Tristan Wibberley:
    Hi Folks,

    I have:

    #!/usr/bin/env tclsh
    package require Tcldot

    I get:

    can't find package Tcldot
    while executing
    "package require Tcldot"
    (file "./clgraphs.tcl" line 3)

    I have libtcldot.so and libtcldot_builtin.so on my system, I suppose
    they're not being found.

    Can anyone give some diagnostic steps I can use to understand why?

    eg, an environment variable that shows the package search actions,
    failures, and fallbacks, and other things like that?


    --
    Tristan Wibberley

    The message body is Copyright (C) 2025 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Mon Nov 3 08:25:10 2025
    From Newsgroup: comp.lang.tcl

    Am 02.11.25 um 21:30 schrieb Harald Oehlmann:
    Hi Tristan,
    thanks for the message.

    The normal procedure is:
    all pckIndex.tcl in all folders of the variable auto_path are sourced.


    pkgIndex.tcl

    Christian
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Mon Nov 3 12:35:22 2025
    From Newsgroup: comp.lang.tcl

    * Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
    | set auto_path \
    | [list {*}$auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/]

    lappend auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/

    R'
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.tcl on Mon Nov 3 18:36:23 2025
    From Newsgroup: comp.lang.tcl

    On 03/11/2025 11:35, Ralf Fassel wrote:
    * Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
    | set auto_path \
    | [list {*}$auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/]

    lappend auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/
    I've filled my head with so many things I've started using a restricted selection of more general expressions.

    How does lappend compare for speed?

    What are the general rules regarding that for tcl, and if "check
    documentation" is an important part then what tools are there to
    integrate with editors that show relevant options and their speed
    comparisons?

    --
    Tristan Wibberley

    The message body is Copyright (C) 2025 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Rich@rich@example.invalid to comp.lang.tcl on Mon Nov 3 20:31:32 2025
    From Newsgroup: comp.lang.tcl

    Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> wrote:
    On 03/11/2025 11:35, Ralf Fassel wrote:
    * Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
    | set auto_path \
    | [list {*}$auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/]

    lappend auto_path /usr/lib/x86_64-linux-gnu/graphviz/tcl/
    I've filled my head with so many things I've started using a restricted selection of more general expressions.

    How does lappend compare for speed?

    Faster, as it just adds one more entry onto the existing list. Your
    version with {*} ends up rebuilding the entire list anew. Tcl's
    internals likely reuse the list elements themselves, so the difference
    is in allocating, and filling in, a new internal tracking array for the
    list structure plus deallocating the old internal tracking array for
    the prior copy.

    For adding an entry to auto_path, both will be so quick that the
    difference for the overall code will be immaterial.

    But if in the inside of a nested loop, the difference in speed will be multiplied by the number of times the inside code of the loop is
    executed.

    In any case, 'lappend' is the canonical method for "append one or more elements to a list", so it will almost always be the optimal method for
    doing so.

    What are the general rules regarding that for tcl, and if "check documentation" is an important part then what tools are there to
    integrate with editors that show relevant options and their speed comparisons?

    Tcl has a useful [time] command that you can use to measure speed
    differences of different code variants. That however only indicates
    which is faster. To understand 'why' requires some knowledge of how
    the internals work behind the curtain.
    --- Synchronet 3.21a-Linux NewsLink 1.2