0

I'm trying to compile a program which requires gettext (for intltools) on macOS. I tried the following commands to run the configure script:

LDFLAGS=-L/usr/local/opt/gettext/lib CPPFLAGS=-I/usr/local/opt/gettext/include ./configure
LDFLAGS=/usr/local/opt/gettext/lib CPPFLAGS=/usr/local/opt/gettext/include ./configure

In the first case it failed with the following error message

configure: error: GNU gettext tools not found; required for intltool

In the latter case it couldn't find the C compiler

What's the right way to solve this kind of problem? I understand that this is probably related to this

  • This should probably go to Ask Different, to Unix & Linux, or to Android enthusiasts. Or is it a meta-joke with the term homebrewing being used in the custom rom community? – Philipp Aug 19 '17 at 10:21
  • 2
    I'm voting to close this question as off-topic because it has nothing to do with brewing. – Robert Aug 19 '17 at 15:14
  • I am going to close and/or move this to a more relevant SE site. – Mr_road Aug 20 '17 at 5:37
  • Sorry for the wrong group choice to post the question. – Sum Proxy Aug 20 '17 at 5:59
  • Does the homebrew gettext package install the "gettext tools"? Are these available in your $PATH? The gettext tools includes xgettext, msgfmt and others. – Kusalananda Aug 20 '17 at 9:59
4

The configure script fails because it can't find the gettext tools in the current $PATH. These tools include xgettext, msgfmt and other binaries.

On macOS with Homebrew, the gettext Homebrew package does actually install these binaries, but they are located in the /usr/local/Cellar/gettext/0.18.1.1/bin directory rather than directly in /usr/local/bin.

The reason for this is that Homebrew installs all "keggs" in the "cellar", and gettext is a "keg" package.

If everything is working as intended, your gettext tools should already be symbolically linked from the Cellar directory to /usr/local/bin, and if your Homebrew setup is correct, /usr/local/bin should be in your $PATH.

Obviously, this is not set up properly, so I'd suggest making sure that your $PATH is correctly set up with /usr/local/bin before /usr/bin and that the links for the gettext tools exists from the cellar to the /usr/local/bin directory. Fixing one or both of those things will resolve this issue for you.


Update: According to this SuperUser answer, symbolic links to the gettext tools may not be set up properly by default. The following command will fix it:

$ brew link gettext --force

Once you have compiled your other application, you may undo the above with

$ brew unlink gettext

... if you wish.

This other answer on StackOverflow goes on to explain that executables of Homebrew packages that are "keg-only" (gettext is one of those) are not linked from the "cellar" to /usr/local/bin. This is by design. This explains why the brew link step will be necessary to get your configure script working properly.

The reason "keg-only" binaries are not put in you $PATH by default is that they may interfere with similarly named tools already present in the macOS base system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.