Compiling HHVM with GCC 4.9/5.2 and Boost
For my development environment I prefer using Debian unstable, as it usually has the latest and greatest things available. This tends to work a lot better with living-on-the-edge software like HHVM. However, in this case, GCC 5.2 was a little bit too living-on-the-edge for HHVM. Some system libraries were 'suddenly' compiled with GCC 5.2, which did not interact well with HHVM's GCC 4.9 (or even GCC 5.2) compiles. It mostly has to do with that GCC 5.1+ employs a new ABI for C++ compiled objects.
As I'm currently working on a MongoDB extension for HHVM, I really needed my own HHVM compiled — with debugging symbols. I could also not use HHVM's nightlies or binaries, as their Debian packages depend on versions of libraries that my Debian install no longer provides.
HHVM uses google-glog for some logging stuff, and this was the first library that caused issues when linking. The error message was:
../../../third-party/folly/libfolly.a(dynamic.cpp.o): In function `std::string* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)':
/usr/include/glog/logging.h:672: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../../../third-party/folly/libfolly.a(Format.cpp.o): In function `std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
/usr/include/glog/logging.h:672: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
collect2: error: ld returned 1 exit status
hphp/tools/bootstrap/CMakeFiles/gen-class-map.dir/build.make:123: recipe for target 'hphp/tools/bootstrap/gen-class-map' failed
make[2]: *** [hphp/tools/bootstrap/gen-class-map] Error 1
CMakeFiles/Makefile2:945: recipe for target 'hphp/tools/bootstrap/CMakeFiles/gen-class-map.dir/all' failed
make[1]: *** [hphp/tools/bootstrap/CMakeFiles/gen-class-map.dir/all] Error 2
Makefile:106: recipe for target 'all' failed
make: *** [all] Error 2
I promptly filed an issue, which wasn't going anywhere fast enough.
But the hints in the comments were good enough for me to try and find a solution.
google-glog
To sort out google-glog and get a GCC 4.9 compiled version installed, I first removed the system version with apt-get remove libgoogle-glog-dev
libgoogle-glog0v5. I then downloaded the source package through apt: apt-get source libgoogle-glog-dev. To compile, I ran:
-
Make sure we use the 'old' compiler:
-
export ASM=`which gcc-4.9` -
export CXX=`which g++-4.9` -
export CC=`which gcc-4.9`
-
-
cd google-glog-0.3.4 -
./configure -
In the generated
Makefile, I changed theACLOCALdefine toaclocal-1.15(line 613) and theAUTOMAKEdefine toautomake-1.15(line 629). For some reason, they were both-1.14which isn't installed. -
make -
automake --add-missingto silence a warning about some installer -
make -j 20 -
sudo make install
Boost
Boost was a bit trickier, as it's build system is "novel". I did not have to remove the packages that I installed with APT though, and HHVM's build system was clever enough to pick up on my newly compiled libraries which I installed in /usr/local.
-
Download Boost:
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2 -
Extract:
tar -xvjf boost_1_59_0.tar.bz2 -
Change into directory:
cd boost_1_59_0/ -
Run
./bootstrap.sh -
mkdir tools/build/v2 -
Setup our new (old) compiler as toolset (found on StackOverflow):
echo "using gcc : 4.9 : /usr/bin/g++-4.9 ; " > tools/build/v2/user-config.jam -
Compile:
./bjam --toolset=gcc-4.9 -j 16 -
Install into
/usr/local:sudo ./b2 install --prefix=/usr/local --toolset=gcc-4.9 -
sudo ldconfig
That sorted out Boost.
HHVM
I then compiled HHVM in my normal fashion, ensuring I was using GCC 4.9:
-
export CC=`which gcc-4.9` -
export CXX=`which g++-4.9` -
export ASM=`which gcc-4.9` -
Check out the 3.9.1 release:
git checkout 3.9.1 && git submodule update --recursive -
Clean things up:
git clean -dfx -f && git clean -dfx -f third-party -
Configure (make sure it picks up the new 1.59 version of Boost that you just compiled yourself):
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local/hhvm/3.9.1 . -
make -j 20 -
make install
Et voilá, a working HHVM compiled with GCC 4.9 on the latest Debian unstable.
Life Line
Updated an estate_agent office
My First Lapwing!
I went to the London Wetland Centre yesterday, for a day out in nature.
While hiding in a hide, this chap and a friend showed up starting to forage for grubs.
#BirdPhotography #BirdsOfMastodon #Photography #Birds #London #Nature
Created a waste_basket; Updated a cafe and a restaurant; Confirmed an estate_agent office
@bennuttall Are you at the Crucible this year again?
I walked 9.7km in 5h29m12s
Updated a gate
Staring Contest with a Squirrel
On my walk on the weekend, I sat down on a tree branch of a tree that had fallen over some time ago. Just listening to the birds.
Then after hearing rustling in the foliage above me, I looked up, and saw this chap staring at me.
I walked 3.0km in 41m38s
I walked 1.1km in 12m20s
Bluebell Carpet
I had a lovely walk on Hampstead Heath yesterday, finding all the nooks and crannies away from the busy paths.
This field of bluebells under the colourful tree was a stand-out quiet spot.
I walked 2.3km in 21m51s
Fix paths
Created a memorial
Created a bench
@Edent Seems like my Android stopped sending coordinates to @openbenches as well, which is surprising as I haven't updated anything as far as I'm aware. Could it be a problem with the reader in your side after the latest changes and the addition of the warning?
I walked 5.8km in 2h15m45s
I walked 1.7km in 17m46s
I walked 4.8km in 1h39m40s
Add the new Queen Elizabeth II garden.
Updated a bench and a crossing; Deleted 2 kerbs
Created 3 gates and a waste_basket
Created 6 benches
Created a bench; Updated 4 benches
Created 2 benches and a bicycle_parking; Updated a telephone and a waste_basket
I walked 10.3km in 2h34m24s




Shortlink
This article has a short URL available: https://drck.me/hhvm-gcc-bwe