[cfe-users] Problem installing Clang

Hans Wennborg hans at chromium.org
Tue Mar 25 13:05:50 PDT 2014


Hi John,

On Sat, Mar 22, 2014 at 2:51 AM, John Pote <johnhpote at o2.co.uk> wrote:
> Are there any examples of using clang? I mean are there any environment
> variables that need setting, how does the compiler know which language to
> compile for, link to required libraries etc.

I don't know of any good examples unfortunately :/ Our user manual is
not great in this respect.

There are basically two ways of using clang on Windows. You can either
use it as you would use gcc in a MinGW environment. clang and clang++
are designed to take the same command-line arguments as gcc and g++.

The other, newer and more experimental way, is to use clang in a
Visual Studio environment. They easiest way to do this is to run Clang
inside an environment set up by Visual Studio's envsetup.bat and then
use clang-cl.exe instead of cl.exe. clang-cl will look for headers and
libraries the same way that cl.exe does, and accept (mostly) the same
command-line arguments.

clang-cl can also be used from inside the Visual Studio IDE by
selecting LLVM as the Platform Toolset in the project properties.

Hope this helps,
Hans

> On 22/03/2014 02:50, Hans Wennborg wrote:
>>
>> Hi John,
>>
>> On Fri, Mar 21, 2014 at 3:58 AM, John Pote <johnhpote at o2.co.uk> wrote:
>>>
>>> Thought I would give clang a try out so installed version 3.4 pre-built
>>> binary "Clang for Windows (.sig)" from
>>> http://llvm.org/releases/download.html#3.4.
>>> Installation seemed to go OK.
>>>
>>> When I tried to run clang.exe I received a windows error message stating
>>> that the .exe was not a valid win32 executable. So I tried some of the
>>> other
>>> executables in the bin directory, all of them gave the same result.
>>>
>>> My PC is running Win XP professional 5.1 with service pack 3.
>>
>> The 3.4 release for Windows doesn't support Windows XP. Unfortunately
>> we didn't realize this until after the release.
>>
>> The good news is that the more recent versions of the snapshots at
>> http://www.llvm.org/builds/ are built with XP support.
>>
>>> Also I could not find any docs on how to  use clang. The on line
>>> http://clang.llvm.org/docs/UsersManual.html is a little sparse. Curiously
>>> while I did find most of the usual include files I could not find stdio.h
>>> .
>>
>> stdio.h isn't included because we don't provide a C standard library.
>> You'll have to use the standard library from Visual Studio or MinGW.
>>
>> Hope this helps,
>> Hans



More information about the cfe-users mailing list