Updating to Xcode 10


John Brownie
 

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


 



On Sep 20, 2018, at 12:32 AM, John Brownie <john_brownie@...> wrote:

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

I build a lot of C++ and I don’t think I’ve ever seen that. Are you overriding the header search path or specifying any exotic compiler flags already? And double-check that you’ve got a valid SDK selected.

‘-std=libc++’ seems fishy to me, since the value of -std is supposed to be a language version like “c++11”.

—Jens


Alex Zavatone
 

Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland



John Brownie
 

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:

Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Jack Brindle
 

John;

It’s usually a good thing to read the release notes for each version of Xcode. The Xcode 10 release notes directly mention the issue you are facing:

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)

Libgcc is obsoleted. Xcode 10 can no longer build apps with deployment targets of macOS 10.4 and 10.5. (42818150, 38035243) 


It looks like they really want you to change libraries to use libc++.

Jack


On Sep 21, 2018, at 3:33 AM, John Brownie <john_brownie@...> wrote:

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:
Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland






--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland





John Brownie
 

Oh boy. I am only targeting macOS (10.9 for this release), so it should still be doable. This will be a stop-gap while I work on the migration of the whole code base to Swift. I'm relying on a third-party base, Nano, which is coded with the GNU stdlib in mind, and that's one more reason to move to Swift.

In the meantime, is it going to be possible to add a version of libstdc++ to Xcode? Given code signing and all that, I guess it wouldn't be possible to stick it into the SDK, so it would have to be /usr/include or /usr/local/include. Is the best way to go through the whole gcc installation, or is there a shortcut I can make?

Thanks for pointing out the release notes. Life is too short to read everything when trying to catch up after several months away from the project!

John

Jack Brindle via Groups.Io wrote on 21/9/18 15:22:
John;

It’s usually a good thing to read the release notes for each version of Xcode. The Xcode 10 release notes directly mention the issue you are facing:

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)

Libgcc is obsoleted. Xcode 10 can no longer build apps with deployment targets of macOS 10.4 and 10.5. (42818150, 38035243) 


It looks like they really want you to change libraries to use libc++.

Jack


On Sep 21, 2018, at 3:33 AM, John Brownie <john_brownie@...> wrote:

I discovered one thing that is a bug in Xcode. In the section Apple Clang - Language - C++, if you set the C++ Standard Library to the option libstdc++ (GNU C++ Standard Library), it generates the -std=libstdc++. When it fails to find it, it generates the erroneous warning.

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

John

Alex Zavatone via Groups.Io wrote on 20/9/18 21:24:
Did you change your linked library to the new C++ one?

On Sep 20, 2018, at 2:32 AM, John Brownie <john_brownie@...> wrote:

After a hiatus of some months, I'm back to programming, and just got Xcode 10 installed. When I go to build, I get all kinds of changes suggested. I make some, but then I get stuck some that I cannot work out. My project is a mixture of Objective-C, Objective-C++, C++, and a little Swift (in a separate target).

When I start to build the first target, clang gives the the warning:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

OK, so I add a compiler flag as suggested, and I get the following warnings:
error: invalid value 'libc++' in '-std=libc++'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

Using one of those (c++11), brings me back to the first warning. And then the compiler can't find the standard library headers (e.g. <algorithm>), anyway.

One of the suggested changes was "Update C++ Standard Library", so I reverted to pre-changes and didn't make that change, which got me to the second set of warnings.

Anyone have an idea how to break out of this cycle?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland






--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland





--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


John Brownie
 

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Sean McBride
 

On Fri, 21 Sep 2018 16:52:32 +0300, John Brownie said:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and
that solves the issue for now. I'd better get a move on with the Swift
rewrite!
How could rewriting in a different language be easier/faster than tweaking your C++ to work with a different STL library? Most C++ code should be agnostic towards which STL lib is being used anyway, no?

Sean


 



On Sep 21, 2018, at 1:33 AM, John Brownie <john_brownie@...> wrote:

Anyway, it looks as though the issue is that the C++ library that I rely on is built with the GNU C++ Standard Library in mind, and that is not present on my machine. I assume that it disappeared at some point in the past, possibly between Xcode 9.2 (which was the last version I was using) and Xcode 10.0. Is there a way to get it back?

Xcode stopped supporting the GNU C++ lib a few releases ago. You’ll need to use Clang’s libc++ instead. Hopefully there should be few compatibility problems.

—Jens


Alex Zavatone
 

How is this not solved by adding libc++.tbd to the project’s Link Binary With Libraries phase?

On Sep 21, 2018, at 8:52 AM, John Brownie <john_brownie@...> wrote:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland



John Brownie
 

Because it needs the GNU standard library. It's not just STL, but other things there that are different to the current standard library.

Alex Zavatone via Groups.Io wrote on 22/9/18 00:30:

How is this not solved by adding libc++.tbd to the project’s Link Binary With Libraries phase?

On Sep 21, 2018, at 8:52 AM, John Brownie <john_brownie@...> wrote:

I bit the bullet and deleted Xcode 10 and reinstalled Xcode 9.4.1, and that solves the issue for now. I'd better get a move on with the Swift rewrite!

Thanks for all the help.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland