Edward Diener
2013-Jan-05 17:48 UTC
[LLVMdev] Building llvm from source with clang instead of gcc
On 01/05/2013 11:32 AM, Krzysztof Parzyszek wrote:> On 1/5/2013 7:10 AM, Edward Diener wrote: >> Is it possible to build llvm with a previous version of clang installed >> as a binary ? If so, how do I get llvm/configure to use the binary >> version of clang rather than gcc to build the latest version of llvm ? >> > > Set environment variables CC and CXX to point to the clang/clang++ > binaries before running configure.Do I give the full path to the executable, or just the executable name if it is already in the PATH, for those environment variables ? It would have been much better if the environment variables were named LLVM_CC and LLVM_CXX for the obvious reason that CC and CXX are very common names. I actually found out that llvm/configure will choose clang if it is found in the path. This contradicts what is written at http://llvm.org/docs/GettingStarted.html#requirements, where it says it will use the first GCC it finds. Perhaps that explanation needs to be updated. Finally I found that if llvm/configure uses clang instead of gcc, it invariably fails on my Linux distros because it is using the gcc distributed included directories and an earlier version of clang will often fail with these gcc header files. Once I force llvm/configure to use gcc, building llvm/clang succeeds again.
Krzysztof Parzyszek
2013-Jan-05 17:58 UTC
[LLVMdev] Building llvm from source with clang instead of gcc
On 1/5/2013 11:48 AM, Edward Diener wrote:> > It would have been much better if the environment variables were named > LLVM_CC and LLVM_CXX for the obvious reason that CC and CXX are very > common names.Actually, the variables CC and CXX are used exactly as they are always used: to set the C and C++ compiler. Frankly, I don't see why you would prefer to use different ones. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Dmitri Gribenko
2013-Jan-05 18:11 UTC
[LLVMdev] Building llvm from source with clang instead of gcc
On Sat, Jan 5, 2013 at 7:48 PM, Edward Diener <eldlistmailingz at tropicsoft.com> wrote:> I actually found out that llvm/configure will choose clang if it is > found in the path. This contradicts what is written at > http://llvm.org/docs/GettingStarted.html#requirements, where it says it > will use the first GCC it finds. Perhaps that explanation needs to be > updated.Updated docs in r171630.> Finally I found that if llvm/configure uses clang instead of gcc, it > invariably fails on my Linux distros because it is using the gcc > distributed included directories and an earlier version of clang will > often fail with these gcc header files. Once I force llvm/configure to > use gcc, building llvm/clang succeeds again.Right. Maybe we need to skip old clang versions in this case. Dmitri -- main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
Edward Diener
2013-Jan-05 22:53 UTC
[LLVMdev] Building llvm from source with clang instead of gcc
On 01/05/2013 12:58 PM, Krzysztof Parzyszek wrote:> On 1/5/2013 11:48 AM, Edward Diener wrote: >> >> It would have been much better if the environment variables were named >> LLVM_CC and LLVM_CXX for the obvious reason that CC and CXX are very >> common names. > > Actually, the variables CC and CXX are used exactly as they are always > used: to set the C and C++ compiler. Frankly, I don't see why you would > prefer to use different ones.I did not realize that this was a standard use of the CC and CXX environment variables under Linux.
Edward Diener
2013-Jan-05 22:59 UTC
[LLVMdev] Building llvm from source with clang instead of gcc
On 01/05/2013 01:11 PM, Dmitri Gribenko wrote:> On Sat, Jan 5, 2013 at 7:48 PM, Edward Diener > <eldlistmailingz at tropicsoft.com> wrote: >> I actually found out that llvm/configure will choose clang if it is >> found in the path. This contradicts what is written at >> http://llvm.org/docs/GettingStarted.html#requirements, where it says it >> will use the first GCC it finds. Perhaps that explanation needs to be >> updated. > > Updated docs in r171630. > >> Finally I found that if llvm/configure uses clang instead of gcc, it >> invariably fails on my Linux distros because it is using the gcc >> distributed included directories and an earlier version of clang will >> often fail with these gcc header files. Once I force llvm/configure to >> use gcc, building llvm/clang succeeds again. > > Right. Maybe we need to skip old clang versions in this case.I think this should be done until clang can use its own header files and libraries, when it is installed as a binary, rather than the ones that gcc installs. In fact I am a bit amazed that clang does not already have its own header files and libraries for use when one tries llvm/configure and it sets up llvm's build system to use clang as its compiler. Is this the fault of clang or is it the fault of the llvm/configure system ?
Possibly Parallel Threads
- [LLVMdev] Building llvm from source with clang instead of gcc
- [LLVMdev] Building llvm from source with clang instead of gcc
- [LLVMdev] Building llvm from source with clang instead of gcc
- [LLVMdev] Building llvm from source with clang instead of gcc
- [LLVMdev] Building llvm from source with clang instead of gcc