[cfe-dev] Fw: Building Clang+LLVM using Clang

Marc J. Driftmeyer mjd at reanimality.com
Tue May 29 16:15:14 PDT 2012


I build with either using the include Cmake option or autoconf/makefile 
option, but one thing is clear, just export CC=clang and export 
CXX=clang++ doesn't cut it, especially on Linux.

My Linux System:

  * Debian Sid/Experimental
  * 3.2.x kernel with LLVM/Clang 3.1 installed under /usr
  * LLVM/Clang trunk installed under /usr/local

So, if I'm going to move from GCC -> self-hosting against the newly 
build llvm/clang from trunk I'm passing /usr/local/bin/clang and 
/usr/local/bin/clang++ in

For Cmake:

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/clang++

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/local/bin/clang


via the

$ cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ 
-DCMAKE_C_COMPILER=/usr/local/bin/clang ../trunk/llvm

and any other custom flags like CMAKE_CXX_FLAGS= and CMAKE_C_FLAGS= not 
to mention Boolean flags for optimizations according to what my CPU can 
muster.

The autoconf configure flags listed like you cite but I tend to pass

$ CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ 
../llvm/trunk/configure --disable-assertions --enable-optimized 
--disable-shared --enable-targets=x86_64 and --prefix=/usr/local

and any other flags I see fit.

- Marc

On 05/29/2012 05:27 AM, Murat B wrote:
> Thanks David and Nikola for your replies.
>
> I configure using following commands.
>
> export CC=clang
> export CXX=clang++
> ../configure --disable-assertions --enable-optimized --disable-shared --enable-targets=x86_64
>
>
> I am trying to build it on a x86-64 architecture.
> Do I need to provide more information to the Clang compiler?
>
> Thanks a lot!
> Murat
>
>
> ----- Forwarded Message -----
> From: David Chisnall<csdavec at swan.ac.uk>
> To: Murat B<murat8307 at yahoo.com>
> Cc: "cfe-dev at cs.uiuc.edu"<cfe-dev at cs.uiuc.edu>
> Sent: Tuesday, May 29, 2012 10:45 AM
> Subject: Re: [cfe-dev] Building Clang+LLVM using Clang
>
> Your problem is a missing definition from a system header.  Without knowing what your target OS is, no one will be able to help you...
>
> David
>
> On 29 May 2012, at 09:55, Murat B wrote:
>
>> Hello,
>>
>> I built the Clang using gcc and want to build Clang+LLVM using the already built Clang.
>>
>> My compilation terminates by outputting following error messages:
>>
>> /home/murat/llvm/lib/Support/IsInf.cpp:41:3: error: "Don't know how to get isinf()"
>> # error "Don't know how to get isinf()"
>>     ^
>> /home/murat/llvm/lib/Support/IsInf.cpp:46:30: error: use of undeclared identifier 'isinf'
>> int IsInf(float f)  { return isinf(f); }
>>                                ^
>> /home/murat/llvm/lib/Support/IsInf.cpp:47:30: error: use of undeclared identifier 'isinf'
>> int IsInf(double d) { return isinf(d); }
>>                                ^
>> 3 errors generated.
>> make[1]: *** [/home/murat/llvm/build/lib/Support/Release/IsInf.o] Error 1
>> make[1]: Leaving directory `/home/murat/llvm/build/lib/Support'
>> make: *** [all] Error 1
>>
>> It seems the compilation cannot find the standard header files.
>>
>> I compile using following flags:
>> -I/home/murat/llvm/build/include
>> -I/home/murat/llvm/build/lib/Support
>> -I/home/murat/llvm/include
>> -I/home/murat/llvm/lib/Support
>> -DNDEBUG
>> -D_GNU_SOURCE
>> -D__STDC_CONSTANT_MACROS
>> -D__STDC_FORMAT_MACROS
>> -D__STDC_LIMIT_MACROS
>> -O0
>> -fomit-frame-pointer
>> -fno-exceptions
>> -fPIC
>> -Woverloaded-virtual
>> -Wcast-qual
>> -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default
>>
>> Can anybody let me know which flags I need to compile Clang+LLVM using Clang and what I do wrong?
>>
>> Thanks a lot for your help!
>> Murat
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
Marc J. Driftmeyer
Email :: mjd at reanimality.com <mailto:mjd at reanimality.com>
Web :: http://www.reanimality.com
Cell :: (509) 435-5212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120529/ffb826da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjd.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120529/ffb826da/attachment.vcf>


More information about the cfe-dev mailing list