windows-subsystem-for-linuxwt

How to install and use Wt (web GUI library) in WSL


I'm using WSL2 (Debian) on Windows 10.

How can I install and use Wt library?

When I try to use the recommended command on the Wt website

$ sudo apt-get install witty witty-dev witty-doc witty-dbg witty-examples

I get this:

E: Unable to locate package witty
E: Unable to locate package witty-dev
E: Unable to locate package witty-doc
E: Unable to locate package witty-dbg
E: Unable to locate package witty-examples

Solution

  • Downloads

    Required Packages

    $ sudo apt -y install g++ cmake
    

    Install Boost Library

    $ tar xvfz boost_1_75_0.tar.gz
    $ cd boost_1_75_0
    $ ./bootstrap.sh
    $ sudo ./b2 install
    

    The header files and the libraries are in /usr/local/include/boost and /usr/local/lib, respectively.

    $ sudo ldconfig /usr/local/lib    # Update ldconfig cache
    

    Install Wt Library

    $ tar xvfz wt-4.5.0.tar.gz
    $ cd wt-4.5.0
    $ mkdir build
    $ cd build
    $ cmake ../
    $ make
    $ sudo make install
    $ make -C examples   # optional
    

    Try It

    (examples required)

    $ cd examples/hello/
    $ ln -s ../../../resources/
    $ ./hello.wt --docroot . --http-listen 0.0.0.0:8080
    

    Open the browser and browse to http://127.0.0.1:8080/ .