Mailing List Archive

[PATCH] kconfig: detect if -lintl is needed when linking conf,mconf
Hello,

On a system where libintl.h is present, but the NLS functionality is
supplied by a separate library instead of the system C library, an attempt
to "make config" or "make menuconfig" will fail with link errors, ex:

scripts/kconfig/mconf.o:mconf.c:(.text+0xf63): undefined reference to
`_libintl_gettext'

This patch attempts to correct the problem by detecting whether or not
NLS support requires linking with libintl.

Signed-off-by: Samuel J Robb <sam.robb@timesys.com>

---

--- linux-2.6.15.1/scripts/kconfig/Makefile.orig 2006-01-25 14:55:22.926372900 -0500
+++ linux-2.6.15.1/scripts/kconfig/Makefile 2006-01-30 12:51:04.551596200 -0500
@@ -122,7 +122,17 @@ KBUILD_HAVE_NLS := $(shell \
then echo yes ; \
else echo no ; fi)
ifeq ($(KBUILD_HAVE_NLS),no)
-HOSTCFLAGS += -DKBUILD_NO_NLS
+ HOSTCFLAGS += -DKBUILD_NO_NLS
+else
+ KBUILD_NEED_LINTL := $(shell \
+ if echo -e "\#include <libintl.h>\nint main(int a, char** b) { gettext(\"\"); return 0; }\n" | \
+ $(HOSTCC) $(HOSTCFLAGS) -x c - > /dev/null 2>&1 ; \
+ then echo no ; \
+ else echo yes ; fi)
+ ifeq ($(KBUILD_NEED_LINTL),yes)
+ HOSTLOADLIBES_conf += -lintl
+ HOSTLOADLIBES_mconf += -lintl
+ endif
endif

# generated files seem to need this to find local include files
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kconfig: detect if -lintl is needed when linking conf,mconf [ In reply to ]
On Mon, Jan 30, 2006 at 01:26:47PM -0500, Robb, Sam wrote:
> This patch attempts to correct the problem by detecting whether or not
> NLS support requires linking with libintl.
>

Sigh. Can everyone please stop assuming gcc can output to /dev/null? On
several platforms, ld tries to lseek in the output file, and fails if it
can't.

Is there any reason this problem can't be solved the same way it is
for libcurses in menuconfig, by using gcc -print-filename? Or perhaps
using tempfile?

Cheers,
Kyle
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kconfig: detect if -lintl is needed when linking conf,mconf [ In reply to ]
Kyle McMartin <kyle@parisc-linux.org> wrote:
>
> On Mon, Jan 30, 2006 at 01:26:47PM -0500, Robb, Sam wrote:
> > This patch attempts to correct the problem by detecting whether or not
> > NLS support requires linking with libintl.
> >
>
> Sigh. Can everyone please stop assuming gcc can output to /dev/null? On
> several platforms, ld tries to lseek in the output file, and fails if it
> can't.

Ah.

> Is there any reason this problem can't be solved the same way it is
> for libcurses in menuconfig, by using gcc -print-filename? Or perhaps
> using tempfile?

Sam has plans to address this problem I guess we should drop that patch.

Linus, please nuke 5e375bc7d586e0df971734a5a5f1f080ffd89b68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] kconfig: detect if -lintl is needed when linking conf,mconf [ In reply to ]
Kyle McMartin <kyle@parisc-linux.org> wrote:
> On Mon, Jan 30, 2006 at 01:26:47PM -0500, Robb, Sam wrote:
> > This patch attempts to correct the problem by detecting whether or not
> > NLS support requires linking with libintl.
> >
>
> Sigh. Can everyone please stop assuming gcc can output to /dev/null? On
> several platforms, ld tries to lseek in the output file, and fails if it
> can't.

Ouch. Out of curiosity - what is the reason for this behavior in ld?

> Is there any reason this problem can't be solved the same way it is
> for libcurses in menuconfig, by using gcc -print-filename? Or perhaps
> using tempfile?

Using -print-file-name may cause problems if a system has libintl installed,
and the C library provides libintl support as well - you end up detecting
libintl, but linking to it isn't a good idea in that case. Not to mention
figuring out which libintl to link to - static lib? .so? .dll (cygwin)?

Using a tempfile sounds like the right solution - you want to detect if
linking with -lintl is absolutely required, not just if the library exists.

Sam Ravenborg mentioned reimplementing this using check-lxdialog.sh. I'll
wait and see what comes of that.

BTW - many thanks to all the folks who looked at this (admittedly trivial)
patch. There's a level of professionalism and attention to detail in the
Linux community that's very refrehing.

-Samrobb
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kconfig: detect if -lintl is needed when linking conf,mconf [ In reply to ]
On Thu, Feb 09, 2006 at 12:24:12PM -0500, Robb, Sam wrote:
>Kyle McMartin <kyle@parisc-linux.org> wrote:
>>On Mon, Jan 30, 2006 at 01:26:47PM -0500, Robb, Sam wrote:
>>> This patch attempts to correct the problem by detecting whether or not
>>> NLS support requires linking with libintl.
>>
>>Sigh. Can everyone please stop assuming gcc can output to /dev/null? On
>>several platforms, ld tries to lseek in the output file, and fails if it
>>can't.
>
>Ouch. Out of curiosity - what is the reason for this behavior in ld?

Ouch, indeed.

I'd be interested in details on which platforms perform so lamely. When
I grep for lseek and its variants in the bfd and ld source code, the only
occurrences that I see are all working on object files - as I would expect.

-Chris Faylor
(one of the) binutils maintainers
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/