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

link_depends does not work with files() #1172

Closed
dvdhrm opened this issue Dec 9, 2016 · 5 comments
Closed

link_depends does not work with files() #1172

dvdhrm opened this issue Dec 9, 2016 · 5 comments

Comments

@dvdhrm
Copy link

dvdhrm commented Dec 9, 2016

Hey

The link_depends: argument to executables and libraries does not work with File objects so far. It requires strings. See this example:

project('foobar', 'c')                                                           
bar = shared_library('bar', ['foo.c'], link_depends: files(['A','B']))

It fails with:

Link_depends arguments must be strings.

I circumvent this by using join_paths(meson.current_source_dir(), 'my_file') instead of files(), but I guess that's no the suggested solution?

Furthermore, the reference-manual in the wiki does not explain the File object, but the documentation of files() mentions it.

Thanks
David

@dvdhrm
Copy link
Author

dvdhrm commented Dec 9, 2016

Same for install_headers(). I guess there are a bunch more. Maybe files() is not supposed to used with those functions, but the wiki gives the impression that files() should work with anything that accepts paths. Or am I wrong here?

@nirbheek
Copy link
Member

nirbheek commented Dec 9, 2016

This is a bug. Generally, everything that accepts files as strings should also accept them as File objects. The reason that some things do not is because almost everyone uses strings and File objects were not there in the very beginning of the project when most of these functions were added.

@nirbheek nirbheek added this to the 0.37.0 milestone Dec 9, 2016
@dvdhrm dvdhrm changed the title link_depends does not fork with files() link_depends does not work with files() Dec 9, 2016
@nirbheek nirbheek modified the milestones: 0.37.0, 0.38.0 Dec 18, 2016
@doraskayo
Copy link

doraskayo commented Jan 17, 2017

It seems that generator.process() also doesn't accept file_array (which is the output of files().) I'm getting the following error:

Arguments must be strings.

@nirbheek, would you rather I open a new issue about it?

Edit:

It actually seems it was mentioned in #1141.

@nirbheek
Copy link
Member

That was merged a few days ago in #1257.

@nirbheek
Copy link
Member

For other people reading this bug report, you almost never need to use meson.current_source_dir() when passing files as strings to functions. Strings are implicitly assume to be relative to the current source dir. The only time you want to use that is when you want to get the absolute path for some custom reasons.

@nirbheek nirbheek modified the milestones: 0.38.0, 0.39.0 Feb 1, 2017
@nirbheek nirbheek modified the milestones: 0.39.0, 0.40.0 Mar 9, 2017
keszybz added a commit to keszybz/systemd that referenced this issue Apr 9, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 10, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 10, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 10, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 17, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 19, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 19, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 20, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 20, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method.
keszybz added a commit to keszybz/systemd that referenced this issue Apr 21, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
@nirbheek nirbheek modified the milestone: 0.40.0 Apr 22, 2017
keszybz added a commit to keszybz/systemd that referenced this issue Apr 24, 2017
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 26, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 26, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths to be absolute if that is
required, rather than the ninja backend doing it for them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 26, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths to be absolute if that is
required, rather than the ninja backend doing it for them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 26, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths to be absolute if that is
required, rather than the ninja backend doing it for them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue Apr 26, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths to be absolute if that is
required, rather than the ninja backend doing it for them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue May 1, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue May 1, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue May 3, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue May 3, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

Also updates the docs.
dcbaker added a commit to dcbaker/meson that referenced this issue May 4, 2017
…mesonbuild#1172

Currently only strings can be passed to the link_depends argument of
executable and *library, which solves many cases, but not every one.
This patch allows generated sources and Files to be passed as well.

On the implementation side, it uses a helper method to keep the more
complex logic separated from the __init__ method. This also requires
that Targets set their link_depends paths as Files, and the backend is
responsible for converting to strings when it wants them.

This adds tests for the following cases:
- Using a file in a subdir
- Using a configure_file as an input
- Using a custom_target as an input

It does not support using a generator as an input, since currently that
would require calling the generator twice, once for the -Wl argument,
and once for the link_depends.

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

No branches or pull requests

3 participants