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

[bug] LIB_DIRS from a meson package and cmake_find_package grenerator does not match #10762

Closed
hstejas opened this issue Mar 12, 2022 · 7 comments

Comments

@hstejas
Copy link

hstejas commented Mar 12, 2022

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 21.10
  • Compiler+version: gcc-11
  • Conan version: 1.46
  • Python version: 3.9.7

Steps to reproduce (Include if Applicable)

Similar to #10705

  • Create a new project with conan new abc/v1 --template=meson_lib (some changes were done to adapt to existing code)
  • conan create .
  • In a different project i have a conanfile.txt with
[requires]
abc/v1
[generators]
cmake_find_package

Logs (Executed commands with output) (Include/Attach if Applicable)

The meson pacage is installed in some path similar to ~/.conan/.../lib/x86_64-linux-gnu/ but the generated Findabc.cmake has set(abc_LIB_DIRS ".../.conan/data/.../package/fa9464e97e40f8d42250528fd396f66f62b6a0b2/lib").

x86_64-linux-gnu seems to be missing

@hstejas hstejas changed the title [bug] Libs from meson package and cmake_find_package greneration does not match [bug] LIB_DIRS from a meson package and cmake_find_package grenerator does not match Mar 12, 2022
@memsharded
Copy link
Member

Hi @hstejas

The way to consume it would be irrelevant. The important point is that the library, once the package is created should be in lib/hellolib.a or something like that, if it was created correctly. No x86_64-linux-gnu folder.

I have just tested it in Windows, seems to be fine.
Can you please retry with the conan new hello/0.1 -m=meson_lib without any modifications to the recipe? If it works fine, then please report the changes you did to the recipe, providing a copy we could reproduce. Thanks!

@hstejas
Copy link
Author

hstejas commented Mar 12, 2022

Hello @memsharded

More specifically I was just trying this out with libvips, and I noticed this in their readme

You might need to add --libdir=lib on Debian if you don't want the arch name in the library path.

I don't know enough about meson to comment if this is a standard practice.

I also noticed this,

# TODO : we don't manage paths like libdir here (yet?)

So this is currently not possible?

@memsharded
Copy link
Member

Hi @hstejas

I am not sure what is happening. I have just tried with conan new hello/0.1 -m=meson_lib in Conan 1.46 in an Ubuntu 19 system, and it is not creating the x86_64-linux-gnu folder, but the lib is is in lib/libhello.a directly.
The template, the meson.build is using the install_dir: 'lib', so this is working fine, maybe you are removing that in your meson.build file?

@SSE4
Copy link
Contributor

SSE4 commented Mar 14, 2022

might be related: #9713

@hstejas
Copy link
Author

hstejas commented Mar 14, 2022

@memsharded
As i had mentioned it is an existing project.
Seems like install_dir is not there
source:
https://github.com/libvips/libvips/blob/168d7652c21440edf8c2e3bd27428ec2891685bf/libvips/meson.build#L21
And I think i am checking the correct file

@memsharded
Copy link
Member

I see. So then the possible approaches could be:

  • Have the recipe patch the library meson.build file to define the install_dir. You can patch in source() method, after getting the sources. ConanCenter recipes have many examples of patches and how to define them in conandata.yml.
  • Do a file move in the package() method, to get rid of the x86_64-linux-gnu folder, moving the libs from there to plain "lib"
  • Do not use the meson.install() but use a bare copy(self, ....) inside package()
  • Parameterize the package_info() method to reflect this. This might be the less recommended one, doesn't seem an elegant solution.

I think I would try first the 2nd and 3rd approaches, with the package() method, might be a bit simpler than applying the patch.

In any case, it doesn't seem so far this is a Conan bug. Meson is doing something and deciding to put some files in a different folder depending on the system. Conan recipes have different ways to deal with that, but nothing that it could do automagically.

@hstejas
Copy link
Author

hstejas commented Mar 14, 2022

Thanks for the reply,
I will maybe try one of them. Ill close this since nothing can be one in conan.

@hstejas hstejas closed this as completed Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants