Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC : picking up wrong version of headers

I downloaded and started to build LLVM / CLANG. I initially had gcc version 4.1.2 20080704 (Red Hat 4.1.2-48) installed but LLVM website stated to use a higher one. So I downloaded and compiled / build GCC gcc version 4.7.2 (GCC). Now I started to build LLVM after setting the below config:

# setenv PATH /usr/local/lib:/usr/local/lib64:$PATH
# setenv LD_LIBRARY_PATH /usr/local/lib/:/usr/local/lib64/
# setenv CC /usr/local/bin/gcc

Note the path where GCC 4.1.2 available is /usr/bin while that of 4.7.2 I found it in /usr/local/bin by default

But the LLVM build failed stating:

In file included from /x/home/satprasad/llvm/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc:35:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm:64:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:69:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h:38:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h:132:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h:100:1: error: weakref declaration must have
      internal linkage
__gthrw(pthread_once)

But it should pick files / headers for 4.7.2 versions not 4.1.2 ones - can you please let me know how to fix this - the line that gives error is in below file/code:

llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc

#include <algorithm>

Thanks in advance

like image 801
Programmer Avatar asked Feb 01 '26 09:02

Programmer


1 Answers

Running:

./configure --help

shows this option:

--with-gcc-toolchain    Directory where gcc is installed.

So try:

--with-gcc-toolchain /usr/local

And don't set any environment variables.

like image 102
Nikos C. Avatar answered Feb 03 '26 08:02

Nikos C.