-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix external_project failing due to the drive letter in the path on Windows #13916
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
base: master
Are you sure you want to change the base?
fix external_project failing due to the drive letter in the path on Windows #13916
Conversation
fdc35d9 to
20a9be7
Compare
How do we know that all scripts for configuring an external project via --prefix etc. are necessarily running from cygwin? In comparison, we have existing functions for determining if meson is being run from a cygwin or msys2 environment. I suppose that it may be fairly rare for homebrewed build systems to exist and actual autoconf scripts won't run without some runtime environment similar to cygwin / msys2. How does a bare mingw install handle this? |
|
It does not necessarily need to be running on cygwin, as long as there is Initially I didn't think about other environment that provide So if we need to support such environments, maybe the path conversion should be done only when Edit: I've updated the code for this. |
482c609 to
699562d
Compare
bd1f2ea to
2675d06
Compare
2675d06 to
d413795
Compare
|
I've pushed some additional fixes (see edited description), and now CI passed. |
eli-schwartz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these commits are missing explanations for why they are needed.
Using "added" for some commits and "fix" for others is inconsistent style ;) consistency would be "add / fix" or "added / fixed". Git style is to use imperative mood: https://cbea.ms/git-commit/#imperative
This comment was marked as resolved.
This comment was marked as resolved.
c579566 to
e5eeb77
Compare
|
@eli-schwartz Thanks for review! I fixed them all, so please check it again. |
e5eeb77 to
1f89511
Compare
41d56e3 to
6e61077
Compare
bruchar1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I think the 3 last commits could be squashed in one.
6e61077 to
cdbe956
Compare
|
I object to using ctypes at all. :) It's fragile and not meaningfully faster than running a single external command right before running a configure script. Additionally we currently use ctypes only twice, and both times are guarded by Windows conditionals to avoid meson being broken and failing to run on Unix systems where python was manually compiled and ctypes isn't available. This isn't an uncommon occurrence. So please keep that in mind one way or the other. |
|
In this case, is there anything else to be done? |
The branch correspond to mesonbuild/meson#13916 but up to date
|
This could use a release note snippet explaining how and when the path conversion happens. |
ff17017 to
9c4843e
Compare
|
Is there any reason why this is delayed to 1.9.1 or 1.10.0? |
|
I don't know why it wasn't reviewed so far, but after 1.9-rc3 only a really bad regression would warrant another release candidate. |
|
@na-trium-144 can you rebase and push? |
On Cygwin, MSYS2 and GitBash, the configure command and the prefix should be converted to unix style path by cygpath command, because the colon in the drive letter breaks many configure scripts. This also fixes bugs of previous approach where leading slash was missing from prefix and it sometimes use wrong directory as base path. In addition removing drive letter should be done on rel_prefix only.
Implemented 'windows' and '!windows' as platform value in test configuration for this. In MSVC environment this test is ignored anyway since make command is not available.
9c4843e to
83aad41
Compare
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
…project module with ffms2 gstreamer ffmpeg isn't always up to date. For example, ffmpeg 8.0 have been released 2025-08-22, but as of 2025-10-20, gstreamer still only use the version 7.1. Also, I don't like the fact that gstreamer doesn't use the official build system. There might be difference, so let's not take any chance and use the official build system. I wanted to use the ffmpeg build system with meson External Project module https://mesonbuild.com/External-Project-module.html, but it just doesn't work. It seems that subproject (in this case bestsource) can't depend on a external project module because they don't use -uninstalled.pc, but i'm not sure. Also, the external project module doesn't use the .pc file to retrieve the dependencies, so I need to maintain it manually which sucks: mesonbuild/meson#14767 Finally, the external project module doesn't work on msys2. There is a PR that have been opened almost a year ago and work fine, but for a reason, it's not getting merge: mesonbuild/meson#13916 So, for all these reason, let's directly use autotools for ffms2 and the official ffmpeg build system by building them "manually".
| # Work around that issue by removing the drive from prefix. | ||
| if self.prefix.drive: | ||
| self.prefix = Path(relpath(self.prefix, self.prefix.drive)) | ||
| self.prefix = self._cygpath_convert(self.prefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case cygpath is not found we don't remove the drive from self.prefix anymore. That means we now run configure --prefix=c:/foo instead of configure --prefix=/foo. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if you also need to convert self.install_dir as that's used for DESTDIR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That means we now run
configure --prefix=c:/fooinstead ofconfigure --prefix=/foo.
I don't know which is appropriate in that case, but the latter has the problem of not working with another drive. If anyone has an environment with sh but no cygpath, they may submit an issue or PR.
I'm wondering if you also need to convert self.install_dir as that's used for DESTDIR?
Unlike the prefix used by configure, DESTDIR is used by make, right? So far I haven't had any issues with the drive letter for install_dir.
| configure_prog = state.find_program(configure_path.as_posix()) | ||
| configure_cmd = configure_prog.get_command() | ||
| if len(configure_cmd) >= 2 and configure_cmd[-1] == configure_path.as_posix(): | ||
| configure_cmd = configure_cmd[:-1] + [self._cygpath_convert(configure_path).as_posix()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? run_command('configure') would not do this and I assume it's working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main point of this PR. see #13699.
| echo "failed to extract $srcdir using path separator $PATH_SEPARATOR" | ||
| exit 1 | ||
| fi | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a test for the fix related to the comment above.
I wrote it to resemble the processing done by the existing configure script, but it might be the same if I simply checked whether srcdir contains a colon.
closes #13699
On Windows, the windows-style configure command path (like
C:/path/to/configure) seems to break many configure scripts because they treat the colon in the drive letter as path separator.Converting the configure command to unix-style path (like
/c/path/to/configure) usingcygpathcommand fixes the issue.cygpathshould be available on cygwin, msys2 and gitbash.Edit: This conversion is done only if
cygpathcommand is available. Otherwise it is left as is.Edit: this PR also includes fix for enabling test cases/common/230 external project on msys2. (related to #13895)
To enable this, I had to add
windowsand!windowsas platform value in test configuration.Edit: Also includes fix for a bug where the leading
/in the prefix is missing on MinGW, which appears to be introduced in #13886.Edit: It turned out that with the previous approach which just removes the drive letter from prefix the generated pkg-config file has wrong prefix in it.
So this PR also convert the prefix to unix-style path when cygpath is available.
I'm new to contributing to meson. Please let me know if there are something I need to change.