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

[gettext] msgfmt (and other gettext bin tools) missing on macOS & Windows #13518

Closed
wrobelda opened this issue Sep 14, 2020 · 22 comments · Fixed by #11776
Closed

[gettext] msgfmt (and other gettext bin tools) missing on macOS & Windows #13518

wrobelda opened this issue Sep 14, 2020 · 22 comments · Fixed by #11776
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@wrobelda
Copy link
Contributor

wrobelda commented Sep 14, 2020

Describe the bug
macOS nor Windows come with gettext by default. There is a gettext port in vcpkg, but it doesn't ship the \bin tools. The vcpkg_find_acquire_program() does not offer it, either. Because of that reason, ports that require msgfmt binary tools (e.g. kf5i18n) fail to build on macOS and Windows.

What's even more puzzling, though, is that the vcpkg OS X Azure Pipeline builds it just fine, despite that gettext is not one of the home-brew prerequisites installed by vagrant. EDIT: these pipeline builds were in fact false-positives and were never actually executed.

Environment

  • OS: macOS 10.15.6, as well as Windows 10
  • Compiler: Apple clang version 11.0.3 (clang-1103.0.32.62)

To Reproduce
Steps to reproduce the behavior:

  1. Make sure you do not have a gettext brew package installed
  2. vcpkg install kf5i18
  3. See the error.

Expected behavior

  1. Azure Pipeline build should fail just like the local build does
  2. vcpkg_find_acquire_program() should include gettext tools

Alternatively, the way that OS X Azure Pipeline delivers a functioning set of gettext tools should be explicitly documented. as explained above, this was a false-positive.

Failure logs

CMake Error at /Volumes/External/Sourcecode/vcpkg/downloads/tools/cmake-3.17.2-osx/cmake-3.17.2-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  Could NOT find Gettext (missing: GETTEXT_MSGMERGE_EXECUTABLE
  GETTEXT_MSGFMT_EXECUTABLE)
Call Stack (most recent call first):
  /Volumes/External/Sourcecode/vcpkg/downloads/tools/cmake-3.17.2-osx/cmake-3.17.2-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
  /Volumes/External/Sourcecode/vcpkg/downloads/tools/cmake-3.17.2-osx/cmake-3.17.2-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/FindGettext.cmake:81 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /Volumes/External/Sourcecode/vcpkg/scripts/buildsystems/vcpkg.cmake:478 (_find_package)
  /Volumes/External/Sourcecode/vcpkg/buildtrees/kf5i18n/x64-osx-dbg/cmake/KF5I18nMacros.cmake:5 (find_package)
  CMakeLists.txt:66 (include)
@wrobelda
Copy link
Contributor Author

wrobelda commented Sep 14, 2020

I just realized that the "CASCADE" status effectively means "SKIPPED because of missing dependency". IMHO a build should fail in such case, since the ports I modified were not built at all.

Anyhow, the issue still stands – these tools are missing on macOS.

@JackBoosY JackBoosY self-assigned this Sep 14, 2020
@JackBoosY JackBoosY linked a pull request Sep 14, 2020 that will close this issue
4 tasks
@JackBoosY JackBoosY added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Sep 14, 2020
@cenit
Copy link
Contributor

cenit commented Sep 14, 2020

agree with CASCADE status. It already misled me few times...

@wrobelda wrobelda changed the title [macOS] msgfmt (and other gettext bin tools) missing for macOS builds [macOS] msgfmt (and other gettext bin tools) missing for macOS & Windows builds Sep 14, 2020
@wrobelda
Copy link
Contributor Author

Please note we have the same issue on Windows; I updated the title accordingly.

@wrobelda wrobelda changed the title [macOS] msgfmt (and other gettext bin tools) missing for macOS & Windows builds [macOS & Windows] msgfmt (and other gettext bin tools) missing Sep 15, 2020
@wrobelda wrobelda changed the title [macOS & Windows] msgfmt (and other gettext bin tools) missing [gettext] msgfmt (and other gettext bin tools) missing on macOS & Windows Sep 15, 2020
wrobelda added a commit to wrobelda/vcpkg that referenced this issue Sep 15, 2020
@JackBoosY
Copy link
Contributor

We may need to fix windows build instead of add it to vcpkg_find_acquire_program.

@wrobelda
Copy link
Contributor Author

We may need to fix windows build instead of add it to vcpkg_find_acquire_program.

I tried building it on macOS and it failed, too. My ports depend on it so I added it for the time being, but I agree it would be best to include those execs in the gettext itself.

@wrobelda
Copy link
Contributor Author

wrobelda commented Mar 6, 2021

@strega-nil can you please re-open this? Unfortunately this issue wasn't fixed by #11776. Please see #13532 for ongoing discussion.

@PhoebeHui
Copy link
Contributor

PhoebeHui commented Apr 15, 2021

The feature 'tools' has been added to gettext which contains autopiont and msgmerge via PR #17010, however, I don't know how to consume it in related to ports yet.

Related to #17227 and #17278

@PhoebeHui PhoebeHui self-assigned this Apr 15, 2021
@dg0yt
Copy link
Contributor

dg0yt commented Apr 19, 2021

@dg0yt
Copy link
Contributor

dg0yt commented Apr 20, 2021

The feature 'tools' has been added to gettext which contains autopiont and msgmerge via PR #17010, however, I don't know how to consume it in related to ports yet.

I think what kf5i18n needs is a host-dependency on gettext[tools]. (What it has now is a target dependency on the default feature.)

@JackBoosY
Copy link
Contributor

@dg0yt No, it doesn't work, I already checked that.

@dg0yt
Copy link
Contributor

dg0yt commented Apr 20, 2021

@JackBoosY Perhaps FindGettext needs some help to locate the tools in vcpkg's installation? At least for cross-builds, it might probably fail anyway, because it uses find_program to look for the tools, and this will look for target programs IIUC.
Why not let the portfile run find_program, and pass the result as GETTEXT_MSGMERGE_EXECUTABLE to cmake when configuring the source project?

@JackBoosY
Copy link
Contributor

@dg0yt Because not only our port, but also the custom project will call the configuration file of kf5i18n, so I think we should do some magic on its cmake configuration file.

@dg0yt
Copy link
Contributor

dg0yt commented Apr 21, 2021

IIUC the gettext port's cmake wrapper is installed for intl, but kf5i18n needs a wrapper for gettext to be provided by gettext[tools].

This was referenced May 27, 2021
@wrobelda
Copy link
Contributor Author

wrobelda commented May 27, 2021

This has been stale for a while and still a blocker for a whole bunch of the libraries I have lined up for inclusion into vcpkg. I understand that the latest is that that gettext[tools] would need to provide a wrapper for gettext, so that using kf5i18n (or any other port that uses gettext's formatting tools) as a dependency works, or I have to patch the kf5i18n's CMake configs directly? I can get away with the latter, but obviously the former solution would be cleaner and universal.

@dg0yt
Copy link
Contributor

dg0yt commented May 27, 2021

WRT to the headline, the tools are no longer missing. (They even build on Linux if you want.) But...

  • The tools are in tools/gettext/bin.
  • FindGettext.cmake uses plain find_program.
  • tools/gettext/bin is neither in ENV{PATH} nor in CMAKE_PROGRAM_PATH.
  • So FindGettext.cmake is bound to fail.

Basically, this is a recurring issue, not just affecting gettext[tools]. I suppose at least CMAKE_PROGRAM_PATH should be generally adjusted to include bin and debug suffixes if they exist.
Now we cannot know the proper fix unless #13649 (@wrobelda) or #17607 (@dg0yt) are answered.

@wrobelda
Copy link
Contributor Author

wrobelda commented May 27, 2021

tools/gettext/bin is neither in ENV{PATH} nor in CMAKE_PROGRAM_PATH.

OK, so as you noticed yourself, this is actually same recurring issue I commented on before and you already linked to. Good job at summarizing everything in #17607. Let's hope that this is picked up by the core team eventually.

@dg0yt
Copy link
Contributor

dg0yt commented Jul 25, 2021

#18159 was merged, so maybe this resolved?

@JackBoosY
Copy link
Contributor

Ping @wrobelda for response.

@JackBoosY
Copy link
Contributor

Okay, please reopen this issue if it's not resolved.

@ephphatha
Copy link

ephphatha commented Aug 13, 2021

vcpkg install gettext[tools]:triplet isn't enough on its own to make find_package(Gettext) succeed for windows/msvc builds still, looks like a solution to #17607 is needed too.

If I leave the default installation and integration active gettext tools are built and placed in vcpkg\installed\<triplet>\tools\gettext\bin\, however only vcpkg\installed\<triplet>\tools\ is searched when looking for msgfmt and msgmerge. Copying the relevant executables from gettext\bin\ into tools "works" but it's ugly and takes a bit to get everything that's needed.

Edit: Adding PATH_SUFFIXES bin to the two find_program calls at the start of FindGettext.cmake is enough to get a cmake project in VS2022 to succeed with find_package(Gettext) but I'm not sure if that's the appropriate change to make.

@cenit
Copy link
Contributor

cenit commented Aug 13, 2021

without taking away any importance to #17607, maybe we can write specifically for this case a wrapper that finds the executables in the positions that we already know and then launches the real find_package. In this way, find_program calls will already find cache variables set up and work, without any requirements on upstream cmake modules

@dg0yt
Copy link
Contributor

dg0yt commented Aug 13, 2021

While we don't have a vcpkg wrapper (which would need to be in the target system), we do have a vcpkg config file (which is applied when using a host dependency on gettext[tools]).

My PR #18159 which added the config file was initially submitted with a gettext wrapper installed in the target system. But this concept didn't convicnce the reviewers: installing a wrapper for the target triplet which relies on tools installed for the host triplet.
92149d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
6 participants