ActiveState Community

Cannot include the package Img into a starpack with TclApp

Posted by relaxmike on 2008-02-24 13:39

Hi,

I tried to create a Starpack for a software that required
the package Img, version 1.3. I was unable to include
that particular package and to make it available from
my app. To fix the problem I had to fix the img.tap
file of the Img package, which seems strange to me.

My work is based on ActiveTcl 8.4.16 and TclDevKit 4.0.2.
I want to release that script into 2 different starpacks :
- one version for Windows,
- one version for Linux,
and more versions for more platforms in the coming months.
Since the package Img includes binaries, I have to make
something special to make the executable for different
platforms.
So I created the following directory structure, to store the various
packages of the soft, for the target platforms :

./bin
./bin/win32-ix86
./bin/win32-ix86/Img1.3
./bin/win32-ix86/Img1.3/img.tap
./bin/win32-ix86/Img1.3/jpegtcl10.dll
./bin/win32-ix86/Img1.3/pkgIndex.tcl
./bin/win32-ix86/Img1.3/pngtcl126.dll
./bin/win32-ix86/Img1.3/tifftcl361.dll
./bin/win32-ix86/Img1.3/tkimg13.dll
./bin/win32-ix86/Img1.3/tkimgbmp13.dll
./bin/win32-ix86/Img1.3/tkimggif13.dll
./bin/win32-ix86/Img1.3/tkimgico13.dll
./bin/win32-ix86/Img1.3/tkimgjpeg13.dll
./bin/win32-ix86/Img1.3/tkimgpcx13.dll
./bin/win32-ix86/Img1.3/tkimgpixmap13.dll
./bin/win32-ix86/Img1.3/tkimgpng13.dll
./bin/win32-ix86/Img1.3/tkimgppm13.dll
./bin/win32-ix86/Img1.3/tkimgps13.dll
./bin/win32-ix86/Img1.3/tkimgsgi13.dll
./bin/win32-ix86/Img1.3/tkimgsun13.dll
./bin/win32-ix86/Img1.3/tkimgtga13.dll
./bin/win32-ix86/Img1.3/tkimgtiff13.dll
./bin/win32-ix86/Img1.3/tkimgwindow13.dll
./bin/win32-ix86/Img1.3/tkimgxbm13.dll
./bin/win32-ix86/Img1.3/tkimgxpm13.dll
./bin/win32-ix86/Img1.3/zlibtcl123.dll
./bin/win32-ix86/prefix
./bin/win32-ix86/prefix/base-tk-thread-win32-ix86.exe

The following script make the problem appear :

main.tcl :
+++++++++++++++++++++++++++
package require Tcl
package require Tk

package require Img 1.3

label .coucou -text "Coucou"
button .quit -text "Quit" -command [list exit]
pack .coucou
pack .quit
+++++++++++++++++++++++++++

I then execute the following command, with the -archive
option to indicate the path to my local copy of the Img
package for win32 and the -pkgref option to require the
Img package.

exec {C:\TclDevKit4.0.2\bin\tclapp.exe} \
-out test.exe \
-prefix {D:\Atelier\Atelier Tcl\testTclApp\bin\win32-ix86\prefix\base-tk-thread-win32-ix86.exe} \
-verbose \
-architecture win32-ix86 \
-startup lib/application/main.tcl \
-pkgref {Tcl 8.4} \
-pkgref {Tk 8.4} \
-pkgref Img \
-architecture win32-ix86 \
-archive {D:\Atelier\Atelier Tcl\testTclApp\bin\win32-ix86\Img1.3} \
main.tcl

The following log is generated by TclApp :

info | Tcl Dev Kit TclApp
info | Copyright (C) 2001-2008 ActiveState Software Inc. All rights reserved.
info | Standard license for Micha�l Baudin .
info |
info | Embedding license information into wrap result as comments.
info |
notice No known repository at C:/tap_help_repository
notice No known repository at D:/Atelier/ActiveTcl8.4.16/linux-ix86/tbcload1.7
info Expanding...
info Following only profile dependencies
info P package Tcl 8.4 win32-ix86 ...
info P package Tk 8.4 tcl ...
info P package Tk 8.4 win32-ix86 ...
info
info Issues...
info
notice Packages ...
notice P Tcl 8.4 win32-ix86 @
notice P Tk 8.4 tcl @
notice P Tk 8.4 win32-ix86 @
notice Img 1.3 win32-ix86 @ R tap (D:\Atelier\Atelier Tcl\testTclApp\bin\win32-ix86\Img1.3)
info
info Inserting TEApot metadata
info Nothing to insert
info
info Wrapping package(s):
info Img 1.3 (win32-ix86)
info Tcl Module
info Copying as is
info Generating package index
info Ok.
info
notice Extending the list of provided packages
info
info Wrapping file(s):
info Into: lib/application
info
info main.tcl D:/Atelier/Atelier Tcl/testTclApp/requireImg/main.tcl
info
info
info Generated test.exe

What is intriguing is the message :

info Img 1.3 (win32-ix86)
info Tcl Module
info Copying as is
info Generating package index
info Ok.

but why not.

When I execute test.exe, the following message appears :

attempt to provide package Img 1.3 failed: no version of package Img provided.
("package ifneeded" script)
invoked from within
"package require Img 1.3"

When I look into the executable with VFS Explorer, things are getting
clearer, that is to say that almost all files from the Img
package have been ignored :

test.exe/lib
test.exe/lib/P-win32-ix86-Img-1.3
test.exe/lib/P-win32-ix86-Img-1.3/implementation.tcl
test.exe/lib/P-win32-ix86-Img-1.3/pkgIndex.tcl

It is clear for me that the packing of the package Img was
not successfull, since the content of the package is not there, at all !
This is the content of implementation.tcl :

implementation.tcl :
++++++++++++++++++++++++++++++++++
# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*-
# -- Tcl Module
# -- Profile

# ACTIVESTATE TEAPOT-PKG END TM
++++++++++++++++++++++++++++++++++

This file has probably been automatically generated by
TclApp on the base on the ./bin/win32-ix86/Img1.3/img.tap
file, which may be wrong. I looked at it, but I did not
find any mistake :

./bin/win32-ix86/Img1.3/img.tap :
+++++++++++++++++++++++++++++++++++
format {TclDevKit Project File}
fmtver 2.0
fmttool {TclDevKit TclApp PackageDefinition} 4.0

## Saved at : Fri Sep 21 22:03:37 PDT 2007
## By : andreask@casablanca
##
## Generated by TclApp -scan

########
#####
###
##
#

Package {__img 1.3}
Base @TAP_DIR@
Desc {Internal package, file list}
Hidden {}
Path jpegtcl10.dll
Path pkgIndex.tcl
Path pngtcl126.dll
Path tifftcl361.dll
Path tkimg13.dll
Path tkimgbmp13.dll
Path tkimggif13.dll
Path tkimgico13.dll
Path tkimgjpeg13.dll
Path tkimgpcx13.dll
Path tkimgpixmap13.dll
Path tkimgpng13.dll
Path tkimgppm13.dll
Path tkimgps13.dll
Path tkimgsgi13.dll
Path tkimgsun13.dll
Path tkimgtga13.dll
Path tkimgtiff13.dll
Path tkimgwindow13.dll
Path tkimgxbm13.dll
Path tkimgxpm13.dll
Path zlibtcl123.dll
Package {Img 1.3}
Platform win32-ix86
See __img
Package {img::base 1.3}
Platform win32-ix86
See __img
Package {img::bmp 1.3}
Platform win32-ix86
See __img
Package {img::gif 1.3}
Platform win32-ix86
See __img
Package {img::ico 1.3}
Platform win32-ix86
See __img
Package {img::jpeg 1.3}
Platform win32-ix86
See __img
Package {img::pcx 1.3}
Platform win32-ix86
See __img
Package {img::pixmap 1.3}
Platform win32-ix86
See __img
Package {img::png 1.3}
Platform win32-ix86
See __img
Package {img::ppm 1.3}
Platform win32-ix86
See __img
Package {img::ps 1.3}
Platform win32-ix86
See __img
Package {img::sgi 1.3}
Platform win32-ix86
See __img
Package {img::sun 1.3}
Platform win32-ix86
See __img
Package {img::tga 1.3}
Platform win32-ix86
See __img
Package {img::tiff 1.3}
Platform win32-ix86
See __img
Package {img::window 1.3}
Platform win32-ix86
See __img
Package {img::xbm 1.3}
Platform win32-ix86
See __img
Package {img::xpm 1.3}
Platform win32-ix86
See __img
Package {jpegtcl 1.0}
Platform win32-ix86
See __img
Package {pngtcl 1.2.6}
Platform win32-ix86
See __img
Package {tifftcl 3.6.1}
Platform win32-ix86
See __img
Package {zlibtcl 1.2.3}
Platform win32-ix86
See __img

#
##
###
#####
########
+++++++++++++++++++++++++++++++++++

I changed the content of the img.tap file to simplify it.
The modified content is :

img.tap :
+++++++++++++++++++++++++++++++++++
format {TclDevKit Project File}
fmtver 2.0
fmttool {TclDevKit TclApp PackageDefinition} 4.0

## Saved at : Sun Feb 24 16:28:19 CET 2008
## By : Administrateur@ordiportable

########
#####
###
##
#

Package {Img 1.3}
Base @TAP_DIR@
Path jpegtcl10.dll
Path pkgIndex.tcl
Path pngtcl126.dll
Path tifftcl361.dll
Path tkimg13.dll
Path tkimgbmp13.dll
Path tkimggif13.dll
Path tkimgico13.dll
Path tkimgjpeg13.dll
Path tkimgpcx13.dll
Path tkimgpixmap13.dll
Path tkimgpng13.dll
Path tkimgppm13.dll
Path tkimgps13.dll
Path tkimgsgi13.dll
Path tkimgsun13.dll
Path tkimgtga13.dll
Path tkimgtiff13.dll
Path tkimgwindow13.dll
Path tkimgxbm13.dll
Path tkimgxpm13.dll
Path zlibtcl123.dll

#
##
###
#####
########
+++++++++++++++++++++++++++++++++++

With that modified img.tap, I created the executable with the
same command as previously. This time, the VFS Explorer showed
me that the content of the lib/Img1.3 directory corresponds to the usual
one. The final executable runs fine, now.

It seems to me that there are different possible solutions to
these issues :
- I do not use TclApp with the right arguments and/or the fine
directory paths,
- when TclApp does not know how to include a package in the
starpack, it does not generate an error, but generates a
package directory which is not loadable,
- the Img package is not released with a img.tap consistent file.

Any help will be appreciated.

Best regards,

Michaël

AndreasK | Mon, 2008-02-25 13:24

Ok, let me try to explain what is happening.

First, if you set the environment variable TCLDEVKIT_LOCAL to point to the platform directory containing Img, TclApp will find the Img package, and through the regular TAP file processing wrap everything from that file (The 'See' references tell this part of TclApp that all the files are shared). That should allow you to use the unmodified Img tap file.

When you used '-archive' to specify the location you caused a different part of TclApp to handle the .tap file, a TAP/TEApot bridge which made the tap file look like a teapot repository. However you ran into a limitation of this bridge, where it did not process the file sharing information, so Img stood alone, without all the files for the other packages.

Now that I have seen how this can lead into trouble I would reclassify this limitation as a bug and would like to ask you to enter this in our bug tracker at http://bugs.activestate.com/ .

relaxmike | Fri, 2008-02-29 13:43

Many thanks !

I now understand these options more clearly.
I registered that problem as a bug in the bug tracker, as you
suggested.

Best regards,

Michaël