Skip to content

src/python/bcc/version.py created as part of build #1964

@bolinfest

Description

@bolinfest

I'm on Ubuntu 18.04.1. First, note that the build instructions:

# Trusty and older
VER=trusty
echo "deb http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main
deb-src http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main" | \
  sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update

# All versions
sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
  libllvm3.7 llvm-3.7-dev libclang-3.7-dev python zlib1g-dev libelf-dev

# For Lua support
sudo apt-get -y install luajit luajit-5.1-dev

mention Trusty (14.04) and older, so I wasn't sure what to do for 18.04. I ended up copypasta'ing some stuff from the LLVM Debian/Ubuntu nightly packages and created /etc/apt/sources.list.d/llvm.list with the following contents:

# i386 not available
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main
# 6.0
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main
# 7
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main

Then I basically followed the existing instructions, but instead of:

sudo apt-get -y install libllvm3.7 llvm-3.7-dev libclang-3.7-dev

I did:

sudo apt-get -y install libllvm7 llvm7-dev libclang-7-dev

(Note that I originally tried this with 8 instead of 7, but then building bcc failed because the getLocStart() API appears to have been renamed in LLVM 8.)

Now the problem was getting things to build because everything seems hardcoded for LLVM 3.7. I rooted around in CMakeLists.txt and found $LLVM_LIBRARY_DIRS, so adding an extra argument to cmake worked fine:

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBRARY_DIRS=/usr/lib/llvm-7/lib

However, when I was done, git status was not clean, as there was the file src/python/bcc/version.py with the following contents:

__version__ = '0.7.0-8cc0bda6'

Not a huge deal, but it would be nice if this file were either not created, created under build/, or listed in .gitignore.

It would also be nice if the Ubuntu build instructions were updated to call out what to do for versions after Trusty. Hopefully the record of the steps I went through (and the upcoming breaking in LLVM 8) are useful here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions