2

I get this error when compiling with clang++ and -fsanitize=address -m32:

/usr/bin/ld: cannot find /usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/lib/linux/libclang_rt.asan-i386.a: No such file or directory
/usr/bin/ld: cannot find /usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/lib/linux/libclang_rt.asan_cxx-i386.a: No such file or directory

Which package do I need? I already tried with libclang-3.6-dev

I also got an error for clang 3.7 with -m64:

/usr/bin/ld: cannot find /usr/lib/llvm-3.7/bin/../lib/clang/3.7.1/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory
/usr/bin/ld: cannot find /usr/lib/llvm-3.7/bin/../lib/clang/3.7.1/lib/linux/libclang_rt.asan_cxx-x86_64.a: No such file or directory

The -m64 error for clang 3.7 (and 3.8) happens only on travis-ci - meaning that I have no problems there with 3.4/3.5/3.6.

0

2 Answers 2

2

As others have stated, this is a bug in the way that clang-3.7 and clang-3.8 were packaged: https://llvm.org/bugs/show_bug.cgi?id=22757

Luckily, fixing the broken packages after installation isn't hard. You just need to download the correct libraries, and put them in the correct directory.

First, go to http://llvm.org/releases/download.html and find the matching version. I'm running 64-bit Ubuntu 14.04, so to patch clang-3.8 I want "Clang for x86_64 Ubuntu 14.04". Download directly, or copy the right-click and "Copy Link Address" and use wget:

wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz

Uncompress:

tar -xf clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz

Then copy the library files (using -n to avoid overwriting existing files):

sudo cp -n clang+llvm-3.8.0-x86_64-linux-gnu/lib/clang/3.8.0/lib/linux/*.a /usr/lib/llvm-3.8/lib/clang/3.8.0/lib/linux/

If desired, repeat for any older versions of clang you have installed, although note that if you are using a Linux kernel more recent than 4.1 with a clang version earlier than 3.8 you may encounter another bug with -fsanitize=memory: https://llvm.org/bugs/show_bug.cgi?id=24155

1

apparently there is a bug that asan is missing in clang 3.7 and 3.8.

about the 32 bit issue with 3.6 - I think I need libclang-3.6-dev:i386 and libclang-common-3.6-dev:i386 - not tested yet - because of THIS

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .