lsquic icon indicating copy to clipboard operation
lsquic copied to clipboard

LSQUIC Build Issue

Open mhmdreda99 opened this issue 1 year ago • 3 comments

Problem

When building the LSQUIC project, users encountered linking errors related to C++ symbols from BoringSSL. The main issues were:

  1. The project was configured to use only C, but BoringSSL requires C++ support.
  2. The linker couldn't find certain C++ symbols, indicating a mismatch between the BoringSSL library and the LSQUIC project settings.

Solution

The solution involved several steps to properly integrate BoringSSL with LSQUIC:

  1. Modified the CMakeLists.txt to include C++ support:

    • Changed PROJECT(lsquic C) to PROJECT(lsquic C CXX)
  2. Added the C++ standard library to the linker flags:

    • Modified the LIBS variable in CMakeLists.txt to include -lstdc++
  3. Ensured correct paths to BoringSSL were provided to CMake:

    cmake -DBORINGSSL_DIR=/path/to/boringssl \
          -DBORINGSSL_INCLUDE=/path/to/boringssl/include \
          -DBORINGSSL_LIB_ssl=/path/to/boringssl/build/ssl/libssl.a \
          -DBORINGSSL_LIB_crypto=/path/toboringssl/build/crypto/libcrypto.a \
          ..
    
  4. If necessary, rebuilt BoringSSL with compatible compiler settings:

    cd /path/to/boringssl
    rm -rf build
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Release ..
    make
    

Steps to Build LSQUIC

  1. Ensure BoringSSL is properly built and its path is known.
  2. Clean the LSQUIC build directory:
    cd  /path/to/lsquic/build
    rm -rf *
    
  3. Run CMake with the correct BoringSSL paths:
    cmake -DBORINGSSL_DIR=/path/to/boringssl \
          -DBORINGSSL_INCLUDE=/path/to/boringssl/include \
          -DBORINGSSL_LIB_ssl=/path/to/boringssl/build/ssl/libssl.a \
          -DBORINGSSL_LIB_crypto=/path/to/boringssl/build/crypto/libcrypto.a \
          ..
    
  4. Build the project:
    make
    

mhmdreda99 avatar Jul 24 '24 15:07 mhmdreda99

This needs merging. The BORINGSSL env var is a bad way to provide the locations of boringssl since the include dir remains with the source and the libraries are in different paths. Providing them seperately like this is a far better way IMO. Also adding the CXX to the project type and adding stdc++ on line 272 of CMakeLists.txt SET(LIBS lsquic ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS} stdc++) got rid of the errors when linking to boringssl.

flipkickmedia avatar Nov 14 '24 18:11 flipkickmedia

Right now you need to use:

Cleanup:

rm -rf boringssl lsquic

Build boringssl:

git clone https://boringssl.googlesource.com/boringssl
mkdir boringssl/build
cd boringssl/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j 
cd ..
set -g -x BORINGSSL $PWD
cd ..

Build lsquic:

git clone https://github.com/litespeedtech/lsquic.git
cd lsquic
git submodule update --init
mkdir build
cd build
cmake -DBORINGSSL_DIR=$BORINGSSL \
      -DBORINGSSL_INCLUDE=$BORINGSSL/include \
      -DBORINGSSL_LIB_ssl=$BORINGSSL/build/libssl.a \
      -DBORINGSSL_LIB_crypto=$BORINGSSL/build/libcrypto.a \
      ..
make -j

P.S. I use set -g -x BORINGSSL $PWD for fish, if you're using bash, please replace this line with BORINGSSL=$PWD.

codereptile avatar Aug 05 '25 18:08 codereptile

Since the time this issue was opened, the build mechanism has undergone significant changes (hopefully, improvements). @mhmdreda99, could you please give this another shot and report whether the issues that were hindering you have been resolved?

dtikhonov avatar Oct 12 '25 13:10 dtikhonov