Skip to content
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

[feature] do we need MesonLayout? #9713

Closed
1 task
SSE4 opened this issue Oct 3, 2021 · 6 comments · Fixed by #11618
Closed
1 task

[feature] do we need MesonLayout? #9713

SSE4 opened this issue Oct 3, 2021 · 6 comments · Fixed by #11618

Comments

@SSE4
Copy link
Contributor

SSE4 commented Oct 3, 2021

from conan-io/conan-center-index#6678 (comment)

Hooks: It's another "error" which seems to be specific to Linux, where for whatever
 reason libs and pkgconf files are installed under lib/x86_64-linux-gnu instead 
of lib (maybe a regression in MesonToolchain or new Meson helper compared to legacy Meson helper?).

we only have some predefined layouts, e.g. cmake_layout, but there is no meson_layout right now.
I am not completely familiar with this feature at the moment, so I will need some guidance, at very least:

  • does it make sense to add meson_layout?
  • will it solve the problem reported with different libs/pkgconf installation directories?
@memsharded
Copy link
Member

Yes, if Meson while building uses some kind of predefined folder structure, it would totally make sense to implement a meson_layout() helper.

will it solve the problem reported with different libs/pkgconf installation directories?

This is not completely clear, if this is to locate things inside the dependencies folders, then layout() is not the place, as layout() is intended to model the current project. It can define generators_folder to say where the generated files (from PkgConfigDeps for example), should go. Please clarify.

@SSE4
Copy link
Contributor Author

SSE4 commented Oct 5, 2021

This is not completely clear, if this is to locate things inside the dependencies folders, then layout() is not the place, as layout() is intended to model the current project. It can define generators_folder to say where the generated files (from PkgConfigDeps for example), should go. Please clarify.

this is not about dependencies, this is about recipe being built itself, as I can say.

e.g. if you create a recipe for glib, and do meson install, it will install into the os.path.join(self.package_folder, "lib") for most of the platforms (e.g. Windows, macOS and 32-bit Linux).
but for Linux x64 (at least for some of distros), it will install it into: os.path.join(self.package_folder, "lib", "x86_64-linux-gnu")

previous (old) build helper hard-coded install directory to theos.path.join(self.package_folder, "lib"):
https://github.com/conan-io/conan/blob/develop/conans/client/build/meson.py#L47

when we added a new build helper, I was told it has to be managed with layouts:
#8147 (comment)

so there are at least two ways to handle that:

  • set package_info to use os.path.join(self.package_folder, "lib", "x86_64-linux-gnu") for Linux x64
  • set build helper to always use os.path.join(self.package_folder, "lib")

I am not sure what is the most idiomatic way for conan 2.0, maybe neither of above.
I would be grateful if you could explain in the details on how to properly handle it with or without layouts.

@SSE4
Copy link
Contributor Author

SSE4 commented Oct 5, 2021

for the meson itself, it's explained a bit in their docs (https://mesonbuild.com/Builtin-options.html#directories)

libdir is automatically detected based on your platform, it should be correct when doing "native"
 (build machine == host machine) compilation. For cross compiles Meson will try to guess
 the correct libdir, but it may not be accurate, especially on Linux where different
 distributions have different defaults. Using a cross file, particularly the paths section may be necessary.

and that seems to be the code they are doing for the default libdir and some distros (at least debian based):
https://github.com/mesonbuild/meson/blob/246d5f34bbef7f179589c52ccd7d435f57108272/mesonbuild/mesonlib/universal.py#L936
(from issue mesonbuild/meson#5925)

I doubt it makes any sense to implement the similar logic in conan client.
this way, there is a risk the same package built in different distros is not reproducible.

@SSE4
Copy link
Contributor Author

SSE4 commented Oct 5, 2021

for the dependencies: I suppose as long as libraries are within CppInfo.libdirs they will be found normally by consumers, even if these directories are non-standard. ofcouse, I think it's worth to add tests for that, but that's not an issue right now.

@SSE4
Copy link
Contributor Author

SSE4 commented Oct 26, 2021

afteer looking at layouts more closer, I don't know if they are going to help with the current situation
I don't see layouts managing install directories (libdir, includedir and so on) for CMake
it seems like layouts are more about the location of sources, or location of CMakeLists.txt
maybe the management of install directories is not implemented yet, or not planned yet, IDK
therefore, I need some guidance what should be a proper fix, maybe just hard-coding libdir in build helper is enough?

@franramirez688
Copy link
Contributor

Closed by #11618
In the end, it's not needed a specific layout for meson so it's enough using the current basic_layout. Apart from that, we've added some default directories to solve other problems related.
It'll be released in the next Conan 1.51 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants