Tcl Source Code

View Ticket
Login
Ticket UUID: cb62320163a541a573763f3c0fcaf6cb4ce561cb
Title: two errors moving from itcl 4.0.3 to itcl 4.0.4
Type: Bug Version: tcl 8.6.5 itcl 4.0.4
Submitter: bennron Created on: 2016-04-11 15:08:03
Subsystem: - New Builtin Object Types Assigned To: dgp
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2016-08-19 17:38:04
Resolution: Fixed Closed By: dgp
    Closed on: 2016-08-19 17:38:04
Description:
Apr 11, 2016
Ronald Benn
Q.W.Page Associates Inc.
[email protected]

Moving from tcl 8.6.4 and itcl 4.0.3 to tcl 8.6.5 and itcl 4.0.4

Two errors occur and both are described here. Both prevent the creation of iWidgets which are in turn based on the itk library. My code failed creating a toplevel iWidget but probably creating any iWidget will expose the problems. The errors were (1) and (2) below:

(1) invalid command name ".itk.dialog1.info.list"

The workaround to (1) is in itk4.0/Archetype.tcl. Line (a) below has to be changed to line (b)

        (a) ::rename $itk_component(hull) $_path

        (b) ::uplevel #0 ::rename $itk_component(hull) $_path
 
(2) "bad option "_option_add": should be one of ..."

The workaround to (2) is also in itk4.0/Archetype.tcl. Line (c) below has to be changed to line (d)

        (c) private _option_add {list} {

        (d) protected method _option_add {list} {

Both workarounds indicate the change from tcl 8.6.4 to tcl 8.6.5 and itcl 4.0.3 to itcl 4.0.4 involve implementation of namespaces and a subtle difference has occurred. For error (1) it is probable that the command is renamed to a command within the namespace of the itk widget instead of in the global namespace and the uplevel #0 workaround deals with this. The cause of error (2) is unknown but seems to be a problem with the implementation of private versus protected and may also be namespace-related.


It would seem that iWidgets will not work in itcl 4.0.4 and this is pretty serious. It cost me a couple of days to isolate the problem. Also note that moving to itcl 4.0.4. is also critical as itcl 4.0.4 fixes a bug that made itcl 4.0 several orders of magnitude (depending on the test) slower than itcl 3.4. I am up and working with the workarounds but I think these issues should be addressed.
User Comments: dgp added on 2016-08-19 17:38:04:
Send a copy to [email protected]

Thanks.

AndyA added on 2016-08-19 17:12:15:

OK.

Are you interested in receiving the makefile.vc?
I don't see a way to attach it.

dgp added on 2016-08-19 16:31:02:
Ok, I think that's ample evidence the reported trouble
is fixed with current Itcl/Itk releases.  Closing this
ticket as fixed.

For the Windows build trouble, I plead guilty that I
do not maintain Windows infrastructure and I rely on
those who use Windows systems to contribute whatever
is needed.

I'll put out the call on the TCLCORE mailing list for
some help.  It *ought* to be a straightforward application
of TEA, I would think, but we will see.  If we don't
get this resolved soon, a new ticket on just that subject
would be a good idea.

AndyA added on 2016-08-16 09:55:21:

Unfortunately I am not able to attach the file makefile.vc with the port, and am hesitant to install, learn, and then check in to fossil. I'm happy to supply the file by email.

To reiterate, when Itk 4.0.2 is used, the problems mentioned here are solved, but Itk didn't have a working build infrastructure on Windows.

AndyA added on 2016-08-15 22:51:56:

The attached makefile.vc was derived from the itcl makefile.vc, but works I suspect it is possible still to remove/clean out some ITCL material. I am in no way an expert in this.

Other points.
1) The nmakehlp.c in the Itk 4.0.2 source tarball is out-of-date, so I copied it from itcl 4.0.4
2) itclStubLib.c uses Tcl_PkgRequire "itcl" which gives a problem loading, so I changed that to Itcl, which is OK.

Finally it would be nice to know if there is a smart way to ensure this package builds after Tk, since Itk is obviously dependent on Tk.

AndyA added on 2016-08-12 13:22:41:
After some fairly tedious edits and compile cycles, I've got an Itk 4.0.2 makefile.vc that compiles on Windows, but I get trouble with linking the library because of references to Itcl_ functions from the Itk C files.

If I do dumpbin /exports on the generated Itcl libraries only Itcl_Init and Itcl_SafeInit are exported from the dll, and nothing is exported from the itclstub40.lib.

If I patch itclIntDecls.h to use ITCL_EXPORT instead of ITCLAPI, then the functions are exported, but I fear this is not how it's "supposed" to be done, and further the itk build doesn't know that it's supposed to be imported from another DLL.

So overall I suspect I'm missing a trick in the makefile.vc that causes ITCLAPI to import or export depending on the current build context. Any advice or pointers to the "proper" way this is supposed to be done?

AndyA added on 2016-08-11 15:21:34:
The attached iw.tcl reproduces the problem when it occurs
When we run with the newer itk4.0.2 built on Linux, the problem does not occur.

The problem appears to me to be that makefile.vc in itk4.0.2 hasn't been updated for Windows building. I'm attempting to do that by copying the itcl4.0.5 makefile.vc and adapting it for itk.

AndyA added on 2016-08-09 16:04:47:

As mentioned above, we also moved to itcl 4.0.4 on Tcl and then built our own 4.0.5 to further reduce memory leaks.

We tried building itk 4.0.2; went OK on Linux, not OK on Windows (from the many errors, maybe it has never built on Windows at all?)

To me the workarounds don't look applicable to Itk 4.0.2, possibly to an earlier version.

dgp added on 2016-06-20 21:54:11:
Any more info coming on this?

dgp added on 2016-04-12 12:40:53:
Things appear to be working for me:

$ tclsh
% package require Iwidgets
4.0.1
% package present Itk
4.0.2
% package present Itcl
4.0.4
% package present Tk
8.6.5
% package present Tcl
8.6.5
% pack [iwidgets::dateentry .d]
% pack [iwidgets::combobox .c]

The widgets are displayed.  No error messages.

I believe this is with the releases from

https://sourceforge.net/projects/incrtcl/files/%5Bincr%20Tcl_Tk%5D-4-source/itcl%204.0.4/

https://sourceforge.net/projects/incrtcl/files/%5Bincr%20Tcl_Tk%5D-4-source/itk%204.0.2/

https://sourceforge.net/projects/incrtcl/files/%5BIncr%20Widgets%5D/4.0.1/

dgp added on 2016-04-11 15:53:08:
Please submit a script demonstrating the problem
explicitly.  This can only be addressed if it can
be reproduced.

Don't assume the remaining redoubt of Itcl
maintainers are Iwidget/Itk users. We're not.
I'm not even an Itcl user.

Attachments: