Skip to content

Instantly share code, notes, and snippets.

@mklooss
Last active September 12, 2019 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklooss/f9f2d361cb252b5d8d399e61774b3354 to your computer and use it in GitHub Desktop.
Save mklooss/f9f2d361cb252b5d8d399e61774b3354 to your computer and use it in GitHub Desktop.
Build HHVM on Debian Stretch

INIT

rm -rf /opt/hhvm

apt-get build-dep uw-imap -y
apt-get -y install libssl1.0-dev
apt-get -y install libgd2-xpm-dev (or the next one!)
apt-get -y install libgd-dev
apt-get -y install autoconf automake binutils-dev bison build-essential \
    cmake debhelper g++ gawk git gperf libboost-context-dev \
    libboost-dev libboost-filesystem-dev libboost-program-options-dev \
    libboost-regex-dev libboost-system-dev libboost-thread-dev libbz2-dev \
    libcap-dev libcurl4-gnutls-dev libdwarf-dev libedit-dev libeditline-dev \
    libelf-dev libevent-dev libexpat-dev libgmp3-dev libgoogle-glog-dev \
    libgoogle-perftools-dev libiberty-dev libiconv-hook-dev libicu-dev libinotifytools0-dev \
    libjemalloc-dev libkrb5-dev libldap2-dev libmagickwand-dev libmcrypt-dev libmemcached-dev \
    libncurses-dev libnotify-dev libonig-dev libpcre3-dev libsodium-dev libsqlite3-dev libssl1.0-dev \
    libtbb-dev libtool libxml2-dev libxslt1-dev libyaml-dev zlib1g-dev libsnappy-dev liblzo2-dev

apt-get -y install libonig-dev

apt-get -y remove --purge libre2-dev libre2-dev libpq-dev libpq5 libc-client-dev libc-client2007e-dev

Build UW-IMAP LIBS (from Debian Source with libssl1.0 (not libssl which is 1.1))

apt-get source uw-imap

make clean
make VERSION=2007e EXTRAAUTHENTICATORS='gss' EXTRACFLAGS='-D_REENTRANT -DDISABLE_POP_PROXY' IP6=6 ldb
mv c-client/c-client.a .
make clean
make VERSION=2007e EXTRAAUTHENTICATORS='gss' EXTRACFLAGS='-D_REENTRANT -DDISABLE_POP_PROXY -Wl,-z,defs' IP6=6 ldbs
rm -rf /usr/local/include/c-client /usr/local/lib/libc-client.so* /usr/local/lib/c-client.a*
mkdir -p /usr/local/include/ /opt/hhvm/lib/
cp -R ./c-client /usr/local/include/
cp ./c-client/libc-client.so /usr/local/lib/
cp ./c-client.a /usr/local/lib/
ln -fs /usr/local/lib/libc-client.so /usr/local/lib/libc-client.so.2007e
cp ./c-client/libc-client.so /opt/hhvm/lib/
ln -fs /opt/hhvm/lib/libc-client.so /opt/hhvm/lib/libc-client.so.2007e
cp ./c-client.a /usr/local/lib/
ln -fs /usr/local/lib/c-client.a /usr/local/lib/c-client.a.2007e

Build LZ4 (currently not in use)

git clone https://github.com/lz4/lz4.git .
git fetch --all
git checkout tags/v1.8.1.2
git submodule update --init --recursive
rm -rf /usr/local/include/lz4*
rm -rf /usr/local/lib/liblz4.*
rm -rf /usr/local/lib/pkgconfig/liblz4.pc
make -j4
make install
cp /usr/local/lib/liblz4.* /opt/hhvm/lib/

Build HHVM

git clone -b HHVM-3.18 https://github.com/facebook/hhvm.git .
git submodule update --init --recursive

mkdir build
cd build

CMAKE_LIBRARY_PATH=/opt/hhvm/lib cmake -Wno-dev \
    -DENABLE_EXTENSION_IMAP=On \
    -DENABLE_EXTENSION_SNAPPY=On \
    -DENABLE_EXTENSION_CURL=On \
    -DENABLE_EXTENSION_MCRYPT=On \
    -DENABLE_EXTENSION_OPENSSL=On \
    -DENABLE_EXTENSION_DOMDOCUMENT=On \
    -DENABLE_EXTENSION_GD=On \
    -DENABLE_EXTENSION_HASH=On \
    -DENABLE_EXTENSION_ICONV=On \
    -DENABLE_EXTENSION_MCRYPT=On \
    -DENABLE_EXTENSION_PCRE=On \
    -DENABLE_EXTENSION_PDO=On \
    -DENABLE_EXTENSION_PDO_MYSQL=On \
    -DENABLE_EXTENSION_SIMPLEXML=On \
    -DENABLE_EXTENSION_SOAP=On \
    -DENABLE_EXTENSION_APC=On \
    -DENABLE_EXTENSION_BCMATH=On \
    -DENABLE_EXTENSION_BZ2=On \
    -DENABLE_EXTENSION_DATETIME=On \
    -DENABLE_EXTENSION_FILEINFO=On \
    -DENABLE_EXTENSION_IMAGICK=On \
    -DENABLE_EXTENSION_JSON=On \
    -DENABLE_EXTENSION_LZ4=Off \
    -DENABLE_EXTENSION_MBSTRING=On \
    -DENABLE_EXTENSION_READLINE=On \
    -DENABLE_EXTENSION_SQLITE3=On \
    -DENABLE_EXTENSION_ZLIB=On \
    -DONIGURUMA_INCLUDE_DIRS=/usr/include \
    -DCMAKE_INSTALL_PREFIX=/opt/hhvm \
    -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock \
    ..
# https://github.com/google/re2/issues/102
diff --git a/third-party/re2/src/re2/dfa.cc b/third-party/re2/src/re2/dfa.cc
index 483f678..b887424 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -101,7 +101,7 @@ class DFA {
uint flag_; // Empty string bitfield flags in effect on the way
// into this state, along with kFlagMatch if this
// is a matching state.
- std::atomic<State*> next_[]; // Outgoing arrows from State,
+ std::atomic<State*> next_[0]; // Outgoing arrows from State,
// one per input byte class
};
# Snappy lib and header files will not be found automatic o.O
diff --git a/CMake/HHVMExtensionConfig.cmake b/CMake/HHVMExtensionConfig.cmake
index bcc3fc11f5..59c5f7ae1c 100644
--- a/CMake/HHVMExtensionConfig.cmake
+++ b/CMake/HHVMExtensionConfig.cmake
@@ -991,6 +991,8 @@ function (HHVM_EXTENSION_INTERNAL_HANDLE_LIBRARY_DEPENDENCY extensionID dependen
endif()
elseif (${libraryName} STREQUAL "snappy")
find_package(Snappy ${requiredVersion})
+ set(SNAPPY_LIBRARIES /usr/lib/x86_64-linux-gnu/libsnappy.so)
+ set(SNAPPY_INCLUDE_DIRS /usr/include)
if (NOT SNAPPY_INCLUDE_DIRS OR NOT SNAPPY_LIBRARIES)
HHVM_EXTENSION_INTERNAL_SET_FAILED_DEPENDENCY(${extensionID} ${dependencyName})
return()
@mklooss
Copy link
Author

mklooss commented Jul 26, 2019

for Debian Buster you need also an Folly patch: https://github.com/facebook/folly/commit/b0ec99828f0c782a38947513c5e0c242984e269e.patch

mcrouter fix:
facebook/mcrouter#200 (comment)

Fixed: zend-collator
facebook/hhvm@99f81dc
build libiconv
build icu-57.x
build oniguruma-6.7.x not higher than 6.8

Using gcc 6

and build openssl1.0

export PKG_CONFIG_PATH=/opt/hhvm/lib/pkgconfig/
export LD_LIBRARY_PATH=/opt/gcc/6/lib:/opt/hhvm/lib
export PATH=/opt/gcc/6/bin:$PATH
export CC=/opt/gcc/6/bin/gcc
export CXX=/opt/gcc/6/bin/g++

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