LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12954 - clang looks for its libraries in ../lib, rather than correct libdir
Summary: clang looks for its libraries in ../lib, rather than correct libdir
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-26 04:31 PDT by Michał Górny
Modified: 2016-08-25 15:54 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny 2012-05-26 04:31:48 PDT
$ clang -O4 -faddress-sanitizer a.c
/usr/bin/x86_64-pc-linux-gnu-ld: error: cannot open /usr/bin/../lib/clang/3.1/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory
lto-llvm.o-WK9UAf:ld-temp.o:function asan.module_ctor: error: undefined reference to '__asan_init'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


The problem is that the library is installed in ../lib64, and clang seems to hardcode just ../lib in a lot of places.
Comment 1 Kostya Serebryany 2012-05-28 02:42:14 PDT
I don't know much about this area. 
Chandler, Daniel, could you please comment? 

From what I can see: 

tools/clang/lib/Driver/Driver.cpp: 
  StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
  SmallString<128> P(Dir);
  if (ClangResourceDir != "")
    llvm::sys::path::append(P, ClangResourceDir); 
  else
    llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING);

So, perhaps, if the run-time libraries are going to be placed in lib64, 
CLANG_RESOURCE_DIR needs to be redefined at the build time. 


The LLVM 3.1 binaries for Ubuntu 12.04  available at http://llvm.org/releases/download.html#3.1 have libclang_rt.asan-x86_64.a
installed in lib/clang (no lib64)
Comment 2 Michał Górny 2012-05-28 02:50:06 PDT
(In reply to comment #1)
> The LLVM 3.1 binaries for Ubuntu 12.04  available at
> http://llvm.org/releases/download.html#3.1 have libclang_rt.asan-x86_64.a
> installed in lib/clang (no lib64)

We were considering installing them into /usr/lib too just to work-around the issue but prefer having it fixed instead.
Comment 3 Michał Górny 2015-06-09 05:34:24 PDT
I think this one was fixed already. Not that three years later I consider it actually a good idea :).