C++

Modern gcc compiler on Travis CI

I recently needed to setup Travis CI for a little pet project I'm working on. However, my code requires C++17 (yeh, I'm nuts), and the compiler suite that comes with the various Travis images do not satisfy this. Long story short, there are ways around this, forcing the installation and activation of gcc8 on Xenial. Example:

dist: xenial
language: cpp
compiler: gcc

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - sudo apt-get install g++-8 libstdc++-8-dev
  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
  - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90

install: autoreconf -if

script: ./configure && make -j4 && make test

Hacking: 

Compiling LLVM with distcc

First off, I'm not a cmake expert, so I'm not 100% sure if I'm doing this right, but it does seem to work... Basically, I wanted to distribute my LLVM builds across a set of machines, using distcc. This is what I did

  1. As root, the first thing to do is making sure you have distcc linked to various compilers, e.g

    $ sudo ln -s /usr/bin/distcc /usr/local/lib/distcc/gcc
    $ sudo ln -s /usr/bin/distcc /usr/local/lib/distcc/g++

     

  2. Run cmake like

    $ CC=/usr/local/lib/distcc/gcc CXX=/usr/local/lib/distcc/g++ cmake -DCMAKE_INSTALL_PREFIX=/opt/llvm -G "Unix Makefiles" ../src
    $ pump make -j30  CC=/usr/local/lib/distcc/gcc CXX=/usr/local/lib/distcc/g++

     

However, the final link stages did not fair well with the parallel make, so I had to run again, without a -j option to make.

Hacking: 

Firefox performance vs compiler options

I've compiled the latest Firefox source (nightly) with various gcc compiler optimization options, compared to the "default" moz build options on my platform. This is not a comprehensive test, but merely gives some ideas of where the "best bang for the buck" is. I ran the Sunspider benchmarks three times for each build instance. My box is a single CPU core2 system with 4GB RAM. The compiler options used were as follow:

Hacking: 

Subscribe to RSS - C++