This is an archive of the discontinued LLVM Phabricator instance.

Enable building of sanitizers on FreeBSD
ClosedPublic

Authored by kutuzov.viktor.84 on Feb 19 2014, 7:09 AM.

Details

Reviewers
kcc
samsonov
Summary

This patch enables building of the asan, lsan, profile and ubsan parts of sanitizer on FreeBSD.

I'm not sure if we should commit this patch first or last. In the latter case and before the patch is committed, it can work as a reference for those who would like to try to build the sources on FreeBSD.

Diff Detail

Event Timeline

kcc added a subscriber: samsonov.Feb 19 2014, 7:35 AM
samsonov accepted this revision.Feb 20 2014, 5:18 AM

LGTM.

I'm going to commit this patch so that other FreeBSD folks may try building ASan. I will revert it if it cause problems or build failures.

Submitted as r201783.

As of rL205847, it runs 'make check-all' with no unexpected failures on FreeBSD 9.2 so I propose that we re-apply this patch.

The config used for the build is this:

.
# we have to install these from ports as the packages versions are too old
cd /usr/ports/devel/subversion
sudo make BATCH=1 install clean

cd /usr/ports/devel/libc++
sudo make BATCH=1
sudo make PREFIX=/usr install clean

cd /usr/src/lib/libcxxrt
sudo make
sudo make install clean

cd /usr/ports/shells/bash
sudo make BATCH=1 install clean

cd /usr/ports/textproc/gnugrep
sudo make BATCH=1 install clean

wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.gz
./configure --prefix=/usr --enable-language=c,c++
gmake
sudo gmake install

# these are necessary to pass LLVM :: BugPoint/compile-custom.ll
sudo pkg install gcc
sudo pkg install python

CC=clang CXX=clang++ cmake \
    -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" \
    -DCMAKE_EXE_LINKER_FLAGS="-lcxxrt" \
    -DCMAKE_CXX_COMPILER_FORCED=1