http://qs321.pair.com?node_id=1233609

freedee15 has asked for the wisdom of the Perl Monks concerning the following question:

Hi! I'm relatively new to Perl and have been having some trouble installing Tkx properly. Whenever the maketest is run, I get the error 'failed dlopen(C:/ActiveTcl/bin/tcl86t.dll,...);' (I've made sure ActiveTcl is installed properly and in the right place, and the file in question is where it should be). I've scoured the internet looking for answers to how to fix this, but I haven't been able to find anyone with the same problem. Can anyone help? (full error message below)

Running make test C:\Dwimperl\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_har +ness(0, 'blib\lib', 'blib\arch')" t/*.t t/LabEntry.t ...... failed dlopen(C:/ActiveTcl/bin/tcl86t.dll,...); failed dlopen(C:/ActiveTcl/bin/tcl86t.dll,...); failed dlopen(tcl86t.dll,...); trying dlopen(tcl89t.dll,...) trying dlopen(tcl88t.dll,...) trying dlopen(tcl87t.dll,...) trying dlopen(tcl86t.dll,...) trying dlopen(tcl85t.dll,...) trying dlopen(tcl84t.dll,...) trying dlopen(tcl83t.dll,...) trying dlopen(tcl82t.dll,...) trying dlopen(tcl81t.dll,...) trying dlopen(tcl80t.dll,...) failed all posible tcl vers 8.x from 9 down to 0 at C:/Dwimperl/perl/l +ib/XSLoader.pm line 95. Failed to load Tcl dll! at C:/Dwimperl/perl/lib/XSLoader.pm line 95. Unable to initialize Tcl at C:/Dwimperl/perl/lib/XSLoader.pm line 95. Compilation failed in require at C:\Dwimperl\cpan\build\Tkx-1.09-NoNmn +z\blib\lib/Tkx.pm line 215. BEGIN failed--compilation aborted at C:\Dwimperl\cpan\build\Tkx-1.09-N +oNmnz\blib\lib/Tkx.pm line 215. Compilation failed in require at t/LabEntry.t line 8. BEGIN failed--compilation aborted at t/LabEntry.t line 8.

Replies are listed 'Best First'.
Re: Tkx not installing properly
by syphilis (Archbishop) on May 13, 2019 at 01:25 UTC
    Hi,

    I believe the failure is happening in the XSLoader::dl_load_file() call.
    If C:/ActiveTcl/bin/tcl86t.dll exists, then I'd be thinking it's not a valid dll.
    Perhaps it's a 32-bit dll when a 64-bit dll is required (or vice-versa) ?

    It's also worth reading the comments in XSLoader.pm relating to dl_load_file failures:
    # Many dynamic extension loading problems will appear to come from # this section of code: XYZ failed at line 123 of DynaLoader.pm. # Often these errors are actually occurring in the initialisation # C code of the extension XS file. Perl reports the error as being # in this perl code simply because this was the last perl code # it executed. my $libref = dl_load_file($file, 0) or do { require Carp; Carp::croak("Can't load '$file' for module $module: " . dl_error()); };
    What's your perl -V output ?

    Cheers,
    Rob

      The available releases of ActiveTcl 8.6 Community Edition for Windows are all 64-bit, while DWIM Perl for Windows is 32-bit. So I think you're right that this issue is due to a bitness mismatch, and a 64-bit Perl distribution (e.g. Strawberry or ActivePerl) would be needed instead.

        correct
        BTW I experienced some another problem on Windows 7 with 32bit ActiveTcl, so it took me some effort but then I switched to http://www.bawt.tcl3d.org/download.html#tclbi which then solved all my problems, there are 32 and 64 bit versions, with lots of modules included

        I found this binary while searching in Tclers wiki at http://wiki.tcl-lang.org/page/BAWT, which is also recommended resource for seekers of perl/Tk wisdom :)

        Going to write about this to Jeff Hobbs, who should be aware of such problems in ActiveTCL

        regards, Vadim

Re: Tkx not installing properly
by chrstphrchvz (Scribe) on May 12, 2019 at 06:28 UTC

    I want to quickly point out that this could be an issue between ActiveTcl and Tcl.pm (which is where the failed dlopen(…) message comes from), rather than Tkx specifically.

    (I might follow up later if I have more info, because I may have encountered this issue myself recently, but did not investigate it much before trying MagicSplat instead. Edit: My issue was something much different: bad default values in tclConfig.sh in both ActiveTcl and MagicSplat—not a 32/64-bit mismatch.)

      Really, all I'm looking to do is to be able to use Ttk modules as opposed to Tk modules in Perl. Is there any easier way to do that?

        You can use Ttk widgets from any Tcl/Tk wrappers: Tkx, Tcl::Tk, Tcl::pTk, and even Tcl.pm by itself (disclosure: I now maintain Tcl::pTk and Tkx).

Re: Tkx not installing properly
by vkon (Curate) on May 13, 2019 at 06:59 UTC
    to summarize:
    1. probably this is 32/64 bit not linking together;
    2. but you better switch to BAWT binaries of tcl/tk, which is alternative to ActiveTCL
    3. also Tkx is not recommended, because its syntax too much noisy and requires full rewrite.
    4. suggested by chrstphrchvz Tcl::pTk is probably most easy transition, and probably the best advice in your particular case
    5. another way is to use Tcl::Tk which is small sufficient and gives you perl/Tk syntax, but requires more changes to your already existing perlTk code
Re: Tkx not installing properly
by IB2017 (Pilgrim) on May 13, 2019 at 14:18 UTC
    I work on Windows using latest ActiveTcl (only 64 bit available), Tcl::pTk (to have access to Tk from Perl), and Strawberry Perl (64bit). The combination works fine. Just be sure to have Perl 64 bit installed, then install Tcl::pTk (this will install also Tcl.pm which is the linking part between Perl and Tk). The advantage of Tcl::pTk over Tkx is that is actively maintained, as is Tcl/Tk.