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
[SR-2342] Support standalone builds of a full CoreFoundation.framework #4341
Comments
The `Framework` target type is not really supported (it was partially abandoned since Linux targets don't support framework linker and compiler flags). `DynamicLibrary` would be the correct target type. However we would need to add a number of linkages (but imho the swift-corelibs-foundation should be still linking CF statically into Foundation) |
Comment by Dan Peebles (JIRA) Ah, that makes sense. I agree that this I'm basically looking for expertise in bridging the gap between what's currently in this repository (which looks ideal in terms of pure C code) and what we currently have in CF-lite. I can maintain build scripts on my side to glue together all the headers and framework folder paths, but that kind of logic seems like it belongs upstream somewhere. Ultimately, if this were my project, I'd probably split CF out into swift-corelibs-corefoundation, give it the ability to build dynamically, statically, and a standard framework, and then have swift-corelibs-foundation statically depend on that. Obviously that's not my call to make, but it would obviously please me and your loyal (wannabe) Nix users 🙂 |
Well the one part of building a framework target is that if a user builds it for Mac OS X, that CF will NOT work as a replacement to the system one. So I think if we kept it as a dylib/so it would keep in line with the concept of CFLite and perhaps be slightly easier to keep up to date. I don't think at the current moment we will be splitting them up since CF is an "implementation detail" of swift-corelibs-foundation. But I think it might be reasonable to alter the config file to support both a static and dynamic product. |
It is also worth noting that I have tinkered around with alternate builder-build systems for swift-corelibs-foundation (cmake etc). So I don't think we are married to the idea of the python monstrosity and that could be simplified down to something else that we could pass the buck and not have to maintain. |
Comment by Dan Peebles (JIRA) Yeah, definitely wasn't intending to replace the system framework. A big part of Nix is that we don't touch system files. Anyway, perhaps I should try submitting a PR adding a |
I think if the configure script had some sort of parameter to determine which build path is taken that would help, perhaps take a line out of the page of other config scripts with parameters passed to the configure script of `- |
Comment by Dan Peebles (JIRA) Just to elaborate on the sort of thing I'm looking for, we're currently in an awkward spot between http://opensource.apple.com/source/CF/CF-1153.18 and the CoreFoundation in the swift open releases. The former has a nice Makefile that builds a full .framework with all the headers and other files in the places they belong, but is unfortunately redacted and doesn't provide the full functionality of the latter. The latter has more functionality but has no build process to produce the .framework. I hope to be looking at the To put it differently, if you don't want to add build code to produce the .framework, can the CoreFoundation subdirectory include a quick readme explaining the core remaining differences between it and the system CF? Thanks! |
Comment by Dan Peebles (JIRA) This was one of my original tickets against the repo a bajillion years ago, and I mentioned this request again more recently on the forum. I'm now wondering: I do have Relatedly, there's a fair amount of duplication between the two Does any/all of that sound appealing? I'm mostly somewhat constrained by not knowing who uses what and how (like are these |
I don't know about build.py disappearing next week, but I think it would be best for us to consider using CMake in the future. We avoided it early on because of the additional complexity, but the fact is that most of the rest of the Swift stack is using it. It may be better to remain consistent. Unfortunately I'm not a domain expert on CMake so I'm not 100% sure what the impact may be on switching to it from our custom build stuff. |
Additional Detail from JIRA
md5: 64fb215d00bd420034547cca8a6c30c9
Issue Description:
I was very pleased to see 87d1a97, which allowed us to build CoreFoundation independently of Foundation, but that build still only builds a static library. A naive switch ofStaticLibrary
toFramework
leads to weird ninja dependency errors (I can't find an example using theFramework
product), and switching it forDynamicLibrary
produces a ton of linker errors (mostly because it doesn't link ICU or libxml2, and doesn't inject all the__UNICODE
symbols into the result object).Highlighting@phausleras the author of the commit in question.Edit: the above is all currently fixed, and
DynamicLibrary
is now the default. This issue is about trying to switchDynamicLibrary
toFramework
.Motivation: the Nix package manager aims to be a (nearly) fully deterministic build system (with a strong preference for builds from source), and as part of that we build a full Mac toolchain from scratch (no Xcode or command-line tools). To do that, we use a wide range of Apple's open-source releases on opensource.apple.com. Unfortunately, Apple only releases a reduced version of CoreFoundation on there, and although it works for most of our use cases, the slight discrepancies between CF (-lite) and the proper CoreFoundation cause us some subtle issues. The CoreFoundation included in the swift Foundation project appears to be more complete and better suited to our use case.
The text was updated successfully, but these errors were encountered: