This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ready for test/1.5.0] libiconv & gettext (many)


Corinna Vinschen wrote:

> trying to build sharutils for 1.5.0, I've just came across a problem:
> 
>   gcc  -o shar shar.o encode.o ../lib/libshar.a  ../lib/libshar.a -lintl -lintl 
>   shar.o(.text+0x5523): In function `main':
>   /home/corinna/src/sharutils-4.2.1/src/shar.c:1970:
>     undefined reference to `__imp___nl_default_dirname__'
> 
> `nm /usr/lib/libintl.dll.a' shows only a symbol
> __imp__libintl_nl_default_dirname.
> 
> The sharutils configury recognizes that the system has libintl.a but
> is too dumb to remove the own intl subdir from the include paths.
> So I thought this might be an incompatibility between the intl version
> in sharutils and our own version.  I removed all include paths to its
> own intl dir by hand and built again.  But the error persists.
> 
> Then I had a look into the file which produces the error and I found
> this:
> 
>   #ifdef __CYGWIN__
>     extern const char __declspec(dllimport) _nl_default_dirname__[];
>     puts (_nl_default_dirname__);
>   #else
>     extern const char _nl_default_dirname[]; /* Defined in dcgettext.c  */
>     puts (_nl_default_dirname);
>   #endif
> 
> What's the error here?  Is the sharutils code plain wrong or is that
> an incompatibility of the new libintl?

Sharutils is wrong, in two ways.  First, _nl_default_dirname is an
internal variable -- sharutils shouldn't be accessing it at all.  Second,
dcigettext.c defines it thus:

#if !defined _LIBC
# define _nl_default_default_domain libintl_nl_default_default_domain
# define _nl_current_default_domain libintl_nl_current_default_domain
# define _nl_default_dirname libintl_nl_default_dirname
# define _nl_domain_bindings libintl_nl_domain_bindings
#endif

But sharutils doesn't take _LIBC into account.

Quick-n-dirty fix: use libintl_ instead.

------

Slightly better fix: add some configury magic.  Make sure that the
acinclude.m4 or aclocal.m4 contains the latest gettext.m4 code, and then
add to configure.ac:

if test "$gt_cv_func_gnugettext_libc" = "yes"
  # do stuff to set variables so that _nl_default_dirname doesn't get
  re#defined
else
  # set the variables the other way so that it DOES get re#defined to
  libintl_nl_...
fi

------

Real fix: figure out why sharutils thinks it needs access to that
variable, and use the public API to do the same thing.  If possible.
--
  Charles Wilson
  cygwin at removespam cwilson dot fastmail dot fm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]