[CLang] First try

Hi!

I’m following the CLang developpement for some time but didn’t try to use it until this week (on spare time).

Could someone confirm me some points I hit while trying to use CLang?

  1. I first installed llvm/clang 1.28 on Ubuntu 10.10. I tried to simply compile a hello world like this one (from memory) :

#include

int main()
{
std::cout << “Hello, World!” << std::endl;
std::cin.ignore();
return 0;
};

Clang couldn’t find iostream. From the website I see that I might require to change a line of code of clang to make it use gcc’s std include folder. Am I right?

  1. I switched to Windows but this time wanted to compile CLang (I’m more used to Visual Studio than other environnement for C++) and start looking at the code once it runs correctly. I got the 1.28 tag version.
    I used cmake to generate the 64bit version of the project files for Visual Studio 2010. It generates almost correctly but there seem to be a lib missing, making the whole compilation never work without this lib undefined (in CMake files?). Am I correct in thinking this is not supported yet?

  2. Then I switch to 32bit “normal” Visual Studio 2010 projects. Everything compiled apparently correctly (wel done guys! :smiley: ). I built directly the Release mode
    Is the Release mode the final binary mode or is the small size mode the final one?

  3. Then I tried to build the same (rewritten from memory) hello world than previously. I got a bunch of errors because it seem that it tries to use VS2010 STL headers (that’s ok) but C++0x R-Value References don’t seem to be supported so it couldn’t handle the headers that seem to heavily use it (as VS2010 implement a version of RVR ).
    a. I might have not looked at the right documentation but I couldn’t find a way to try activate C++0x features in CLang. I know there should be only minor support for this at the moment, but is there such a command line parametter?
    b. Does this relate exclusively to the fact that the current version doesn’t totally works with those headers? I know this is a work in progress, from what I’ve read on this list.
    c. Is there a way to set another std include folder to use without having to recompile CLang?

Thanks for your time.

Joël Lamotte.

Klaim <mjklaim@gmail.com> writes:

[snip]

2. I switched to Windows but this time wanted to compile CLang (I'm more
used to Visual Studio than other environnement for C++) and start looking at
the code once it runs correctly. I got the 1.28 tag version.
    I used cmake to generate the 64bit version of the project files for
Visual Studio 2010. It generates almost correctly but there seem to be a lib
missing, making the whole compilation never work without this lib undefined
(in CMake files?). Am I correct in thinking this is not supported yet?

Please submit a bug report for that, with full copy&paste of the errors
found.

3. Then I switch to 32bit "normal" Visual Studio 2010 projects. Everything
compiled apparently correctly (wel done guys! :smiley: ). I built directly the
Release mode
    Is the Release mode the final binary mode or is the small size mode the
final one?

That is up to you to decide.

4. Then I tried to build the same (rewritten from memory) hello world than
previously. I got a bunch of errors because it seem that it tries to use
VS2010 STL headers (that's ok) but C++0x R-Value References don't seem to be
supported so it couldn't handle the headers that seem to heavily use it (as
VS2010 implement a version of RVR ).

clang support for Windows is flaky at best. It is being improved,
though. clang support for C++0X is lacking wrt other compilers. This
creates problems when using VS2010 headers, which enable C++0X features
by default, and recent libstdc++ when you enable C++0X support on clang.

    a. I might have not looked at the right documentation but I couldn't
find a way to try activate C++0x features in CLang. I know there should be
only minor support for this at the moment, but is there such a command line
parametter?

Yes, the same as g++: -std=XXX (where XXX is c++0x, for instance.)

[snip]

Hi!

Please submit a bug report for that, with full copy&paste of the errors
found.

I’ll reproduce the steps and report the problem, ok

  1. Then I switch to 32bit “normal” Visual Studio 2010 projects. Everything
    compiled apparently correctly (wel done guys! :smiley: ). I built directly the
    Release mode
    Is the Release mode the final binary mode or is the small size mode the
    final one?

That is up to you to decide.

Yes but I meant : if a binary installer was produced for clang, wich version would be distributed? Both?

clang support for Windows is flaky at best. It is being improved,
though. clang support for C++0X is lacking wrt other compilers. This
creates problems when using VS2010 headers, which enable C++0X features
by default, and recent libstdc++ when you enable C++0X support on clang.

Do you mean that activating C++0x automatically forces libstdc++ as std library? If that’s so, I think I’ll simply do that on all platforms.
(And I’ll try a bit of the EASTL bits that are out now - the full release might happen soon : http://www.ogre3d.org/forums/viewtopic.php?f=16&t=60885

a. I might have not looked at the right documentation but I couldn’t
find a way to try activate C++0x features in CLang. I know there should be
only minor support for this at the moment, but is there such a command line
parametter?

Yes, the same as g++: -std=XXX (where XXX is c++0x, for instance.)

Thanks, I’m not really familiar with g++ for the moment (learning on spare time at the moment) so I didn’t guess.

Klaim <mjklaim@gmail.com> writes:

> 3. Then I switch to 32bit "normal" Visual Studio 2010 projects.
Everything
> compiled apparently correctly (wel done guys! :smiley: ). I built directly the
> Release mode
> Is the Release mode the final binary mode or is the small size mode
the
> final one?

That is up to you to decide.

Yes but I meant : if a binary installer was produced for clang, wich
version would be distributed? Both?

In theory, the currently selected build type when you execute the
INSTALL target. I've never installed LLVM from the MSVC IDE, though.

clang support for Windows is flaky at best. It is being improved,
though. clang support for C++0X is lacking wrt other compilers. This
creates problems when using VS2010 headers, which enable C++0X features
by default, and recent libstdc++ when you enable C++0X support on clang.

Do you mean that activating C++0x automatically forces libstdc++ as std
library?

By default, clang uses libstdc++ when compiled by g++. If you activate
C++0X in clang it will activate C++0X in libstdc++ too, and then clang
will fail on most cases because libstdc++ (in C++0X mode) uses features
not yet supported by clang.

[snip]