TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
545 stars 115 forks source link

hammerdbcli: can't find package ticklecharts #624

Closed josephcolton closed 9 months ago

josephcolton commented 9 months ago

Describe the bug When starting hammerdbcli, I am presented with the following error message:

HammerDB CLI v4.9 Copyright (C) 2003-2023 Steve Shaw Type "help" for a list of commands While loading module "ticklecharts"... can't find package ticklecharts while executing "package require $m "

I was able to edit the hammerdbcli file and remove the ticklecharts from the module list on line 82 to make it work.

To Reproduce On a Ubuntu 22.04 system:

git clone https://github.com/TPC-Council/HammerDB.git sudo apt -y install wish tclsh sudo apt-get install -y tcl-thread libsqlite3-tcl tcl-expect mysqltcl cd HammerDB mkdir bin; cd bin; ln -s /usr/bin/tclsh8.6; cd .. ./hammerdbcli

Expected behavior I expected to run.

HammerDB Version (please complete the following information):

HammerDB Interface (please complete the following information):

Operating System (please complete the following information):

Database Server (please complete the following information):

sm-shaw commented 9 months ago

OK, great to see you jump in to use HammerDB v4.9 before the binary release, however this is not a bug, it is because you have not followed the correct steps to build HammerDB from source to populate the bin and lib directories.

It's in the documentation but let's go over it here as well, in case anyone sees the same specific error and comes here for the answer.

In the following example, you can either clone as you have done, or in my case I have downloaded and unzipped the zip file from the new HammerDB v4.9 tag. Make sure you have a gcc build environment installed.

You can see that if I just unzip HammerDB and try to run it, firstly tclsh is not found and then if I run it with the system installed tclsh i get the same error as you. Note in the directory listing there is no bin and lib directory, so we can't run HammerDB this way. The HammerDB build is a bit more sophisticated.

$ unzip HammerDB-4.9.zip
...
$ cd HammerDB-4.9
$ ls
agent               config           hammerdb hammerdbws      modules
Build               CONTRIBUTING.md  hammerdb.bat hammerdbws.bat  README.md
ChangeLog           DocBook          hammerdbcli images          scripts
CODE_OF_CONDUCT.md  Docker           hammerdbcli.bat LICENSE         src
$ ./hammerdbcli
./hammerdbcli: 10: exec: ./bin/tclsh8.6: not found
$ tclsh ./hammerdbcli
HammerDB CLI v4.9
Copyright (C) 2003-2023 Steve Shaw
Type "help" for a list of commands
While loading module "ticklecharts"...
can't find package ticklecharts
    while executing
"package require $m "

So what we need to do firstly is build HammerDB, which is all automated with a single Build command. In my example, I have unzipped into the /opt directory. You then need to change into the Build/Bawt-2.1.0 directory to do the build. As an extra step, you mention only MySQL, so if you want a custom build then firstly change to:

/opt/HammerDB-4.9/Build/Bawt-2.1.0/Setup

Then edit the HammerDB-Linux.bawt (of course Windows users can edit the Windows one)

$vi HammerDB-Linux.bawt

In this example, we comment out all the databases except MySQL.

# Builds Tcl, Tk, Starkit and Tcl/Tk packages, which do not depend on 3rd party libraries.
# On Windows all libraries can be compiled with MSys/MinGW.

# Setup LibName         ZipFile BuildFile           BuildOptions

# Tcl/Tk, stubs and manual.
Setup Tcl               Tcl-[GetTclVersion].7z         Tcl.bawt
Setup Tk                Tk-[GetTkVersion].7z           Tk.bawt
# Compiled Tcl packages.
Setup expect            expect-5.45.4.7z               expect.bawt
Setup libressl          libressl-2.6.4.7z libressl.bawt
Setup tcltls            tcltls-1.7.22.7z               tcltls.bawt
Setup tksvg             tksvg-0.5.7z                   tksvg.bawt
Setup tkblt             tkblt-3.2.23.7z                tkblt.bawt
Setup tclpy             tclpy-0.4.7z                   tclpy.bawt
Setup tkpath            tkpath-0.3.3.7z                tkpath.bawt
# Compiled Tcl Database interface packages.
#Setup oratcl            oratcl-4.6.7z oratcl.bawt
#Setup mariatcl          mariatcl-0.1.7z mariatcl.bawt
Setup mysqltcl          mysqltcl-3.052.7z mysqltcl.bawt
#Setup db2tcl            db2tcl-2.0.1.7z db2tcl.bawt
#Setup pgtcl             pgtcl-2.1.1.7z pgtcl.bawt
# Pure Tcl/Tk packages.
Setup awthemes          awthemes-9.3.1.7z awthemes.bawt
Setup clearlooks        clearlooks-1.0.7z clearlooks.bawt
Setup redis             redis-0.1.7z                   redis.bawt
Setup ticklecharts      ticklecharts-3.1.7z ticklecharts.bawt

Once saved we change back to the Bawt directory.

/opt/HammerDB-4.9/Build/Bawt-2.1.0

And then export the location of the MySQL config executable. Note that whatever MySQL location you give will then link the client library, so building from source is a great way to build a bespoke version. By default, we build for a MySQL 8.0 client but if you want an 8.1 library (or 5.7) then you can do that instead. Note this is just the client library HammerDB needs in its PATH when it runs, it can test any version using this client.

export MYSQL_CONFIG=/opt/mysql-8.0.20-linux-glibc2.12-x86_64/bin

Now run the Build command, the Build will tell you where you created your distribution: (Windows users note that Windows defender virus scan makes the build a lot slower as each downloaded file is scanned, so you can either wait or temporarily disable the virus scan for a faster build)

Also, you can see that the Build process pulls the necessary files from hammerdb.com - in relation to the error you saw, this is where ticklecharts is pulled from.

./Build-Linux.sh x64 Setup/HammerDB-Linux.bawt update
...
10:30:11 > Creating Distribution tar.gz in /opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Distribution
10:30:11 >   TarGzip
               Source directory: /opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Distribution/HammerDB-4.9
               Tar file        : /opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Distribution/HammerDB-4.9-Linux.tar.gz
10:30:12 > End FinalizeStage

10:30:12 > Summary
           Setup file     : /opt/HammerDB-4.9/Build/Bawt-2.1.0/Setup/HammerDB-Linux.bawt
           Build directory: /opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Build
           Architecture   : x64
           Compilers      : gcc
           Global stages  : Finalize
           #  : Library Name         Version    Build time Stages
----------------------------------------------------------------------
             1: Tcl                  8.6.12     1.62 minutes Clean Extract Configure Compile Distribute
             2: Tk                   8.6.12     0.39 minutes Clean Extract Configure Compile Distribute
             3: awthemes             9.3.1      0.00 minutes Clean Extract Configure Compile Distribute
             4: clearlooks           1.0        0.00 minutes Clean Extract Configure Compile Distribute
             5: expect               5.45.4     0.13 minutes Clean Extract Configure Compile Distribute
             6: libressl             2.6.4      1.04 minutes Clean Extract Configure Compile Distribute
             7: mysqltcl             3.052      0.04 minutes Clean Extract Configure Compile Distribute
             8: redis                0.1        0.00 minutes Clean Extract Configure Compile Distribute
             9: tclpy                0.4        0.01 minutes Clean Extract Configure Compile Distribute
            10: tcltls               1.7.22     0.18 minutes Clean Extract Configure Compile Distribute
            11: ticklecharts         3.1        0.00 minutes Clean Extract Configure Compile Distribute
            12: tkblt                3.2.23     0.22 minutes Clean Extract Configure Compile Distribute
            13: tkpath               0.3.3      0.12 minutes Clean Extract Configure Compile Distribute
            14: tksvg                0.5        0.05 minutes Clean Extract Configure Compile Distribute
----------------------------------------------------------------------
           Total: 3.83 minutes

If we now change to the Distribution location you can see your HammerDB build and a tar.gz of the build.

/opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Distribution$ ls
HammerDB-4.9  HammerDB-4.9-Linux.tar.gz

Run HammerDB from the Distribution location (note the difference that we now have a bin and lib directory) or copy the tar.gz elsewhere and you can see that everything works as intended now:

/opt/HammerDB-4.9/Build/BawtBuild/Linux/x64/Release/Distribution/HammerDB-4.9$ ./hammerdbcli
HammerDB CLI v4.9
Copyright (C) 2003-2023 Steve Shaw
Type "help" for a list of commands
Initialized new Jobs on-disk database /tmp/hammer.DB
hammerdb>

Obviously we created a bespoke version that only works for MySQL, the other database libraries were not built and will not be in the lib directory so with this example we can only test MySQL. For the other databases the error is "can't find package" which is because we didn't build it.

hammerdb>librarycheck
Checking database library for Oracle
Error: failed to load Oratcl - can't find package Oratcl
Ensure that Oracle client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MSSQLServer
Success ... loaded library tdbc::odbc for MSSQLServer
Checking database library for Db2
Error: failed to load db2tcl - can't find package db2tcl
Ensure that Db2 client libraries are installed and the location in the LD_LIBRARY_PATH environment variable

Checking database library for MySQL
Success ... loaded library mysqltcl for MySQL

Checking database library for PostgreSQL
Error: failed to load Pgtcl - can't find package Pgtcl
Ensure that PostgreSQL client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MariaDB
Error: failed to load mariatcl - can't find package mariatcl
Ensure that MariaDB client libraries are installed and the location in the LD_LIBRARY_PATH environment variable

The official release builds from GitHub are obviously built to support all the databases and for v4.9 will be made available once the TPC-Council approve the release.

sm-shaw commented 9 months ago

Closed as not a bug. v4.9 is now available as a pre-built binary.