nghttp2 / nghttp2-asio

MIT License
63 stars 24 forks source link

Building on Windows from source code #20

Open djn3m0 opened 9 months ago

djn3m0 commented 9 months ago

Hello,

I'm trying to build nghttp2-asio from source code with visual studio 2022,

Project location :

C:\Users\user\Desktop>ls
nghttp2 nghttp2-asio

Environment variables :

C:\Users\user\Desktop>echo %OPENSSL_ROOT_DIR%
C:\openssl-3.2.0\Lib\x64\Debug\

C:\Users\user\Desktop>echo %OPENSSL_CRYPTO_LIBRARY%
C:\openssl-3.2.0\Lib\x64\Debug\lib

C:\Users\user\Desktop>echo %Boost_INCLUDE_DIR%
C:\boost\boost_1_84_0\boost

This is where Boost_INCLUDE_DIR is pointing to,

c:\Users\user\Desktop\nghttp2-asio\build>ls C:\boost\boost_1_84_0\boost
accumulators             container_hash                geometry                math                           predef                         static_assert.hpp
algorithm                context                       geometry.hpp            math_fwd.hpp                   predef.h                       static_string
align                    contract                      get_pointer.hpp         mem_fn.hpp                     preprocessor                   static_string.hpp
align.hpp                contract.hpp                  gil                     memory_order.hpp               preprocessor.hpp               stl_interfaces
aligned_storage.hpp      contract_macro.hpp            gil.hpp                 metaparse                      process                        swap.hpp
any                      convert                       graph                   metaparse.hpp                  process.hpp                    system
any.hpp                  convert.hpp                   hana                    move                           program_options                system.hpp
...
...
...

Building nghttp2 :

-- summary of build options:

    Package version: 1.58.90
    Library version: 39:1:25
    Install prefix:  C:/Program Files/nghttp2
    Target system:   Windows
    Compiler:
      Build type:
      C compiler:     C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe
      CFLAGS:          /DWIN32 /D_WINDOWS /W3
      C++ compiler:   C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe
      CXXFLAGS:        /DWIN32 /D_WINDOWS /W3 /GR /EHsc
      WARNCFLAGS:
      CXX1XCXXFLAGS:
      WARNCXXFLAGS:
    Python:
      Python:          C:/Program Files/Python310/python.exe
      Python3_VERSION: 3.10.5
    Test:
      CUnit:          FALSE (LIBS='')
      Failmalloc:     ON
    Libs:
      OpenSSL:        TRUE (LIBS='C:/openssl-3.2.0/Lib/x64/Debug/lib/libssl.lib;C:/openssl-3.2.0/Lib/x64/Debug/lib/libcrypto.lib')
      Libxml2:        FALSE (LIBS='')
      Libev:          FALSE (LIBS='')
      Libc-ares:      FALSE (LIBS='')
      Libngtcp2:       (LIBS='')
      Libngtcp2_crypto_quictls:  (LIBS='')
      Libnghttp3:      (LIBS='')
      Libbpf:          (LIBS='')
      Libevent(SSL):  FALSE (LIBS='')
      Jansson:        FALSE (LIBS='')
      Jemalloc:       FALSE (LIBS='')
      Zlib:           FALSE (LIBS='ZLIB_LIBRARY-NOTFOUND')
      Systemd:        FALSE (LIBS='SYSTEMD_LIBRARIES-NOTFOUND')
    Third-party:
      http-parser:
      MRuby:          0
      Neverbleed:     0
    Features:
      Applications:   OFF
      HPACK tools:    OFF
      Examples:       OFF
      Threading:      ON
      HTTP/3(EXPERIMENTAL): OFF

-- Configuring done (3.1s)
-- Generating done (0.2s)
-- Build files have been written to: C:/Users/user/Desktop/nghttp2/build

c:\Users\user\Desktop\nghttp2\build>cmake --build .
MSBuild version 17.6.3+07e294721 for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/user/Desktop/nghttp2/lib/CMakeLists.txt
  nghttp2_pq.c
  nghttp2_map.c
  nghttp2_queue.c
  nghttp2_frame.c
  nghttp2_buf.c
  nghttp2_stream.c
  nghttp2_outbound_item.c
  nghttp2_session.c
  nghttp2_submit.c
  nghttp2_helper.c
  nghttp2_alpn.c
  nghttp2_hd.c
  nghttp2_hd_huffman.c
  nghttp2_hd_huffman_data.c
  nghttp2_version.c
  nghttp2_priority_spec.c
  nghttp2_option.c
  nghttp2_callbacks.c
  nghttp2_mem.c
  nghttp2_http.c
  Generating Code...
  Compiling...
  nghttp2_rcbuf.c
  nghttp2_extpri.c
  nghttp2_ratelim.c
  nghttp2_time.c
  nghttp2_debug.c
  sfparse.c
  Generating Code...
     Creating library C:/Users/user/Desktop/nghttp2/build/lib/Debug/nghttp2.lib and object C:/Users/user/Desktop/nghttp2/build/lib/Debug/nghttp2.exp
  nghttp2.vcxproj -> C:\Users\user\Desktop\nghttp2\build\lib\Debug\nghttp2.dll
  Building Custom Rule C:/Users/user/Desktop/nghttp2/CMakeLists.txt

As a result under C:\Users\user\Desktop\nghttp2\build\lib\Debug I get nghttp2.lib and nghttp2.dll. But I'm not sure where to point LIBNGHTTP2_LIBRARY and LIBNGHTTP2_INCLUDE_DIR.

I don't know how to set the environment variables for Boost and LIBNGHTTP2 and as result I get the following error,

CMake error:

c:\Users\user\Desktop\nghttp2-asio\build>cmake -G "Visual Studio 17 2022" -A x64 ..
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- Could NOT find Libnghttp2 (missing: LIBNGHTTP2_LIBRARY LIBNGHTTP2_INCLUDE_DIR) (Required is at least version "1.43.0")
CMake Error at C:/Strawberry/c/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR system thread) (Required
  is at least version "1.54.0")
Call Stack (most recent call first):
  C:/Strawberry/c/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Strawberry/c/share/cmake-3.26/Modules/FindBoost.cmake:2377 (find_package_handle_standard_args)
  CMakeLists.txt:137 (find_package)

-- Configuring incomplete, errors occurred!

My goal is to build this by myself(no vcpkg) on Windows using Visual Studio as static library(I don't want to use any .dll for nghttp2-asio or nghttp2).

Thanks