Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build problems, segfault UT #496

Open
jkammerland opened this issue Apr 18, 2024 · 2 comments
Open

Build problems, segfault UT #496

jkammerland opened this issue Apr 18, 2024 · 2 comments
Assignees
Labels

Comments

@jkammerland
Copy link

jkammerland commented Apr 18, 2024

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)
@jbeshay
Copy link
Contributor

jbeshay commented Apr 18, 2024

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

@jkammerland
Copy link
Author

jkammerland commented Apr 21, 2024

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
Labels
Projects
None yet
Development

No branches or pull requests

4 participants