Skip to content

Instantly share code, notes, and snippets.

@crondaemon
Created December 4, 2015 13:56
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 crondaemon/4b59add98416f040be26 to your computer and use it in GitHub Desktop.
Save crondaemon/4b59add98416f040be26 to your computer and use it in GitHub Desktop.
How to setup include-what-you-use in ubuntu 14.04 to compile wireshark's dissectors

Install clang

Iwyu relies on clang, hence we need to install it. In ubuntu 14.04 the latest version is 3.5: let's go with it.

sudo apt-get install clang-3.5 llvm-3.5-dev

Compile iwyu

Clone the github repo, and move to the 3.5 branch (same as our clang version).

git clone git@github.com:include-what-you-use/include-what-you-use.git
git checkout clang_3.5 -b clang_3.5

Compile it (I used cmake).

mkdir build
cd build
cmake -DLLVM_PATH=/usr/lib/llvm-3.5 ..
make

Install iwyu

Due to a bug of iwyu, the executable must be manually copied into the system

[from the build dir]
cp include-what-you-use /usr/lib/llvm-3.5/bin/

Use iwyu to compile Wireshark's dissectors

I succeded to use it just setting it manually in autotools, so far. Edit epan/dissectors/Makefile and set CC to /usr/lib/llvm-3.5/bin/include-what-you-use. Run it

make -k packet-aeron.o

to compile packet-aeron.c

@edenzik
Copy link

edenzik commented Nov 7, 2016

Thanks for the guide! I had to install clang headers as well:
sudo apt-get install libclang-3.5-dev

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