threads / discuss / 61894

Git and gettext

Subject: Git and gettext

## tl;dr

8 messages between Aug 3, 2024 and Aug 12, 2024.

replies: 7people: 3as markdown or json

Kim Scarborough· Aug 3, 2024, 07:58 UTC · lore
Hi folks,

Was wondering why I need gettext to compile git, even if I tell it I don't need NLS. I've not needed it to compile anything else. Is this really necessary to run git?

If it *is* absolutely needed for some reason, can at least the configure script give a warning and error out when msgfmt isn't found, rather than letting you go through two-thirds of the make before crashing?

-- 
Kim Scarborough
brian m. carlson· Aug 3, 2024, 16:00 UTC · re: Kim Scarborough · lore

Re: Git and gettext

On 2024-08-03 at 07:58:55, Kim Scarborough wrote:
Show 5 quoted lines
> Hi folks,
> 
> Was wondering why I need gettext to compile git, even if I tell it I don't
> need NLS. I've not needed it to compile anything else. Is this really
> necessary to run git?

I believe you can use NO_GETTEXT=1 and NO_MSGFMT=1 (both must be set) to remove the need for gettext and msgfmt. The latter can be omitted if you're not building git-gui. You can see other configuration options at the top of the Makefile.

I will note that both of these commands are required as of POSIX 1003.1-2024, though.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Kim Scarborough· Aug 3, 2024, 17:24 UTC · re: brian m. carlson · lore

Re: Git and gettext

> I believe you can use NO_GETTEXT=1 and NO_MSGFMT=1 (both must be set) to
> remove the need for gettext and msgfmt.  The latter can be omitted if
> you're not building git-gui.  You can see other configuration options at
> the top of the Makefile.

I tried setting both but it still errors out. A little later in the build, though.

-- 
Kim Scarborough
brian m. carlson· Aug 3, 2024, 17:34 UTC · re: Kim Scarborough · lore

Re: Git and gettext

On 2024-08-03 at 17:24:43, Kim Scarborough wrote:
Show 7 quoted lines
> > I believe you can use NO_GETTEXT=1 and NO_MSGFMT=1 (both must be set) to
> > remove the need for gettext and msgfmt.  The latter can be omitted if
> > you're not building git-gui.  You can see other configuration options at
> > the top of the Makefile.
> 
> I tried setting both but it still errors out. A little later in the build,
> though.

Hmm, I can't remove msgfmt from my system, but if I put a `msgfmt` script in `$TMP/path` that contains just a shebang and `exit 1` and do this, the build succeeds:

--- PATH="$TMP/path:$PATH" make -j12 NO_GETTEXT=1 NO_MSGFMT=1 ---

Note that `config.mak` is not read by git-gui, so you do really have to set `NO_MSGFMT=1` on the command line.

Can you show exactly the commands you're running and exactly the output you're getting? Also, what OS and version are you running this on?

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Kim Scarborough· Aug 4, 2024, 21:26 UTC · re: brian m. carlson · lore

Re: Git and gettext

On 8/3/24 12:34 PM, brian m. carlson wrote:
Show 14 quoted lines
> 
> Hmm, I can't remove msgfmt from my system, but if I put a `msgfmt`
> script in `$TMP/path` that contains just a shebang and `exit 1` and do
> this, the build succeeds:
> 
> ---
> PATH="$TMP/path:$PATH" make -j12 NO_GETTEXT=1 NO_MSGFMT=1
> ---
> 
> Note that `config.mak` is not read by git-gui, so you do really have
> to set `NO_MSGFMT=1` on the command line.
> 
> Can you show exactly the commands you're running and exactly the output
> you're getting?  Also, what OS and version are you running this on?

Not working for me. I ran "make NO_GETTEXT=1 NO_MSGFMT=1" and it dies thusly:

     BUILTIN git-version
     BUILTIN git-whatchanged
     SUBDIR git-gui
GITGUI_VERSION = 0.21.0.128.g2864e
     * new locations or Tcl/Tk interpreter
     MSGFMT    po/bg.msg     MSGFMT    po/de.msg     MSGFMT    po/el.msg 
     MSGFMT    po/fr.msg make[1]: *** [Makefile:239: po/bg.msg] Error 127
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:239: po/de.msg] Error 127
make[1]: *** [Makefile:239: po/el.msg] Error 127
     MSGFMT    po/hu.msg make[1]: *** [Makefile:239: po/fr.msg] Error 127
     MSGFMT    po/it.msg make[1]: *** [Makefile:239: po/hu.msg] Error 127
     MSGFMT    po/ja.msg make[1]: *** [Makefile:239: po/it.msg] Error 127
     MSGFMT    po/nb.msg make[1]: *** [Makefile:239: po/ja.msg] Error 127
make[1]: *** [Makefile:239: po/nb.msg] Error 127
make: *** [Makefile:2365: all] Error 2
This is a recently-built Linux from Scratch box.
Jeff King· Aug 5, 2024, 00:53 UTC · re: Kim Scarborough · lore

Re: Git and gettext

On Sun, Aug 04, 2024 at 04:26:19PM -0500, Kim Scarborough wrote:
Show 25 quoted lines
> > Note that `config.mak` is not read by git-gui, so you do really have
> > to set `NO_MSGFMT=1` on the command line.
> > 
> > Can you show exactly the commands you're running and exactly the output
> > you're getting?  Also, what OS and version are you running this on?
> 
> Not working for me. I ran "make NO_GETTEXT=1 NO_MSGFMT=1" and it dies
> thusly:
> 
>     BUILTIN git-version
>     BUILTIN git-whatchanged
>     SUBDIR git-gui
> GITGUI_VERSION = 0.21.0.128.g2864e
>     * new locations or Tcl/Tk interpreter
>     MSGFMT    po/bg.msg     MSGFMT    po/de.msg     MSGFMT    po/el.msg
> MSGFMT    po/fr.msg make[1]: *** [Makefile:239: po/bg.msg] Error 127
> make[1]: *** Waiting for unfinished jobs....
> make[1]: *** [Makefile:239: po/de.msg] Error 127
> make[1]: *** [Makefile:239: po/el.msg] Error 127
>     MSGFMT    po/hu.msg make[1]: *** [Makefile:239: po/fr.msg] Error 127
>     MSGFMT    po/it.msg make[1]: *** [Makefile:239: po/hu.msg] Error 127
>     MSGFMT    po/ja.msg make[1]: *** [Makefile:239: po/it.msg] Error 127
>     MSGFMT    po/nb.msg make[1]: *** [Makefile:239: po/ja.msg] Error 127
> make[1]: *** [Makefile:239: po/nb.msg] Error 127
> make: *** [Makefile:2365: all] Error 2

If we don't have msgfmt, I think git-gui invokes a custom script via tclsh. If you also don't have that, it will fail. Running with "make V=1" makes this more obvious, since it shows the fallback command name instead of "MSGFMT".

If you don't need git-gui at all, the simplest thing is to just run "make NO_GETTEXT=1 NO_TCLTK=1". That's what I do, and I have neither msgfmt nor gettext on my system.

If you do need git-gui, you'll probably need to make sure your tcl install works (and has tclsh in the path).

-Peff
Kim Scarborough· Aug 6, 2024, 09:52 UTC · re: Jeff King · lore

Re: Git and gettext

On 8/4/24 7:53 PM, Jeff King wrote:
Show 8 quoted lines
> If we don't have msgfmt, I think git-gui invokes a custom script via
> tclsh. If you also don't have that, it will fail. Running with "make
> V=1" makes this more obvious, since it shows the fallback command name
> instead of "MSGFMT".
> 
> If you don't need git-gui at all, the simplest thing is to just run
> "make NO_GETTEXT=1 NO_TCLTK=1". That's what I do, and I have neither
> msgfmt nor gettext on my system.
That did it. Thanks!

Would it be possible to modify the configure script so that it checks for this stuff?

-- 
Kim Scarborough
Jeff King· Aug 12, 2024, 14:48 UTC · re: Kim Scarborough · lore

Re: Git and gettext

On Tue, Aug 06, 2024 at 04:52:39AM -0500, Kim Scarborough wrote:
Show 14 quoted lines
> On 8/4/24 7:53 PM, Jeff King wrote:
> > If we don't have msgfmt, I think git-gui invokes a custom script via
> > tclsh. If you also don't have that, it will fail. Running with "make
> > V=1" makes this more obvious, since it shows the fallback command name
> > instead of "MSGFMT".
> > 
> > If you don't need git-gui at all, the simplest thing is to just run
> > "make NO_GETTEXT=1 NO_TCLTK=1". That's what I do, and I have neither
> > msgfmt nor gettext on my system.
> 
> That did it. Thanks!
> 
> Would it be possible to modify the configure script so that it checks for
> this stuff?

Probably. It looks like the configure script knows about both gettext and tcl paths, but running "autoconf && ./configure" on my machine doesn't disable either.

Looks like the NO_GETTEXT test is checking to compile against libintl. Which I do have (it comes with glibc), but I don't have the other tools.

For tcl, you can say "--without-tcltk" manually. But if you don't, it just assumes "wish" is present without checking.

So I'd imagine that both tests could be made more robust. I don't use autoconf myself (in the Git project, it is an optional layer that sits on top of the Makefile knobs), so I'll leave that to somebody more motivated (and hopefully more familiar with the usual autoconf solutions to these kinds of things).

-Peff

← back to recent threads