You are not logged in.

#1 2009-12-17 14:47:51

LiteHacker
Member
Registered: 2008-11-27
Posts: 38
Website

Using llvm and clang

Hey guys,
For those of you that don't know, clang and llvm were built to eventually replace gcc.
I'm trying to run it now from the Archlinux packages.
For some reason clang and llvm are separate packages. Additionally, clang does not depend on llvm - it depends on gcc-libs.

Can anyone explain this to me?
If you install llvm by itself, you can run llvmc with some sample c program - it complains that llvm-gcc isn't present. You can get that from the AUR, but from what I understand, llvm-gcc is not clang.
If you install clang by itself, it generates c files almost the same way gcc does, without llvm.

Can someone tell me what's wrong? How do you like clang and llvm together?

Thank you,
LiteHacker

Offline

#2 2009-12-17 15:15:53

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: Using llvm and clang

clang actually includes llvm, at least the binary package I downloaded from the llvm web site does. I checked the pkgbuild and it uses the llvm sources from svn, so I guess it does, too.

If you check "llvmc --help", llvmc includes the option "-clang" to make it use clang instead of llvm-gcc as frontend. But this should automatically be done if you build clang.

Offline

#3 2009-12-17 15:23:41

LiteHacker
Member
Registered: 2008-11-27
Posts: 38
Website

Re: Using llvm and clang

$ llvmc -clang hello.c -o hello3
/usr/bin/ld: warning: cannot find entry symbol mit-llvm-bc; defaulting to 080482f0
llc: bitcode didn't read correctly.
Reason: Invalid bitcode signature

Offline

#4 2009-12-17 15:52:40

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: Using llvm and clang

$ clang hello.c -o hello
$ ./hello 
Hello World
$ llvmc -clang hello.c -o hello
/usr/bin/ld: warning: cannot find entry symbol mit-llvm-bc; defaulting to 0000000008048330
llc: bitcode didn't read correctly.
Reason: Bitcode stream should be a multiple of 4 bytes in length

I can confirm this behaviour with 2.6, but just invoking clang directly works fine.

Offline

#5 2010-05-24 16:00:51

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Using llvm and clang

Sorry for the necropost, but is it safe to assume that llvm can be used as a drop-in replacement for GCC?

Offline

#6 2010-05-24 17:44:14

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Using llvm and clang

Well, clang can be used as a drop-in replacement for GCC.

Offline

#7 2010-05-24 18:45:31

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Using llvm and clang

clang works really well for me. The error reporter is _A LOT_ nicer than the GCC counterpart. As for the code generation... not sure.

Offline

Board footer

Powered by FluxBB