Issue compiling llvm-gcc frontend on sparc

Hi all,

I have successfully built LLVM itself, as all the tools (llc et al) are working fine. I built the latest release version (2.7). I have been trying to build the llvm-gcc frontend on a sparc machine. I encountered the following issues :

1) During configuration, the default assembler (installed at /usr/ccs/bin) is chosen to be used, but I want to use the GNU assembler (installed at /vm/GNU/bin in my machine). In spite of re-arranging paths on the PATH variable, and even after removing /usr/ccs/bin from PATH, configure still chooses the default assembler itself. Is there any other way I can tell configure to use the GNU assembler ?

2) During build, I get the following error :

gcc -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../llvm-gcc-4.2-2.7.source/gcc -I../../llvm-gcc-4.2-2.7.source/gcc/build -I../../llvm-gcc-4.2-2.7.source/gcc/../include -I./../intl -I../../llvm-gcc-4.2-2.7.source/gcc/../libcpp/include -I/vm/GNU/include/ -I/vm/GNU/include/ -I../../llvm-gcc-4.2-2.7.source/gcc/../libdecnumber -I../libdecnumber -I/curr/raghu/cross-compiled/obj//include -I/include -DENABLE_LLVM -I/curr/raghu/cross-compiled/obj/Release/include -D_DEBUG -include llvm/System/Solaris.h -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o build/genmodes.o ../../llvm-gcc-4.2-2.7.source/gcc/genmodes.c

cc1: error: llvm/System/Solaris.h: No such file or directory

There is, in fact, no Solaris.h in the llvm/System directory. Am I missing something here ? Kindly help.

Regards,
Raghu.

Hello,

There is, in fact, no Solaris.h in the llvm/System directory. Am I missing something here ? Kindly help.

Are you sure you're building both llvm-gcc and llvm from 2.7 release?
llvm/System/Solaris.h was definitely added before 2.7 release (summer
2008).

--with-as=pathname

The assembler is chosen by the gcc that you compile clang with. In my case, GCC is configured with

./configure --prefix=/opt/gcc44 --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++

And clang/llvm will be compiled with the as chosen here.

There is another catch when actually running llvm/clang. clang will try to use the gcc that is installed in the same directory with clang and use that as a hint to find the assembler. So if you install gcc3.4.6 in /usr/local and then install the gcc4.4-compiled Clang in /usr/local, no matter how you tweak $PATH, it will always pick /usr/local/bin/gcc instead of the other gcc4.4. The solution is to install llvm/clang into another location where no gcc can be found, than use $PATH to manipulate the order of discovery for the gcc binary, llvm/clang will than pick up the correct assembler when running.

My 2 cents,

CW