libc++ on Mac OS X 10.6

When trying to use libc++ on a trunk clang on Mac OS X 10.6, I get:

/llvm-bin/bin/clang++ temp.cc -stdlib=libc++
clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

This used to work on 10.6. Was there a good reason for breaking this on 10.6, and is there any workaround?

I find this disappointing, as I had hoped the next release of clang, with libc++, would provide a good base-line C++0x compiler. However, I would really like not to require 10.7, as I know various people who do not intend to upgrade any time soon.

Sorry about that. I've updated the instructions for building on 10.6. Do:

$ export MACOSX_DEPLOYMENT_TARGET=10.6

prior to ./buildit

Howard

When trying to use libc++ on a trunk clang on Mac OS X 10.6, I get:

/llvm-bin/bin/clang++ temp.cc -stdlib=libc++
clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

This used to work on 10.6. Was there a good reason for breaking this on 10.6, and is there any workaround?

I find this disappointing, as I had hoped the next release of clang, with libc++, would provide a good base-line C++0x compiler. However, I would really like not to require 10.7, as I know various people who do not intend to upgrade any time soon.

Sorry about that. I've updated the instructions for building on 10.6. Do:

$ export MACOSX_DEPLOYMENT_TARGET=10.6

prior to ./buildit

That seems to work for libc++. However, the problem persists when building an XCode project on 10.6:

clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

When I change the build variable MACOSX_DEPLOYMENT_TARGET to 10.7, the project builds, but of course crashes on
startup.

The TOT from last week worked perfectly. Is there a non-political (i.e. not Apple wanting people to ditch 10.6)
reason for this change?

Thanks in advance,
Jonathan

The commit you're looking for is r141374 ( https://llvm.org/viewvc/llvm-project?view=rev&sortby=log&revision=141374 )

Until you got an official response, you can at least look at the changes, and patch your local clang copy to be able to continue to use clang/libc++ on 10.6.

-- Jean-Daniel

Hello Jean-Daniel,

The TOT from last week worked perfectly. Is there a non-political (i.e. not Apple wanting people to ditch 10.6)
reason for this change?

The commit you're looking for is r141374 ( https://llvm.org/viewvc/llvm-project?view=rev&sortby=log&revision=141374 )

Until you got an official response, you can at least look at the changes, and patch your local clang copy to be able to continue to use clang/libc++ on 10.6.

Thank you for your research! I guess I'll be doing that.

Jonathan

Seems like that changes in ToolChains.cpp are related to iOS simulator, and commit message states about "Lion support", not dropping of everything else :slight_smile:

Yes, but despite its name, it looks like that LibCXXForSimulator is checked even when you don't target iOS (or iOS simulator).

-- Jean-Daniel

/llvm-bin/bin/clang++ temp.cc -stdlib=libc++
clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

This used to work on 10.6. Was there a good reason for breaking this on 10.6, and is there any workaround?

I find this disappointing, as I had hoped the next release of clang, with libc++, would provide a good base-line C++0x compiler. However, I would really like not to require 10.7, as I know various people who do not intend to upgrade any time soon.

Sorry about that. I've updated the instructions for building on 10.6. Do:

$ export MACOSX_DEPLOYMENT_TARGET=10.6

prior to ./buildit

That seems to work for libc++. However, the problem persists when building an XCode project on 10.6:

> clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

When I change the build variable MACOSX_DEPLOYMENT_TARGET to 10.7, the project builds, but of course crashes on
startup.

The TOT from last week worked perfectly. Is there a non-political (i.e. not Apple wanting people to ditch 10.6)
reason for this change?

> he commit you're looking for is r141374 ( https://llvm.org/viewvc/llvm-project?view=rev&sortby=log&revision=141374 )

Until you got an official response, you can at least look at the changes, and patch your local clang copy to be able to continue to use clang/libc++ on 10.6.

Seems like that changes in ToolChains.cpp are related to iOS simulator, and commit message states about "Lion support", not dropping of everything else :slight_smile:

Unless you only support the latest and greatest :wink:

Yes, but despite its name, it looks like that LibCXXForSimulator is checked even when you don't target iOS (or iOS simulator).

Then I would guess it's simply a bug that Howard did not catch because he is already using 10.7.

Jonathan

P.S: After changing line 929 of ToolChains.cpp to "isMacosxVersionLT(10, 6)", clang again compiles source for 10.6.
Thanks again, Jean-Daniel!

I have no knowledge of the change in ToolChains.cpp. I was not the author, and I'm not familiar with this code. Note that Apple never supported libc++ on 10.6, and I am not testing against it. The port to 10.6 was purely open source. I was aware you could use libc++/clang from the command line on 10.6, but I didn't know you could use it from within Xcode on 10.6.

As this is an open source project, perhaps you can lobby for the change you want. :slight_smile:

Howard

Hello,

That seems to work for libc++. However, the problem persists when building an XCode project on 10.6:

> clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)

When I change the build variable MACOSX_DEPLOYMENT_TARGET to 10.7, the project builds, but of course crashes on
startup.

The TOT from last week worked perfectly. Is there a non-political (i.e. not Apple wanting people to ditch 10.6)
reason for this change?

> he commit you're looking for is r141374 ( https://llvm.org/viewvc/llvm-project?view=rev&sortby=log&revision=141374 )

Until you got an official response, you can at least look at the changes, and patch your local clang copy to be able to continue to use clang/libc++ on 10.6.

Seems like that changes in ToolChains.cpp are related to iOS simulator, and commit message states about "Lion support", not dropping of everything else :slight_smile:

Unless you only support the latest and greatest :wink:

Yes, but despite its name, it looks like that LibCXXForSimulator is checked even when you don't target iOS (or iOS simulator).

Then I would guess it's simply a bug that Howard did not catch because he is already using 10.7.

Jonathan

P.S: After changing line 929 of ToolChains.cpp to "isMacosxVersionLT(10, 6)", clang again compiles source for 10.6.
Thanks again, Jean-Daniel!

I have no knowledge of the change in ToolChains.cpp. I was not the author, and I'm not familiar with this code.

Yes, sorry, I simply assumed that you made the change, as it's related to libc++.

Note that Apple never supported libc++ on 10.6, and I am not testing against it. The port to 10.6 was purely open source. I was aware you could use libc++/clang from the command line on 10.6, but I didn't know you could use it from within Xcode on 10.6.

Just change the path in XCode's clang plugin and pass -stdlib=libc++ and -lc++, and you're good to go. I've been
using clang TOT for about a year now, and clang/libc++ for half a year.

As this is an open source project, perhaps you can lobby for the change you want. :slight_smile:

I lobby to revert r141374, since it breaks existing functionality :slight_smile:

Also, what about build bots for libc++? libc++ should be integrated into LLVM's testing infrastructure.

Jonathan

Thanks for tracking this down.

Apple only supports libc++ on Mac OS 10.7, so Apple's compiler checks for an appropriate deployment target when the user requests libc++.

However, it doesn't make sense to have this restriction for the open-source compiler. We'll remove it.

  - Doug