Categories
Windows

Building h2load on Cygwin.

同一記事の日本語版
Update information      Edit(2016.Jan.4)   Edit2(Feb.7)   Edit3(Jun.18)

   Actually, Cygwin has libev and nghttp2 packages now. So, you can use h2load feature even if you don’t build nghttp2 by yourself. Nevertheless, if you build nghttp2 on Cygwin, you need to build the Jansson and the spdylay before building it because Cygwin doesn’t have their packages. But, according to the current trend, I think you don’t need the spdylay package. (2016.6.18)
—————————————————————————————————————————————————
   Now, I have two zip files. One is H2LOAD_dll_package_x86.zip, another is H2LOAD_dll_package_x64.zip. If you download one of them, you can do the test by h2load on your Windows PC. Run cmd.exe and do like this.
> h2load -n100000 -c100 -m10 https://localhost
   If you do this test, you should create your own local server. Because the test might be a cyber attack for the server if you set numbers too high as values of -n -c -m. Be careful.
   I wrote like this before:‘I don’t know why, but it looks like telling Apache without HTTP/2 is faster. Gee!’. This time, I had interesting results. See HTTPS with HTTP/2 and HTTPS without HTTP/2. The test tells that the server supports HTTP/2 is good at dealing with concurrent streams than the server doesn’t support HTTP/2. This is one of HTTP/2 features.

   I’ll write about my hard work to get these files (^_^;).
   [Caution]: The steps blow give the files contained by H2LOAD_dll_package_x64.zip. If you want to have the files for x86 PC, you have to do all steps by setup-x86.exe on a Windows x86 PC.

    [1. installing Cygwin]

  1. Download setup-x86_64.exe (or setup-x86.exe) from Cygwin. In my case, I install it on Windows10 x64, so I need setup-x86_64.exe.
  2. Download pubring.asc and setup-x86_64.exe.sig (or setup-x86.exe.sig) from Installing and Updating Cygwin Packages.
    Run cmd.exe as administrator and verify exe’s signature. To verify signatures is included in routine on Linux as you know. Although I usually don’t write about it, I do this to other software on Windows, for example Apache, MariaDB, and so on. You can have GnuPG modern from GnuPG binary releases.
    > pushd x:Cygwin
    >gpg --import pubring.asc
    gpg: key 676041BA: public key "Cygwin <cygwin@cygwin.com>" imported
    gpg: Total number processed: 1
    gpg: imported: 1
    >gpg --verify setup-x86_64.exe.sig
    gpg: assuming signed data in 'setup-x86_64.exe'
    gpg: Signature made 10/19/15 04:38:02 東京 (標準時) using DSA key ID 676041BA
    gpg: Good signature from "Cygwin <cygwin@cygwin.com>" [unknown]
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg: There is no indication that the signature belongs to the owner.
    Primary key fingerprint: 1169 DF9F 2273 4F74 3AA5 9232 A9A2 62FF 6760 41BA
    I have WARNING because I skipped for trusting signature step. But I just want to see Good signature and Primary key fingerprint. So, no problem.
  3. Run setup-x86_64.exe and install Cygwin. You can click ‘Next’s simply except the below. I selected a mirror in Japan because I live in Japan (^o^). You’d better select A mirror near your residence.
    I need wget. Re-run setup-x86_64.exe and install wget.
    Close setup-x86_64.exe.
  4. Click Cygwin64 Terminal icon and make Download and Source directories.
    $ pwd ☜ Checking Current position.
    /home/UserID
    $ mkdir Download☜ For my download files.
    $ mkdir Source☜ For my source files.
  5. Installing apt-cyg for my convenience.
    $ pwd
    /home/UserID
    $ cd Download
    $ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
    $ install apt-cyg /usr/local/bin
    Installing apt-cyg completed.
    Updating Cygwin from ftp://ftp.jaist.ac.jp. ☜ The mirror I selected.
    $ apt-cyg -m ftp://ftp.jaist.ac.jp/pub/cygwin/ update
    [2. compiling and installing libev]

  1. According to Notes for building on Windows (Mingw/Cygwin), I need the libev. Before compiling libev, I installed following packages. Click Cygwin64 Terminal icon.
    $ apt-cyg install autoconf automake make libtool gcc-core gcc-g++
  2. Actually, I downloaded and extracted libev’s tarball and did compiling and installing successfully. However, I couldn’t have DLL files by it and couldn’t solve this problem because I’m very newbie about Cygwin. So I looked for another way. Finally, I found fd00’s repositories on GitHub like the links below. He made repositories about Cygwin not having packages that we need to build h2load, which are very helpful for me. His way uses cygport. Thanks a lot, fd00.
      About ‘libev’ ☞ https://github.com/fd00/yacp/tree/master/libev
      About ‘Jansson’ ☞ https://github.com/fd00/yacp/tree/master/jansson
      About ‘spdylay’https://github.com/fd00/yacp/tree/master/spdylay
      About ‘nghttp2’ ☞ https://github.com/fd00/yacp/tree/master/nghttp2
    The package ‘nghttp2’ includes h2load of course.

    1. Compiling libev.
      $ apt-cyg install cygport
      $ cd /usr/src
      $ wget http://dist.schmorp.de/libev/libev-4.20.tar.gz
      $ wget https://github.com/fd00/yacp/raw/master/libev/libev-4.20-1bl1.cygport
      $ wget https://github.com/fd00/yacp/raw/master/libev/libev-4.20-1bl1.src.patch
      $ cygport ./libev-4.20-1bl1.cygport all
      Although I don’t know why, PATCH_URI of the cygport file couldn’t work well. So I downloaded it manually.
      $ wget https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libev/files/libev-pc.patch
      Again.
      $ cygport ./libev-4.20-1bl1.cygport all
    2. Installing libev.
      Cygport gives a full binary package of libev. So I wanted to make a local repository for my own. I tried.
      $ cd ~Download
      $ wget https://sourceware.org/viewvc/cygwin-apps/genini/genini?revision=1.16&view=co
      $ mv genini@revision=1.16 genini
      $ install genini /usr/local/bin

      $ cd /usr/src/libev-4.20-1bl1.x86_64/dist
      $ cp -R libev /cygdrive/x/Apache24/htdocs/cygwin/x86_64/release
      $ cd /cygdrive/x/Apache24/htdocs/cygwin
      $ genini --recursive x86_64 | bzip2 -c > x86_64/setup.bz2
      The Apache above is my test server.
      I ran setup-x86_64.exe with ‘-X (= --no-verify)’ option. But, I couldn’t use my local repo. Is this related to ‘Error Installing Cygwin (setup-x86_64.exe & setup-x86) – No setup.ini.sig found.’? I used Achim Gratz’s local version, but nothing good was brought.

      I’ve not solved this yet. So I installed the following files manually. Oops!
      $ install /usr/src/libev-4.20-1bl1.x86_64/inst/usr/bin/cygev-4.dll /usr/bin
      $ mkdir /usr/include/libev
      $ install /usr/src/libev-4.20-1bl1.x86_64/inst/usr/include/libev/ev* /usr/include/libev
         (ev* = ev.h ev++.h event.h)
      $ install /usr/src/libev-4.20-1bl1.x86_64/inst/usr/lib/libev.dll.a /usr/lib
      $ install /usr/src/libev-4.20-1bl1.x86_64/inst/usr/lib/pkgconfig/libev.pc /usr/lib/pkgconfig
      $ install /usr/src/libev-4.20-1bl1.x86_64/inst/usr/share/man/man3/ev.3.gz /usr/share/man/man3

    [3. compiling and installing Jansson]

  1. Compiling Jansson.
    1. $ apt-cyg install cmake
    2. $ cd /usr/src
      $ wget http://www.digip.org/jansson/releases/jansson-2.7.tar.bz2
      $ wget https://github.com/fd00/yacp/raw/master/jansson/jansson-2.7-1bl1.cygport
      $ wget https://github.com/fd00/yacp/raw/master/jansson/jansson-2.7-1bl1.src.patch
    3. $ cygport ./jansson-2.7-1bl1.cygport all
  2. Installing Jansson.
    1. As above, I’ve not solved the problem yet. So I installed them manually. Oops!
      $ install /usr/src/jansson-2.7-1bl1.x86_64/inst/usr/bin/cygjansson-4.dll /usr/bin
      $ install /usr/src/jansson-2.7-1bl1.x86_64/inst/usr/include/ja* /usr/include
         (ja* = jansson.h jansson_config.h)
      $ install /usr/src/jansson-2.7-1bl1.x86_64/inst/usr/lib/libjansson.dll.a /usr/lib
      $ install /usr/src/jansson-2.7-1bl1.x86_64/inst/usr/lib/pkgconfig/jansson.pc /usr/lib/pkgconfig
    [4. compiling and installing spdylay]

  1. Compiling spdylay.
    1. $ apt-cyg install libxml2-devel CUnit
      As I couldn’t install libevent and libevent-devel by apt-cyg, did them by setup-x86_64.exe.
      Install all OpeSSL related packages by setup-x86_64.exe.
    2. $ cd /usr/src
      $ wget https://github.com/tatsuhiro-t/spdylay/releases/download/v1.3.2/spdylay-1.3.2.tar.xz
      $ wget https://github.com/fd00/yacp/raw/master/spdylay/spdylay-1.3.2-1bl1.cygport
      $ wget https://github.com/fd00/yacp/raw/master/spdylay/spdylay-1.3.2-1bl1.src.patch
    3. $ cygport ./spdylay-1.3.2-1bl1.cygport all
      I forgot to install pkg-config. I knew about it by its requirements. Then, I have an error like below.
      ./configure: line xxxxx: syntax error near unexpected token `0.20′
      ./configure: line xxxxx: `PKG_PROG_PKG_CONFIG(0.20)’

           ☞ Ref_URL: spdylay/issues/16
      $ apt-cyg install pkg-config
    4. $ cygport ./spdylay-1.3.2-1bl1.cygport all again.
  2. Installing spdylay.
    1. As above, I’ve not solved the problem yet. So I installed them manually. Oops!
      $ install /usr/src/spdylay-1.3.2-1bl1.x86_64/inst/usr/bin/*.exe /usr/bin
         (*.exe = shrpx.exe spdycat.exe)
      $ install /usr/src/spdylay-1.3.2-1bl1.x86_64/inst/usr/bin/cygspdylay-7.dll /usr/bin
      $ mkdir /usr/include/spdylay
      $ install /usr/src/spdylay-1.3.2-1bl1.x86_64/inst/usr/include/spdylay/spd* /usr/include/spdylay
         (spd* = spdylay.h spdylayver.h)
      $ install /usr/src/spdylay-1.3.2-1bl1.x86_64/inst/usr/lib/libspdylay.dll.a /usr/lib
      $ install /usr/src/spdylay-1.3.2-1bl1.x86_64/inst/usr/lib/pkgconfig/libspdylay.pc /usr/lib/pkgconfig
    [5. compiling and installing nghttp2]

  1. Compiling nghttp2.
    1. $ cd /usr/src
      $ wget https://github.com/tatsuhiro-t/nghttp2/releases/download/v1.4.0/nghttp2-1.4.0.tar.xz
      $ wget https://github.com/fd00/yacp/raw/master/nghttp2/nghttp2-1.4.0-1bl1.cygport
      $ wget https://github.com/fd00/yacp/raw/master/nghttp2/nghttp2-1.4.0-1bl1.src.patch
    2. $ cygport ./nghttp2-1.4.0-1bl1.cygport all
  2. Installing nghttp2.
    1. As above, I’ve not solved the problem yet. So I installed them manually. Oops!
      $ install /usr/src/nghttp2-1.4.0-1bl1.x86_64/inst/usr/bin/* /usr/bin
         (* =cygnghttp2-14.dll deflatehd.exe h2load.exe inflatehd.exe nghttp.exe nghttpd.exe nghttpx.exe)
      $ mkdir /usr/include/nghttp2
      $ install /usr/src/nghttp2-1.4.0-1bl1.x86_64/inst/usr/include/nghttp2/*.h /usr/include/nghttp2
         (*.h = nghttp2.h nghttp2ver.h)
      $ install /usr/src/nghttp2-1.4.0-1bl1.x86_64/inst/usr/lib/libnghttp2.dll.a /usr/lib
      $ install /usr/src/nghttp2-1.4.0-1bl1.x86_64/inst/usr/lib/pkgconfig/* /usr/lib/pkgconfig

TO-DO: To access my own Cygwin repo by setup-x86_64.exe.

Edit(2016.Jan.4):
   I re-built h2load.exe with libev-4.22.tar.gz and nghttp2-1.6.0.

Leave a Reply

Your email address will not be published. Required fields are marked *