title: /usr/bin/ld: cannot find /usr/lib64/libasan.so.0.0.0 on redhat
body: <p>I am normally using valgrind for my c/c++ programs but people have been recommending address sanitizer, so I wanted to test it out, but im having problems linking against it on a redhat system.</p>
  
  <p>I got the following code:</p>
  
  <p>$ cat heap-use-after-free.cpp </p>
  
  <pre><code>int main(int argc, char **argv) {
    int *array = new int[100];
    delete [] array;
    return array[argc];  // BOOM
  }
  </code></pre>
  
  <p>compiling like:</p>
  
  <p>$ g++ -O -g -fsanitize=address heap-use-after-free.cpp</p>
  
  <pre><code>/usr/bin/ld: cannot find /usr/lib64/libasan.so.0.0.0
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>On a redhat where I have installed libasan</p>
  
  <pre><code>sudo yum install libasan
  [sudo] password for dingdongsong: 
  Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
  This system is receiving updates from RHN Classic or Red Hat Satellite.
  rh-network-tools-rhel-x86_64-server-7-prod                                                                                                                                                                                                           | 1.5 kB  00:00:00     
  rhel-x86_64-server-7-custom-prod                                                                                                                                                                                                                     | 1.0 kB  00:00:00     
  rhel-x86_64-server-7-epel-prod                                                                                                                                                                                                                       | 1.5 kB  00:00:00     
  rhel-x86_64-server-7-prod                                                                                                                                                                                                                            | 1.5 kB  00:00:00     
  rhel-x86_64-server-7-rhscl-1-prod                                                                                                                                                                                                                    | 1.5 kB  00:00:00     
  rhel-x86_64-server-7-thirdparty-oracle-java-prod                                                                                                                                                                                                     | 1.5 kB  00:00:00     
  rhel-x86_64-server-extras-7-prod                                                                                                                                                                                                                     | 1.5 kB  00:00:00     
  rhel-x86_64-server-optional-7-prod                                                                                                                                                                                                                   | 1.5 kB  00:00:00     
  rhel-x86_64-server-supplementary-7-prod                                                                                                                                                                                                              | 1.5 kB  00:00:00     
  Package libasan-4.9.2-6.2.el7.x86_64 already installed and latest version
  Nothing to do
  </code></pre>
  
  <p>With the following libasan shared objects:</p>
  
  <p>$ locate libasan</p>
  
  <pre><code>/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/32/libasan.a
  /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/32/libasan.so
  /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/32/libasan_preinit.o
  /usr/lib/gcc/x86_64-redhat-linux/4.8.2/libasan.so
  /usr/lib/gcc/x86_64-redhat-linux/4.8.2/libasan_preinit.o
  /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libasan.a
  /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libasan.so
  /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libasan_preinit.o
  /usr/lib64/libasan.so.1
  /usr/lib64/libasan.so.1.0.0
  </code></pre>
  
  <p>Can someone point me in the right direction.</p>
  
  <p>Thanks</p>