-
Notifications
You must be signed in to change notification settings - Fork 952
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
[bug] PkgConfigDeps: -F <frameworkdir> on macOS leads to "clang: error: no such file or directory:" at link time #11867
Comments
Hi @SpaceIm Thanks for reporting the issue! In a nutshell, the explanation is as follows:
@property
def framework_paths(self):
if self._framework_paths is None:
self._framework_paths = self._filter_paths(self.frameworkdirs)
return self._framework_paths
Given that, the remaining question is, why is So, I think that the workaround could come in two ways:
def package_info(self):
self.cpp_info.frameworkdirs = []
I was wondering if it could be possible to declare in Conan 1.x |
It means updating 1300+ recipes in conan-center :/
zlib recipe has a layout: |
We can start with the recipes causing failures, I bet there won't be 1300. The recipes were always declaring by default |
All recipes potentially cause failures for consumers, since it affects a generator. For the specific case of glib recipe migration to conan v2, indeed we have to fix few recipes only (at least pcre2, pcre & zlib). But hardcoding I still don't understand: Do we need to hardcode |
I don't understand what you mean. For me it is not strange at all because Conan 1.X always had a default to
It is needed because the consumers using v2 generators won't skip the non-existing folders. |
When you say "In Conan v2 (OR recipes using the layout())", does it mean that in conan v1 mode, a recipe with a layout like cmake_layout shouldn't populate frameworksdirs by default? Because latest RREV of zlib has a cmake_layout, but still, its frameworksdirs is not empty. |
Not True. With Conan 1.51.3, zlib/1.2.12 with layout, using set(zlib_FRAMEWORK_DIRS_RELEASE ) Without layout(): set(zlib_FRAMEWORK_DIRS_RELEASE "${zlib_PACKAGE_FOLDER_RELEASE}/Frameworks") |
Indeed, I've checked in the latest log of conan-io/conan-center-index#12221, and I don't see zlib frameworks dirs injection anymore (I see bzip2 & pcre2 Frameworks dir. bzip2 recipe has been updated 2 days ago, so it should be fine now. Remains pcre2 recipe to update). |
@franramirez688 I think we talked about it before. I have experienced the same problem already in conan-io/conan-center-index#11139 |
@SSE4 Maybe a CCI hook should be implemented to enforce |
yes, I think it can be enforced. I believe we already have layouts for most of the build helpers (AutTools, CMake, MSBuild and Meson). for others, hand-crafted layout could be used. |
Note: In case you consider it. To activate the "2.0" mode an empty |
for the record (probably, irrelevant for this issue), this behavior might be consuming for newcomers: having an empty method doing essentially nothing, but has some important side-effects. reference also currently says nothing about that "side-effect" :https://docs.conan.io/en/latest/reference/conanfile/methods.html#layout |
I don't think the bug here is what it seems it is. Simply providing non-existing directory for "-F" won't cause an error. The bug here is that "-F" flag and the proceeding directory are treated as different.
This should be
The first line will only cause a warning, but the third line will cause the error, because it should be preceeded by "-F" flag. This happens because autotools (in my case with imagemagick), pkgconfig and apparently meson reorder the flags and remove duplicates. |
In my case, doing a workaround patch like this, which just removed the space in between fixed the issue: if self.settings.os == "Macos":
# FIXME workaround bug with pkgconfig files and apple frameworks
# see https://github.com/conan-io/conan/pull/12307
for pc in glob.glob(os.path.join(self.generators_folder, "*.pc")):
files.replace_in_file(self, pc, "-F ", "-F", strict=False)
files.replace_in_file(self,
os.path.join(self.generators_folder,
"conanautotoolsdeps.sh"),
"-F ", "-F", strict=False) |
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
conan create . glib/2.73.3@ -o "*":shared=True -o libelf:shared=False
glib build system is Meson, but it can be reproduced as well with a simple CMakeLists relying on pkg_check_modules() and a shared dependency (not tried with static).
If I tweak this PR by replacing PkgConfigDeps by pkg_config generator (also need to move these .pc files in generator folder expected by layout), the build succeeds. It fails afterwards in test_package since it also relies on PkgConfigDeps (with CMake build system).
Logs (Executed commands with output) (Include/Attach if Applicable)
The text was updated successfully, but these errors were encountered: