OK, back from holidays, I've mulled over what has been said by Jonathan, Douglas and Konstantin and I would like to press ahead with the Intel compatibility on my own time. However, I am a little confused by ABI compatibility. I was under the impression that if a library features anything other than the built in C types then it needs to be built with the compiler you're intending to deploy it with. While I have extensive C++ experience, I have very little compiler-tech experience, so I'm happy to be corrected and pointed to documentation on the matter.
Having re-read that paragraph, I also note that the Intel compiler is a drop-in replacement in XCode and MSVC, which runs counter to what I'm saying. So which version of libc++ is sitting on my Mac? And why have I had to roll my own std::move? I'm still keen on making libc++ buildable by the Intel compiler though. I think it would be good personal experience.
Mac OS X contains 2 standard c++ libraries:
- Apple GCC 4.2's stdlibc++ (all OS versions).
- libc++ (Mac OS 10.7 only).
By default, Xcode does not use libc++. To use it, you have to use clang as compiler, and pass -stdlib=libc++.
Using libc++ is not enough though. To be able to use std::move and other cool modern C++ features, you also have to tell Xcode to compile your code in C++0x mode.
You can do that by adding 2 other c++flags to clang: -std=c++0x -U__STRICT_ANSI__
Note that second param is to workaround a bug in system headers.
I don't know how you are supposed to tell the Intel compiler where it should look for libc++ headers, nor what subset of c++0x it support. But to use c++0x features of libc++ you will probably have to tweak the libc++ config header to teach it how to detect which features are available.
From: Howard Hinnant [mailto:firstname.lastname@example.org]
Sent: 25 August 2011 17:10
To: Guy Davidson
Subject: Re: [cfe-dev] libc++ and the Intel compiler
I work on OSX and Windows platforms and must use the Intel compiler. Assuming it's necessary for standard runtime library support, I would like to build libc++ on the OSX platform using the Intel compiler. This seems non-trivial at first glance: changing $CXX to icc and running ./buildit yields a pile of errors in algorithm.cpp and compilation is aborted.
I would be interested in the first few errors, and may be able to shed some light on them.
Has anyone tried this?
Not to the best of my knowledge. Though efforts exist in porting libc++ to other environments.
Is it a fool's errand or is it a worthwhile use of time expanding the range of compilers that can build libc++?
I do not think it is a fool's errand, especially if you're targeting OS X. The most difficult part of porting libc++ is dealing with OS issues, not compiler issues.
Is anyone already on it, and if so would you like some help?
I'm not aware of anyone, but I'd love to be surprised by someone else speaking up here. As libc++ is open source, we would love to have someone such as yourself working this area. I don't have access to icc, but am happy to interpret error messages and offer suggestions.
This email is sent by The Creative Assembly Limited company No. 03425917, registered in England & Wales registered office 27 Great West Road, Middlesex, TW8 9BW, England. The contents of this e-mail and any attachments are confidential to the intended recipient and may also be legally privileged. Unless you are the named addressee (or authorised to receive for the addressee) of this email you may not copy, disclose or distribute it to anyone else. If you have received this email in error, please notify us immediately by e-mail on email@example.com and then delete the email and any copies. The Creative Assembly Limited have made all reasonable efforts to ensure that this e-mail and any attached documents or software are free from software viruses, but it is the recipient's responsibility to confirm this.
cfe-dev mailing list