Skip to content

Build problems, segfault UT #496

Open

Description

@jkammerland

Almost impossible to build AND use, need to fix packaging or provide instructions.

Also segfault on 1 unittest on master.

E.g if you try to use the packeges after installing you simply get
0.403 Could not find a package configuration file provided by "Sodium" with any
0.403 of the following names:
0.403
0.403 SodiumConfig.cmake
0.403 sodium-config.cmake

when using find_package(proxygen REQUIRED)
after running [install.sh]

e.g when running
cmake .. -DCMAKE_PREFIX_PATH=${DEPS_PATH}

for this:

# CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(proxygen_server)

# Set C++17 as the default
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Find required libraries
find_package(Proxygen REQUIRED)

Activity

  1. jbeshay commented on Apr 18, 2024

    @jbeshay
    Contributor

    Please use one of these scripts to build proxygen:
    https://github.com/facebook/proxygen/blob/main/proxygen/build.sh
    https://github.com/facebook/proxygen/blob/main/getdeps.sh

    As you've already noticed in #497, the build.sh installs the required dependencies including libsodium

  2. jkammerland commented on Apr 21, 2024

    @jkammerland
    Author

    Hello, thanks for the answer. I managed to to get it working with getdeps.sh. But it took alot of work to figure out a way to finally get it to build (out of the proxygen source dir), without too much dirty hacking.

    As a user I want to be able to consume this library in an easy way. Perhaps you can understand what I do wrong by looking at my working example below. I have reduced and simplified as much as I possibly can. I made a Dockerfile to show all necessary other steps before you can start building (from a clean ubuntu:22.04). Please see the Dockerfile

    FROM ubuntu:22.04
    
    # Install required dependencies
    RUN apt-get update && apt-get install -y git cmake g++ curl
    WORKDIR /app
    
    # Clone the Proxygen repository
    RUN git clone https://github.com/facebook/proxygen.git
    
    RUN apt-get install python3 python3-pip -y
    RUN apt-get install -y openssl libssl-dev pkg-config
    RUN apt-get install -y autoconf automake libtool
    
    # Build and install Proxygen
    WORKDIR /app/proxygen
    RUN ./getdeps.sh
    
    WORKDIR /app
    COPY . .
    RUN mkdir build && cd build && cmake .. && make -j$(nproc)
    
    # Note you'll need to EXPOSE ports if you want to try the server outside the container
    
    # Set the default command to run when the container starts
    CMD ["./build/server"]

    at https://github.com/jkammerland/proxygen-docker-example/blob/main/Dockerfile

    Then for the CMakeLists.txt, I have made a comment on every line I needed to add to make it work

    # The most minimal CMakeLists.txt file to build a proxygen server I could find
    
    cmake_minimum_required(VERSION 3.15)
    project(proxygen_server)
    
    set(CMAKE_CXX_STANDARD 20)
    set(CMAKE_CXX_STANDARD_REQUIRED True)
    
    # Needed to find proxygen-config.cmake
    list(APPEND CMAKE_PREFIX_PATH "/app/proxygen/_build")
    
    # Needed to find sodium-config.cmake
    list(APPEND CMAKE_MODULE_PATH "/app/proxygen/build/fbcode_builder/CMake")
    
    # Otherwise you will not find sodium correctly. If you install with
    # package-manager as well, you get warnings...
    file(GLOB SODIUM_DIR "/app/proxygen/_build/libsodium-*")
    if(SODIUM_DIR)
      list(APPEND CMAKE_PREFIX_PATH ${SODIUM_DIR})
    else()
      message(FATAL_ERROR "Sodium directory not found")
    endif()
    
    # Find required libraries, for the eche server example
    find_package(proxygen CONFIG REQUIRED)
    find_package(gflags REQUIRED)
    find_package(zstd CONFIG REQUIRED)
    find_package(folly REQUIRED)
    # find_package(sodium REQUIRED) # Will not work
    
    add_executable(server EchoServer.cpp EchoHandler.cpp)
    
    # Link the required libraries
    target_link_libraries(server PUBLIC proxygen::proxygenhttpserver gflags zstd)
    
    # This is needed to find libzstd, Using prefix path does not work
    file(GLOB ZSTD_LIB_DIR "/app/proxygen/_build/zstd-*/lib")
    if(ZSTD_LIB_DIR)
      target_link_directories(server PUBLIC ${ZSTD_LIB_DIR})
    else()
      message(FATAL_ERROR "Zstd library directory not found")
    endif()
    

    at https://github.com/jkammerland/proxygen-docker-example/blob/main/CMakeLists.txt

    I started trying to consume this lib through vcpkg, that also failed. I opened an issue over there too microsoft/vcpkg#38086. So I came to try to figure out how to build it myself so I can maybe create a "working" vcpkg port.

    Please have look and sanity check this.
    BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions