Tcl/Tk package installation

Moderators: cyao, soliday

Post Reply
fernando.sa
Posts: 2
Joined: 31 Oct 2012, 07:19

Tcl/Tk package installation

Post by fernando.sa » 05 Nov 2012, 05:51

Hi all,

I'm a beginner in elegant/sdds and I'm trying to install the linux RPM version of the OAG tcl/tk package. The package version is
OAGTclTk-8.4.13-6
and my operating system is
Linux version 2.6.32-44-generic, Ubuntu 10.04.4 LTS \n \l

I'm testing the installation with the plotTwiss script.
In order for tclsh not to enter in interactive mode when I call plotTwiss, I had to change the content of oagtclsh
from
  • /usr/bin/tclsh
by
  • /usr/bin/tclsh "$@"
If I simply substitute the command
  • exec oagtclsh "$0" "$@"
by
  • exec tclsh "$0" "$@"
it also works.

After this, plotTwiss set the variable auto_path to include the address of the oagtcltk libraries:

Code: Select all

if [info exists env(OAG_TOP_DIR)] {
    set auto_path [linsert $auto_path 0 $env(OAG_TOP_DIR)/oag/apps/lib/$env(HOST_ARCH)]
} else {
    set auto_path [linsert $auto_path 0 /usr/local/oag/apps/lib/$env(HOST_ARCH)]
}
At this point, if I look at the variable auto_path what I see is:
  • /usr/local/oag/apps/lib/linux-x86_64 /usr/share/tcltk/tcl8.5 /usr/lib /usr/local/lib/tcltk /usr/local/share/tcltk /usr/lib/tcltk /usr/share/tcltk
and if I run plotTwiss I get the error message:

Code: Select all

invalid command name "APSStandardSetup"
    while executing
"APSStandardSetup"
    (file "/usr/local/oag/apps/src/tcltkapp/oagapp/plotTwiss" line 73)
If I change the HOST_ARCH (linux-x86_64) address by its content:

Code: Select all

if [info exists env(OAG_TOP_DIR)] {
    set auto_path [linsert $auto_path 0 $env(OAG_TOP_DIR)/oag/apps/lib/$env(HOST_ARCH)]
} else {
    set auto_path [linsert $auto_path 0 /usr/lib/oagtcltk]
}
and run plotTwiss I get the error message:

Code: Select all

invalid command name "APSStandardSetup"
    while executing
"APSStandardSetup"
    (file "/usr/local/oag/apps/src/tcltkapp/oagapp/averageOverElements" line 24)
what suggests the error was corrected for plotTwiss script, but when averageOverElements is called the same problem happens.

Although one solution seems to be making the same alterations to all scripts, I don't understand the reason of this misinterpretation of the original code. Both problems (oagtclsh and auto_path setting) seem to rely on how tclsh interprets files which redirect to other files/programs/folders. I tried to run the scripts with tclsh8.4 and tclsh8.5.

Thank you very much for your attention,

Fernando.

soliday
Posts: 366
Joined: 28 May 2008, 09:15

Re: Tcl/Tk package installation

Post by soliday » 05 Nov 2012, 10:44

My version of plotTwiss script starts with:

#!/bin/sh
# \
exec oagtclsh "$0" "$@"

When it installed the OAGTclTk package. It should have created a symbolic link that you seem to be missing.
Try making it by hand using the commands:

cd /usr/local/oag/apps/lib/
ln -s /usr/lib/oagtcltk linux-x86_64

fernando.sa
Posts: 2
Joined: 31 Oct 2012, 07:19

Re: Tcl/Tk package installation

Post by fernando.sa » 05 Nov 2012, 13:52

Thank you, Soliday!

The problem was the missing links, indeed.
Despite there was a file named oagtclsh in /usr/bin/, it was not a link to the tclsh interpreter, but a text file whose content was the address of the interpreter. The same happened to linux-x86_64.
Once these files were substituted by the correct link, plotTwiss worked well.

blanco-garcia
Posts: 39
Joined: 29 Oct 2021, 10:41

Re: Tcl/Tk package installation

Post by blanco-garcia » 10 Nov 2021, 06:17

Dear all,
I'm trying to run the mogaRING example. The geneticOptimizer command shows the following error:

Code: Select all

$ geneticOptimizer
invalid command name "APSStandardSetup"
    while executing
"APSStandardSetup"
    (file "/usr/bin/geneticOptimizer" line 174)
Is there any symbolic link missing to do by hand for Cent OS 7 ?

Here are the installed rpms :

Code: Select all

$ rpm -qa --last | grep -i OAGtcl
OAGTclTk-1.26-1.x86_64                        Tue 19 Oct 2021 11:23:49 AM CEST
$ rpm -qa --last | grep -i elegant
elegant-2021.3.0-1.x86_64                     Fri 05 Nov 2021 01:38:31 PM CET
Best regards,
o

soliday
Posts: 366
Joined: 28 May 2008, 09:15

Re: Tcl/Tk package installation

Post by soliday » 10 Nov 2021, 11:19

OAGTclTk-1.26-1.x86_64 should have installed:
/usr/local/oag/apps/lib/linux-x86_64/tclIndex
and
/usr/local/oag/apps/lib/linux-x86_64/APSStandardSetup.tcl

Make sure that the environment variable HOST_ARCH is set to linux-x64_64
There can also be an issue if you have the environment variable OAG_TOP_DIR defined. It will alter the path that the script searches for these files:
$OAG_TOP_DIR/oag/apps/lib/$HOST_ARCH

blanco-garcia
Posts: 39
Joined: 29 Oct 2021, 10:41

Re: Tcl/Tk package installation

Post by blanco-garcia » 12 Nov 2021, 02:50

Dear Soliday, thank you very much!

As you said, the issue was the HOST_ARCH variable setting.
Once I set it in my ".bashrc" file as

Code: Select all

export HOST_ARCH=linux-x86_64
I was able to execute "geneticOptimizer".

Best regards,
o

Post Reply