Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where to install my own packages

45 views
Skip to first unread message

Cecil Westerhof

unread,
Dec 7, 2017, 7:44:06 PM12/7/17
to
I am not that far yet, but when I am going to write my own packages:
what is the best place to install them? I was thinking:
/usr/local/lib/tcltk

Is that correct?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Robert Heller

unread,
Dec 7, 2017, 8:47:34 PM12/7/17
to
At Fri, 08 Dec 2017 01:35:24 +0100 Cecil Westerhof <Ce...@decebal.nl> wrote:

>
> I am not that far yet, but when I am going to write my own packages:
> what is the best place to install them? I was thinking:
> /usr/local/lib/tcltk

I would use:

/usr/local/share/packagename/

for pure Tcl packages.

>
> Is that correct?
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Rich

unread,
Dec 7, 2017, 10:08:54 PM12/7/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> I am not that far yet, but when I am going to write my own packages:
> what is the best place to install them? I was thinking:
> /usr/local/lib/tcltk
>
> Is that correct?

For your own packages, they could go wherever you wanted them to go.
So that dir would be as good as anywhere.

Christian Gollwitzer

unread,
Dec 8, 2017, 3:50:22 AM12/8/17
to
Am 08.12.17 um 01:35 schrieb Cecil Westerhof:
> I am not that far yet, but when I am going to write my own packages:
> what is the best place to install them? I was thinking:
> /usr/local/lib/tcltk
>
> Is that correct?
>

In general, you can put them anywhere you like. But: are you asking, how
Tcl *finds* the packages? The answer is the variable auto_path, which
contains a list of directories which Tcl searches recursively for
packages. A package is made by a pkgIndex.tcl file. Try this:


tclsh
% join $auto_path \n
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources
/usr/lib
~/Library/Tcl
/Library/Tcl
/System/Library/Tcl
/System/Library/Tcl/8.5
~/Library/Frameworks
/Library/Frameworks
/System/Library/Frameworks
%


The list of directories on your system will be different. You can add
another path to it using lappend (before package require). I usually add
a directory called "lib" next to the main script by this line in my scripts:

lappend auto_path [file dirname [info script]]/lib

Christian

Harald Oehlmann

unread,
Dec 8, 2017, 4:36:10 AM12/8/17
to
Dear TCL'ers,

well, here is the beginner, as usual...

I ran into tips issues that my TCL is to old.
So, I tried to compile tcl8.6.7 on CentOS6.5 x86 64 bit

cd unix
./configure
make
... stops with the following error message:

/home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c: In Funktion
»IPv6AddressNeedsNumericRendering«:
/home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:716: Fehler: #pragma GCC
diagnostic nicht innerhalb von Funktionen erlaubt
/home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:717: Fehler: #pragma GCC
diagnostic nicht innerhalb von Funktionen erlaubt
/home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:719: Fehler: #pragma GCC
diagnostic nicht innerhalb von Funktionen erlaubt
make: *** [tclUnixSock.o] Fehler 1

Translation to English:

Error: #pragma GCC diagnostic not allowed within function

Any ideas ?

Thank you,
Harald

Christian Gollwitzer

unread,
Dec 8, 2017, 4:47:12 AM12/8/17
to
Am 08.12.17 um 10:36 schrieb Harald Oehlmann:
It's a bug in the code. You can simply delete these #pragma lines. They
have no effect other than suppressing certain warnings from gcc. That it
fails for you probably means that the pragma has changed with different
versions of gcc / clang.

It seems already fixed in trunk, BTW:

https://github.com/tcltk/tcl/commit/865f11be2c3ee4294408debefcd72de0fc6b2772

(I'm linking to guthub because it was way easier to find the commit
using the graphical "blame" function)


Christian

Harald Oehlmann

unread,
Dec 8, 2017, 6:02:58 AM12/8/17
to
Thank you, Christian!
Following the error message, the pragmas are placed inside a function
which is not supported by my probably history gcc.

Now it works. I find it quite funny, that there are no files in lib64,
but lib, and the man pages are distributed between man (tcl) and
share/man (sqlite, tdbc,thread,itcl).
It is apparently a 64 bit build, as pointersize and wordsize is 8.

Anyway, thank you,
Harald

Rolf Ade

unread,
Dec 8, 2017, 7:18:42 AM12/8/17
to


Harald Oehlmann <wort...@yahoo.de> writes:
> [...]
> So, I tried to compile tcl8.6.7 on CentOS6.5 x86 64 bit
>
> cd unix
> ./configure
> make
> ... stops with the following error message:
>
> /home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c: In Funktion
> »IPv6AddressNeedsNumericRendering«:
> /home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:716: Fehler: #pragma GCC
> diagnostic nicht innerhalb von Funktionen erlaubt
> /home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:717: Fehler: #pragma GCC
> diagnostic nicht innerhalb von Funktionen erlaubt
> /home/oehhar/test/tcl8.6.7/unix/tclUnixSock.c:719: Fehler: #pragma GCC
> diagnostic nicht innerhalb von Funktionen erlaubt
> make: *** [tclUnixSock.o] Fehler 1
>
> Translation to English:
>
> Error: #pragma GCC diagnostic not allowed within function
>
> Any ideas ?

Known and (on trunk and for upcoming versions) fixed. See

https://core.tcl.tk/tcl/tktview?name=d2612a2fa1

rolf

Ricardo kozmate.net

unread,
Dec 8, 2017, 7:19:41 AM12/8/17
to
Em 08/12/17 00:35, Cecil Westerhof escreveu:
> I am not that far yet, but when I am going to write my own packages:
> what is the best place to install them? I was thinking:
> /usr/local/lib/tcltk
>
> Is that correct?
>

I use

/usr/lib64/tcl/tcl8/site-tcl/

/usr/lib64/tcl/ is in the $auto_path so it will be found - change
accordingly to match yours.

tcl8/ hints to compatibility level - maybe I should use tcl8.5/ instead,
but, hey!, it's for local use, and it is working just fine :-)

site-tcl/ to distinguish from other packages.

I read a recommendations to the use this somewhere some (few) years, but
I do not recall, nor can find, where.

--
{ricardo from kozmate.net}

Cecil Westerhof

unread,
Dec 8, 2017, 7:59:06 AM12/8/17
to
Christian Gollwitzer <auri...@gmx.de> writes:

> Am 08.12.17 um 01:35 schrieb Cecil Westerhof:
>> I am not that far yet, but when I am going to write my own packages:
>> what is the best place to install them? I was thinking:
>> /usr/local/lib/tcltk
>>
>> Is that correct?
>>
>
> In general, you can put them anywhere you like. But: are you asking, how
> Tcl *finds* the packages? The answer is the variable auto_path, which
> contains a list of directories which Tcl searches recursively for
> packages. A package is made by a pkgIndex.tcl file. Try this:
>
>
> tclsh
> % join $auto_path \n
> /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts
> /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources
> /usr/lib
> ~/Library/Tcl
> /Library/Tcl
> /System/Library/Tcl
> /System/Library/Tcl/8.5
> ~/Library/Frameworks
> /Library/Frameworks
> /System/Library/Frameworks
> %
>
>
> The list of directories on your system will be different. You can add

I should have been more clear. When using:
join $auto_path \n

I get:
/usr/share/tcltk/tcl8.6
/usr/share/tcltk
/usr/lib
/usr/local/lib/tcltk
/usr/local/share/tcltk
/usr/lib/tcltk/x86_64-linux-gnu
/usr/lib/tcltk
/usr/lib/tcltk/tcl8.6

And from those I thought
/usr/local/lib/tcltk
would be the most logical.

By the way, I am using Debian 9.

Rich

unread,
Dec 8, 2017, 8:13:41 AM12/8/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> Christian Gollwitzer <auri...@gmx.de> writes:
>
>> Am 08.12.17 um 01:35 schrieb Cecil Westerhof:
>>> I am not that far yet, but when I am going to write my own packages:
>>> what is the best place to install them? I was thinking:
>>> /usr/local/lib/tcltk
>>>
>>> Is that correct?
>>
>> In general, you can put them anywhere you like. But: are you asking,
>> how Tcl *finds* the packages? The answer is the variable auto_path,
>> which contains a list of directories which Tcl searches recursively
>> for packages. A package is made by a pkgIndex.tcl file. Try this:
>
> I should have been more clear. When using:

Yes, more clarity in one's origional posts often results in a *much*
lower latency between asking and receiving the answer you want.

> join $auto_path \n
>
> I get:
> /usr/share/tcltk/tcl8.6
> /usr/share/tcltk
> /usr/lib
> /usr/local/lib/tcltk
> /usr/local/share/tcltk
> /usr/lib/tcltk/x86_64-linux-gnu
> /usr/lib/tcltk
> /usr/lib/tcltk/tcl8.6
>
> And from those I thought
> /usr/local/lib/tcltk
> would be the most logical.
>
> By the way, I am using Debian 9.

Those are the default locations where Tcl, on your system, searches for
packages.

But you can place your own packages anywhere you like, and simply add
an entry to that list by either appending, or prepending, a new
directory to the global "auto_path" variable.

So if you wanted to keep your tcl modules in /home/cecil/tcl-modules/
you can, and your scripts just need:

lappend auto_path /home/cecil/tcl-modules

before they try to package require any of your personal modules (note,
prepending is left as an exercise for the reader).

Rich

unread,
Dec 8, 2017, 8:15:31 AM12/8/17
to
Harald Oehlmann <wort...@yahoo.de> wrote:
> Dear TCL'ers,
>
> well, here is the beginner, as usual...
>

Please don't hijack an existing thread by changing the subject line and
replying. That *does not* create a new thread on Usenet. Your thread
and the thread you hijacked are now mixed together when yours should
have been a new thread. If you have a new topic, *always* post a *new*
message.

Harald Oehlmann

unread,
Dec 8, 2017, 8:21:19 AM12/8/17
to
Sorry.

Cecil Westerhof

unread,
Dec 8, 2017, 8:44:07 AM12/8/17
to
"Ricardo kozmate.net" <ric...@kozmate.net> writes:

> Em 08/12/17 00:35, Cecil Westerhof escreveu:
>> I am not that far yet, but when I am going to write my own packages:
>> what is the best place to install them? I was thinking:
>> /usr/local/lib/tcltk
>>
>> Is that correct?
>>
>
> I use
>
> /usr/lib64/tcl/tcl8/site-tcl/
>
> /usr/lib64/tcl/ is in the $auto_path so it will be found - change
> accordingly to match yours.

In my auto_path I have:
/usr/share/tcltk/tcl8.6
/usr/share/tcltk
/usr/lib
/usr/local/lib/tcltk
/usr/local/share/tcltk
/usr/lib/tcltk/x86_64-linux-gnu
/usr/lib/tcltk
/usr/lib/tcltk/tcl8.6

And in tcl_pkgPath:
/usr/local/lib/tcltk
/usr/local/share/tcltk
/usr/lib/tcltk/x86_64-linux-gnu
/usr/lib/tcltk
/usr/share/tcltk
/usr/lib/tcltk/tcl8.6
/usr/lib


> tcl8/ hints to compatibility level - maybe I should use tcl8.5/ instead,
> but, hey!, it's for local use, and it is working just fine :-)

It is local, yes. So I think that in my case
/usr/local/lib/tcltk
would be the best.

By the way: what is the difference between auto_path and tcl_pkgPath?

Cecil Westerhof

unread,
Dec 8, 2017, 9:28:07 AM12/8/17
to
Rich <ri...@example.invalid> writes:

>> join $auto_path \n
>>
>> I get:
>> /usr/share/tcltk/tcl8.6
>> /usr/share/tcltk
>> /usr/lib
>> /usr/local/lib/tcltk
>> /usr/local/share/tcltk
>> /usr/lib/tcltk/x86_64-linux-gnu
>> /usr/lib/tcltk
>> /usr/lib/tcltk/tcl8.6
>>
>> And from those I thought
>> /usr/local/lib/tcltk
>> would be the most logical.
>>
>> By the way, I am using Debian 9.
>
> Those are the default locations where Tcl, on your system, searches for
> packages.
>
> But you can place your own packages anywhere you like, and simply add
> an entry to that list by either appending, or prepending, a new
> directory to the global "auto_path" variable.
>
> So if you wanted to keep your tcl modules in /home/cecil/tcl-modules/
> you can, and your scripts just need:
>
> lappend auto_path /home/cecil/tcl-modules

Well, I want them accessible for everyone, so best to stay with the
standard paths I think.

Rich

unread,
Dec 8, 2017, 11:35:55 AM12/8/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> By the way: what is the difference between auto_path and tcl_pkgPath?

man tcl_pkgPath

should give the man page that defines both, presuming the man pages are
installed on your system.

Andreas Leitgeb

unread,
Dec 8, 2017, 11:57:33 AM12/8/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> In my auto_path I have:
> And in tcl_pkgPath:

On some machine where I configured, compiled and installed
tcl from a source tree the auto_path only has installdir/lib
and installdir/lib/tcl8.6 in it and the tcl_pkgPath only has
installdir/lib (where installdir is the path I specified with
--prefix option to configure)

My point is, that you might have a hard time pre-guessing the
install location for anyone else's machine.

If your task is to provide an install script for others, then giving
/usr/local/lib/tcltk as default wouldn't be the worst choice,
but not-providing an easy way to override it could well be
considered a "worst choice" ;-)

Cecil Westerhof

unread,
Dec 8, 2017, 1:14:07 PM12/8/17
to
Sadly they are not. But I should look to get that done then.

Cecil Westerhof

unread,
Dec 8, 2017, 1:14:07 PM12/8/17
to
I think it will take some time before my packages are good enough to
distribute to others. ;-)

But I will keep it in mind.

Rich

unread,
Dec 8, 2017, 2:00:24 PM12/8/17
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> Rich <ri...@example.invalid> writes:
>
>> Cecil Westerhof <Ce...@decebal.nl> wrote:
>>> By the way: what is the difference between auto_path and tcl_pkgPath?
>>
>> man tcl_pkgPath
>>
>> should give the man page that defines both, presuming the man pages are
>> installed on your system.
>
> Sadly they are not. But I should look to get that done then.

Ah, yes, you should look to see what .deb package you have to install
to get the man pages. It is likely, given debians normal splitting, in
some "development" package that is normally not installed.

Having the man pages available will help a lot, they are quite well
done.

Web versions can be found here: https://www.tcl.tk/man/

But being able to pull up the man pages from a terminal with "man ..."
is very useful too.
0 new messages