61

Trying to do a make install of git from source, and it keep kicking up the error:

 make install
* new build flags or prefix
CC credential-store.o
In file included from credential-store.c:1:
In file included from ./cache.h:8:
./gettext.h:17:11: fatal error: 'libintl.h' file not found
#       include <libintl.h>
            ^
1 error generated.
make: *** [credential-store.o] Error 1

No amount of Googling has turned up anything on lib.intl.h. What is this elusive library, and how can I get it so I can finally install git?

Burhan Ali
  • 2,258
  • 1
  • 28
  • 38
Adam Templeton
  • 4,467
  • 7
  • 27
  • 39

14 Answers14

42

FWIW on OSX with El Capitan and homebrew, I did a:

1) I wasn't sure if the El Capitan upgrade had broken something, so first I made sure I had the latest gettext:

$ brew reinstall gettext

Then I had to re-link by doing:

$ brew unlink gettext && brew link gettext --force

After that, other tools were able to find it, and life went back to normal.

Judge2020
  • 339
  • 4
  • 23
rotten
  • 1,580
  • 19
  • 25
  • 11
    Even better is to have brew take care of the linking details for you: `brew unlink gettext && brew link gettext --force` – Markus Amalthea Magnuson Nov 26 '15 at 14:57
  • 1
    this anwser helps me a lot – zhaozhi Sep 12 '16 at 06:32
  • 1
    This didn't work for me. Reinstalling gettext via brew came with the Caveat "This formula is keg-only, which means it was not symlinked into /usr/local". Neither linking manually as you suggested, nor getting brew do the linking as @MarkusAmaltheaMagnuson suggested could get git to compile. Still have error "gettext.h:17:11: fatal error: 'libintl.h' file not found". :( – ziggurism Dec 13 '16 at 18:20
  • Interesting - so I guess it's actually a different library, but since gettext (and the project I'm trying to build that relies on gettext) uses it this is a workable approach. – Josh from Qaribou Dec 20 '17 at 18:59
  • I had the same issue when installing neovim from source on my macbook pro. The message I got was slightly different: Could NOT find Libintl (missing: LIBINTL_LIBRARY LIBINTL_INCLUDE_DIR) However, running the commands suggested by @rotten fixed the issue. – Miguel Alex Cantu May 22 '23 at 14:17
38

Depending on the system, it's probably part of the GNU C library (glibc).

Note that just installing the file libintl.h isn't likely to do you any good.

On Debian-based systems (including Debian, Ubuntu, and Linux Mint), it's part of the libc6-dev package, installed with:

sudo apt-get install libc6-dev

Since you're using Mac OS X, a Google search for "libintl.h OSX" shows a lot of people having similar problems. According to the INSTALL file in the Git sources:

Set NO_GETTEXT to disable localization support and make Git only use English. Under autoconf the configure script will do this automatically if it can't find libintl on the system.

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
  • 16
    Funny thing, when I search for `osx libintl.h` this is the first result I get. – Michael Jan 23 '14 at 18:42
  • 14
    If you're using OS X, you can invoke `make` like this to set `NO_GETTEXT`: `NO_GETTEXT=1 make`. I think this is true for all commands with environment variables in Bash, right? –  May 29 '14 at 01:58
  • 1
    @Cupcake: Yes, but the `configure` script should do it automatically so you don't need to worry about it. – Keith Thompson May 29 '14 at 02:08
  • 1
    So one thing that took me a while to figure out is that you have to generate the `./configure` script by running `make configure` first. It's ignored by `.gitignore`, but it will still be generated by the `Makefile`. –  May 29 '14 at 22:37
  • @KeithThompson ; I’m using a system where libintl isn’t present with the given libc. Do you know a third party library which can provide it separately? – user2284570 May 15 '15 at 20:57
  • @user2284570: No, I don't. My answer provides a workaround for the lack of the library. If you want to find out how to get the library on your system, you might post a new question (and be sure to specify what system you're using). – Keith Thompson May 15 '15 at 21:54
  • @KeithThompson : yes, a workaround for glibc systems… – user2284570 May 16 '15 at 23:22
  • you are right, using `NO_GETTEXT=0 make prefix=$HOME/.local all doc info` worked for me. – Hola Soy Edu Feliz Navidad Oct 07 '19 at 10:43
  • FWIW, although I agree with Keith that "the `configure` script should do it automatically", on my MacOS system today, invoking `make configure` just resulted in "`autoconf: command not found`", which I didn't feel like chasing down. So an explicit `make NO_GETTEXT=1` did the trick (and then, permanently setting `NO_GETTEXT=1` in the Makefile). – Steve Summit Mar 21 '22 at 11:42
26

I learned libintl comes from libgettext. If you already installed gettext by Homebrew, you would see:

$ locate libintl
/usr/local/Cellar/gettext/0.18.3.2/lib/libintl.8.dylib
/usr/local/Cellar/gettext/0.18.3.2/lib/libintl.a
/usr/local/Cellar/gettext/0.18.3.2/lib/libintl.dylib
<..snip..>

and the following works for me on the issue of "library not found for -lintl"

ln -s /usr/local/Cellar/gettext/0.18.3.2/lib/libintl.* /usr/local/lib/
hichris123
  • 10,145
  • 15
  • 56
  • 70
ronnefeldt
  • 2,083
  • 23
  • 24
  • 1
    Thanks, this fixed a "ld: library not found for -lintl" error I was getting! – tekumara Jan 22 '14 at 12:43
  • I'm still getting `gcc -g -O2 -DCHROMA_CURSES_HEADER=\ -DCHROMA_DATA_DIR=\"/usr/local/share/chroma/\" -c -o main.o main.c main.c:33:10: fatal error: 'libintl.h' file not found`. How can I be sure gcc is looking in the correct location for the file? – mareoraft Dec 21 '15 at 20:11
  • This actually answers OP's question. – vesperto Jan 21 '21 at 12:36
14

If you can find the proper version of Libtools (from http://ftp.gnu.org/gnu/libtool/) you might find it in the package..

Otherwise you can use below to the configure to remove this dependency:

./configure --disable-nls
AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65
7

When packages are looking for this file, install or build the GNU gettext package. This packages "installs" ${prefix}/include/libintl.h, among other things

Michael Felt
  • 71
  • 1
  • 2
  • 7
    Possibly helpful since OP is on OS X, though doesn't specify if he is using Homebrew: I've seen some builds fail to find libintl despite gettext being installed -- I had to `brew link gettext` to resolve it. – ches Oct 31 '12 at 12:32
  • The above tip to brew link gettext worked for me when trying to compile Phalcon PHP on my Mac. Thanks for the tip! – user1493194 Jun 11 '14 at 17:38
  • According to the [GNU coding standards](https://www.gnu.org/prep/standards/standards.html), `${prefix}/include/libintl.h` is `${includedir}/libintl.h`. – jww Feb 05 '18 at 22:01
5

Those trying to build Git on macOS as of May 2021, and want internationalization I found this to be the best, non-destructive solution:

brew install gettext

Find the location of the libintl headers and libs:

find /opt -name "libintl.*" -print
/opt/homebrew/include/libintl.h
/opt/homebrew/lib/libintl.dylib
/opt/homebrew/lib/libintl.8.dylib
/opt/homebrew/lib/libintl.a
/opt/homebrew/Cellar/gettext/0.21/include/libintl.h
/opt/homebrew/Cellar/gettext/0.21/lib/libintl.dylib
/opt/homebrew/Cellar/gettext/0.21/lib/libintl.8.dylib
/opt/homebrew/Cellar/gettext/0.21/lib/libintl.a

Note the location of the gettext directories.

Now run the following (it might slightly differ if your CFLAGS and LDFLAGS are already set. Just ensure the gettext paths are included with whatever else is already there):

make configure
./configure "LDFLAGS=$LDFLAGS -L/opt/homebrew/Cellar/gettext/0.21/lib" \
     "CFLAGS=-I/opt/homebrew/Cellar/gettext/0.21/include"

After it has configured properly you should be able to build it with make.

ath0
  • 105
  • 1
  • 4
  • 2
    This worked for me, but homebrew seemed to have a different install location, so I had to run `find /usr/local -name "libintl.*" -print` to find the libs – Robert Oct 07 '21 at 08:12
3

In order to install the newest version of git on OSX Lion this is what I did:

*Note that if you do not have git already installed you can just download it from the site and unpack it in to ~/src/git

I also recommend doing a whereis git to see if you already have it installed so you know what to set your prefix to. Mine was /usr/bin/git so I set my prefix to just /usr

mkdir ~/src
git clone https://github.com/git/git.git
cd git
make configure
./configure --prefix=/usr
make
make install

By doing it this way I did not have to download any extra libraries or do any hunting on forums for answers. Thanks to automake I know that git is setup for my system and will run without any hiccups.

pb2q
  • 58,613
  • 19
  • 146
  • 147
blindMoe
  • 104
  • 3
  • The configure probably could not find the header and automatically skipping it. You probably need autconf to generate the configure scripts. I got the following error messages: make configure GEN configure /bin/sh: autoconf: command not found make: *** [configure] Error 127 – Kemin Zhou Jan 11 '19 at 04:52
2

This looks promising - http://code.google.com/p/rudix/downloads/detail?name=static-libintl-0.18.1.1-5.pkg&can=2&q= - appears to contain libintl as a pkg. It resolved a dependency on libintl for me.

ljs
  • 37,275
  • 36
  • 106
  • 124
2

If you don't care about localization and are ok with just English, define NO_GETTEXT in the Makefile

From the Makefile:

Define NO_GETTEXT if you don't want Git output to be translated. A translated Git requires GNU libintl or another gettext implementation, plus libintl-perl at runtime.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • 1
    If you're using OS X, you can invoke `make` like this to set `NO_GETTEXT`: `NO_GETTEXT=1 make`. I think this is true for all commands with environment variables in Bash, right? –  May 29 '14 at 01:58
  • make prefix=/usr NO_GETTEXT=1; sudo make prefix=/usr install NO_GETTEXT=1 – webcpu Dec 17 '14 at 17:42
1

install macport and type on terminal

sudo port install libcxx
mhlester
  • 22,781
  • 10
  • 52
  • 75
Jorge Miguel
  • 41
  • 1
  • 7
1

What is this elusive library, and how can I get it so I can finally install git?

From the GNU manual:

11.21 libintl.h

Libintl is a library that provides native language support to programs.

Defines the macros __USE_GNU_GETTEXT, __GNU_GETTEXT_SUPPORTED_REVISION, and declares the functions gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset.

Documentation:

Gnulib module: gettext

Portability problems fixed by Gnulib, if GNU gettext is installed:

This header file is missing on some platforms: Mac OS X 10.5, FreeBSD 6.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, mingw, MSVC 9, Interix 3.5, BeOS.

The functions cannot deal with GNU .mo files with system-dependent strings (of major version 1 or of minor version 1) on some non-glibc platforms: NetBSD 3.0, Solaris 10.

You can get libintl.h from Gnulib, which is The GNU Portability Library. It is available for download from GNU's Savannah.

The Gnulib web page also states:

Gnulib does not make releases. It is intended to be used at the source level.

You can browse the current gnulib sources on Savannah.

To use Gnulib, you can retrieve its source code and its history via anonymous Git, using the following shell command:

git clone git://git.savannah.gnu.org/gnulib.git

Developers can also retrieve the source code via non-anonymous Git, for purposes of doing commits; for details, please see Gnulib's top-level README file.

After you have the sources, run ./gnulib-tool --help. For help and more info, see the documentation and other resources below.

jww
  • 97,681
  • 90
  • 411
  • 885
1

The following worked for me:

  1. brew reinstall gettext
  2. brew unlink gettext && brew link gettext --force
  3. For compilers to find libpq you may need to set:
export LDFLAGS="-L/usr/local/opt/libpq/lib"
export CPPFLAGS="-I/usr/local/opt/libpq/include"

For e.g, while installing Postgis on my system I used ./configure with the following flags

./configure CPPFLAGS="-I/usr/local/opt/libpq/include" LDFLAGS="-L/usr/local/opt/libpq/lib"
NearHuscarl
  • 66,950
  • 18
  • 261
  • 230
Prateek
  • 11
  • 1
  • 1
    Welcome to Stack Overflow. Please try to explain what it does so that it can help others understand what you are suggesting :) – Tushar Sep 28 '20 at 10:59
0

If you're trying to compile AssaultCube and are getting this error (should complain about "INTL/libintl.h" being missing), you have to take INTL.framework from the AssaultCube app contents and put it in /Library/Frameworks. No packages from MacPorts, HomeBrew, etc. can fix it. Very very annoying how many open source projects fail to compile.

sudo
  • 5,604
  • 5
  • 40
  • 78
0

I have a fresh install of OSX Catalina (10.15.7) and was able to obtain /usr/local/lib/libintl.* just by making sure homebrew was fully updated and upgraded:

Before:

user@mac:/usr/local/lib$ ls libintl*
ls: libintl*: No such file or directory

Updating / upgrading homebrew:

$ brew update

...and just to be sure I decided to run it again

$ brew update

...which told me I first needed to run

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

...third time's the charm?

$ brew update

...which told me I should run

$ brew upgrade

And after that, /usr/local/lib/libintl.* was populated:

user@mac:/usr/local/lib$ ls libintl*
libintl.8.dylib libintl.a libintl.dylib

I think this gets you what you were looking for!

Matt Popovich
  • 236
  • 1
  • 2
  • 14