-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcode 10 can't build C++ for OSX < 10.9 #51
Comments
apart from that, i think the strength of |
+1 on this as I have been going through a few different libs replacing build systems with pd-lib-builder there seems to be a lot of inconsistency with what the min version should be. for example one lib might need this actually happened so the case for "well documented" over adding additional complexity is strong because the min version seems to be on a case-by-case basis. |
Ah yes, that is the better idea I was hoping for, but didn't cross my mind. Users who only compile for private use don't need to define it at all. Devs and maintainers who distribute libs are probably aware of the need to support older versions. So they should either define it in the makefile if the library needs it, or else specify it at compile time. Every time. Hmmm... It's easy to forget. |
Totally agree. |
Minimum OSX version definition should be simply replaced from pdlibbuilder to lib makefile. Considering that:
... it is most logical to define it in each pdlibbuilder-including makefile, even when the lib itself isn't picky about minimum version. The role of pdlibbuilder is then to:
For most lib makefiles this approach requires some extra work. But it is fair to delegate this responsability to the lib dev or maintainer, who knows the lib content (whether it is C, C++, C++11 etc.). Discussion of what version is required per project type can happen in a 'sticky issue' that will never be closed. |
In the context of this issue I want to reference pull request #22, "Making minimum Mac OS X version configurable". I'm always trying to keep the set of 'API' variables small. In this case I decided that pdlibbuilder should respect option
At the time (2016) this seemed a satisfactory solution and the pull request proposing a dedicated variable was withdrawn. However, definition of The problem with overriding individual flags is a general one. Gcc offers hundreds of options and build systems group them in categories according to purpose. The base division is between build phases (preprocessing, compilation, linking). But the lines become blurry very quickly. Some options are required both in compilation and linking. Some options are essential and others (notably optimizations) are optional. CFLAGS is by convention the category for non-essential compiler options Pdlibbuilder defines certain essential flags for all pd libs and reserves variable I'm just thinking aloud here, no conclusion yet. |
Without reading all the details in this discussion, here are some notes I have from adapting a C++-based external to pd-lib-builder on macOS 11 with Xcode 12. TestsBuilding with
I would assume if I have an OSX 10.6 or 10.7 system, this would work fine. If Building with
I would assume if I have an OSX 10.9 or 10.10 system, this would work fine. If Building with ConclusionSimplest solution is to detect the SDK we are building with and determine what's needed to compile C++ successfully. This should not rely on the So perhaps it could be something like: ifneq ($(filter -stdlib=libc++, $(cflags)),)
ifeq ($(shell [ $(xcode.ver) -gt 5 ] && echo 1), 1)
version.flag = -mmacosx-version-min=10.9
endif
endif Xcode version 6 coincides with macOS 10.9. I think it's important to stress to people in the documentation that building for a higher deployment version means older systems will not be able to load the external. We want the makefile to be simple and easy to use, but this should also be overridable and not surprise anyone. |
To confirm, judging from this SO post, libc++ did became the default with macOS 10.9 / Xcode 6. |
(i think) the gist is, that it is probably best to drop the minimum-version altogether, and let upstream (the library developers that use pd-lib-builder to build their stuff) declare it if they absolutely want to, like so: cflags = -std=c++11
define forDarwin
cflags += -mmacosx-version-min=10.9
endef consequencesif upstream adds a minimum version
if no minimum-version is added
with my (Debian) maintainer hat on, i think it is the task of a maintainer to make sure the artifacts they produce are usable on the target machines. |
I disagree, partially. There are quite a number of consequences when the min version is missing, especially now that a certain version is required in order to load within a notarized setting without additional permissions/entitlements. At the very least, I prefer the current default which sets the min version to that used by Pd itself, if not specified. As for automatic trickery, it's not strictly required and could become a headache, yes. Doable for sure but, as you mentioned, we can quickly enter the realm of auto tools. This is why I also think issues like these are also solved in the realm of documentation, ie. "if you are using C++ on macOS, look at this example to set the correct min version and C++ lib flags." |
that's fine :-)
could you explain these consequences? (or even better: point to some documentation that explains them).
but isn't that mostly an issue with the host application (in our case: Pd), rather than the plugins (which is what pd-lib-builder targets)? afaiu, you can only notarize a binary that was built with a given min version. what exactly are the problems here? (i probably already read about it, and discarded it soon afterwards)
which problem would that solve? (i'm honestly curious; it's obviously related to the above questions) |
for what it is worth: from an "API" pov, i would prefer something like: cflags = -std=c++11
macos.minversion=10.9 and then let pd-lib-builder handle the adding of the correct flag for Darwin-builds only. i think the |
This is good.
As far as I can tell, it handles deprecation checks, API availability, weak importing, etc. (SO post) Pd itself is compiled targeting 10.6, so leaving this off is very likely to result in an external building without trying to maintain some semblance of backward compatibility. (Blog post When making anything with Xcode itself, the min version is always set.
From what I (fuzzily) remember the last time I went through this both for Pd and a project at work:
The issue of stuff built on new systems not loading on older ones because build min version > system min version.
Google/SO say it's possible via |
well yes, that's what setting the min-version does. my question was rather about what is implied by not setting it.
that's actually the idea: to optimize for "local builds" (that are to be used on the machine that executed the build), and move the "distribution maintainers" burden (make sure that things run on some random user's machine who refused to upgrade for the last 15 years) to humans. the reason for shifting the responsibility to humans is that the problem seems to be hard to solve on a generic level, but rather easy for a specific compiler.
that is good to know. |
Reportedly, option
-mmacosx-version-min
can't be defined lower than 10.9 when building C++ code with Xcode 10. I don't want to set-mmacosx-version-min=10.9
for all Pd libs and regardless of Xcode version. On the other hand I don't know right away how to define it conditionally, which would require two extra checks:Even if these conditions can be checked, the total set of conditional checks for minimum OSX version will become rather kludgy. So I'm hoping that someone comes up with a better idea. In the meantime you may need to override the minimum OSX version as defined in the makefile. This can be done on command line like so:
$ make version.flag="-mmacosx-version-min=10.9"
(edit:
version.flag
is not considered an 'API' variable, use only as temporary workaround)If your library needs a specific minimum version anyway, it can be defined in the lib Makefile:
The text was updated successfully, but these errors were encountered: