Xcode 8, C++11, and -mmacosx-version-min

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Xcode 8, C++11, and -mmacosx-version-min

Postby tomseddon » Mon Sep 19, 2016 7:46 am

(Using cef_binary_3.2785.1480.g162e9a9_macosx64.)

It's been too long (though after this I'm starting to feel like it probably still hasn't been long enough) since I've regularly used Xcode, so I upgraded to Xcode 8 the other day, forgetting what a bad idea that can be.

When building CEF3, it adds a flag to the command line: -mmacosx-version-min=10.7 (as set by CEF_TARGET_SDK in cef_variables.cmake). This seems to cause problems with C++11 stuff, as you can see with the following test: (intended to be run in /tmp or similar)

Code: Select all
tmbp /tmp % echo '#include <initializer_list>' | clang -mmacosx-version-min=10.7 -o test.obj -x c++ -c -
<stdin>:1:10: fatal error: 'initializer_list' file not found
#include <initializer_list>
         ^
1 error generated.


No such problems if you specify version 10.9 or later, or no version at all:

Code: Select all
tmbp /tmp % echo '#include <initializer_list>' | clang -mmacosx-version-min=10.9 -o test.obj -x c++ -c -
tmbp /tmp % echo '#include <initializer_list>' | clang -o test.obj -x c++ -c -


Another way of showing the error might be to add something like #include <initializer_list> at the top of cefsimple's simple_app.cc.

This is causing me problems because my program is written using C++11... Is there anything official I can do to fix this? Or am I on my own, having strayed past the recommended Xcode 7.3.1? :) Is this something that will be getting fixed in future?

(For now I've set CEF_TARGET_SDK to 10.11, and that seems to make things build at least, but I'm not sure what problems I'll encounter - since this is me working on getting the OS X build working, so I can't actually run it to check yet - and this doesn't seem like an ideal solution anyway because it requires some manual intervention after DownloadCEF.cmake has done its thing. But building cefsimple and cefclient this way does work, which makes me hopeful. Though you have to remove -Werror from the compile flags in cef_variables.cmake, because Apple have gone and deprecated a bunch of APIs that they use.)

Thanks,

--Tom
tomseddon
Newbie
 
Posts: 7
Joined: Fri Jul 29, 2016 10:34 am

Re: Xcode 8, C++11, and -mmacosx-version-min

Postby magreenblatt » Mon Sep 19, 2016 11:18 am

As you noticed building with Xcode 8 is not yet supported. If you change mmacosx-version-min then you will not be able to run your application on OS X versions older than the number you specify.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: azathioprine, Google [Bot] and 90 guests