- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Linking fix for non-default gettext package #3629
Comments
|
|
I think that this patch is not correct.
It seems to me that the real problem is that we still use an outdated variable $(INTLLIBS) to link to gettext, see source:lib/Makefile.am#L77. The right way is to use the "new" @LTLIBINTL@ substitution in libmc, and the problem should go away:
https://www.gnu.org/software/gettext/manual/html_node/src_002fMakefile.html
My understanding is that it's currently done for libmc, so that we don't need to do it separately for mc binaries, tests, etc. |
|
Honestly, libintl_* undefined in libinternal.a .
|
Your for finding of libmc $(INTLLIBS) I attached a cleanup patch at #3607. |
|
|
|
|
|
I think we are seeing similar (the same?) bug on musl (https://bugs.gentoo.org/693850) and on glibc. Simple reproducer:
|
Tl;DR: lib/Makefile.am:libmc_la_LIBADD += ... $(LIBINTL) is invalid because $(LIBINTL) can only be used against executable programs to link against, not shared libraries and not even static libraries.
Looking at why it happens:
Note how lobtool builds libmc library:
Reading through https://www.gnu.org/software/libtool/manual/html_node/Inter_002dlibrary-dependencies.html it looks like libtool understands only *.la and -l<foo> arguments as library dependencies.
Thus one of the workarounds for users would be to rely on linker for shared libraries to link libintl into libmc.so: ./configure --with-included-gettext --enable-mclib.
Unfortunately .a files are not built in a PIC mode because they are not intended for linking into shared libraries:
Thus attached patch is correct at least for --disable-mclib case. --enable-mclib requires even more work. |
0001-Ticket-3629-configure.ac-drop-bundled-gettext.patch |
0001-Ticket-3629-configure.ac-drop-bundled-gettext.patch just drops bundled gettext. |
|
Linkage fail can be fixed using AM_ICONV: --- a/configure.ac
+++ b/configure.ac
@@ -272,6 +272,7 @@ dnl ############################################################################
dnl Internationalization
dnl ############################################################################
+AM_ICONV
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION([0.18.1])
But anyway, i18n is broken. There no cyrillic in the TUI: question marks are shown instead of cyrillic letters. |
Replying to andrew_b:
It's not clear which ./configure options you are using thus I'm not sure how to reproduce. It's probably due to src/main.c's conditional:
and HAVE_SETLOCALE is not set.
The fix would be to add a
in configure.ac.
Before mc implicitly relied on intl.m4 to detect the same. |
Replying to andrew_b:
Can you share your config.log? It does not happen for me. It feels like mc does not really use any iconv_* symbols directly and gettext.m4 should sort all out itself.
I wonder if the -liconv flag comes from $(LIBICONV) at
and should just be removed. |
Indeed,
fixes the cyrillic in the TUI and
fixes the linkage error.
The patch on top on your one is following: diff --git a/configure.ac b/configure.ac
index 79b63b39f..bd1f06b26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,6 +272,8 @@ dnl ############################################################################
dnl Internationalization
dnl ############################################################################
+AC_CHECK_FUNCS([setlocale])
+
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION([0.18.1])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 69c47601f..455f9ddf7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -74,4 +74,4 @@ else
libmc_la_LIBADD += $(GLIB_LIBS)
endif
-libmc_la_LIBADD += $(PCRE_LIBS) $(LIBICONV)
+libmc_la_LIBADD += $(PCRE_LIBS)
Yes. mc uses g_iconv_* from GLib only. |
Branch: 3629_external_gettext |
|
|
Important
This issue was migrated from Trac:
and
slyfox
(@trofi)mc lost the linking game if gettext package pulled from outside of system paths.
(Pulling can be done by suitable C-/CPP/LDFLAGS settings)
Furthermore gettext package depends on libintl (if system lib
don't provide needed functions) then gettext prepare INITLIBS/LIBINTL variable
for working libintl pull in from gettext libdir.
https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined
Let respect LIBINTL variable at linking (it is empty if not needed).
Failure example for Solaris 10 with non-system-default gettext package:
Undefined first referenced
Signed-off-by: Andreas Mohr <and@gmx.li>
Note
Original attachments:
and
onApr 1, 2016 at 21:11 UTC
slyfox
(@trofi) onSep 11, 2019 at 22:04 UTC
The text was updated successfully, but these errors were encountered: