Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 574794 - bootstrap failed: undefined reference to `libintl_gettext'
Summary: bootstrap failed: undefined reference to `libintl_gettext'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on: 575102 564168 574822
Blocks:
  Show dependency tree
 
Reported: 2016-02-15 14:26 UTC by Marko Vendelin
Modified: 2016-04-22 07:07 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Vendelin 2016-02-15 14:26:27 UTC
While boostraping prefix on Gentoo Linux, the compilaltion failed with 

hostname.c:(.text+0xb60): undefined reference to `libintl_gettext'
hostname.c:(.text+0xb84): undefined reference to `libintl_gettext'
hostname.c:(.text+0xc26): undefined reference to `libintl_gettext'
hostname.c:(.text+0xd01): undefined reference to `libintl_gettext'

in stage3. It seems that undefined reference to `libintl_gettext' is haunting in other conditions as well. I have problems on other recent prefix install with several packages refusing to build due to the same error. 

To reproduce:

run ./bootstrap-prefix.sh

Result:

make[1]: Leaving directory '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/work/net-tools-1.60_p20151124144947/lib'
 * ERROR: sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix'`.
 * The complete build log is located at '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/temp/build.log'.
 * The ebuild environment file is located at '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/temp/environment'.
 * Working directory: '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/work/net-tools-1.60_p20151124144947'
 * S: '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/work/net-tools-1.60_p20151124144947'

>>> Failed to emerge sys-apps/net-tools-1.60_p20151124144947, Log file:

>>>  '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/temp/build.log'
 * Messages for package sys-apps/man-1.6g-r1:
 * 'enewgroup()' disabled in Gentoo Prefix with non-root user (by design)
 *     Group: 'man' not created
 * 'enewuser()'  disabled in Gentoo Prefix with non-root user (by design)
 *     User: 'man' not created
 * Messages for package sys-apps/net-tools-1.60_p20151124144947:
 * ERROR: sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/net-tools-1.60_p20151124144947::gentoo_prefix'`.
 * The complete build log is located at '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/temp/build.log'.
 * The ebuild environment file is located at '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/temp/environment'.
 * Working directory: '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/work/net-tools-1.60_p20151124144947'
 * S: '/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-apps/net-tools-1.60_p20151124144947/work/net-tools-1.60_p20151124144947'
Comment 1 Eric N. Vander Weele 2016-02-16 16:27:20 UTC
I came across this on last Friday.  This is due to https://gitweb.gentoo.org/repo/proj/prefix.git/commit/sys-devel/gettext?id=1f7ac307c1e7f68d9fbcebc582d75ed16ae7bcc3.

What happens is that sys-devel/libintl emerges first, which installs the library.  However, sys-devel/gettext emerges afterwards, which ends up removing the library due to the aforementioned commit.

While investigating this, a lot of this boils down the USE flag 'nls' and FEATURE 'collision-protect'.  

@Fabian, I have been chasing this down for quite some time and realize there is this tension with 'nls' and '-nls' when bootstrapping and enablement of 'collision-protect' FEATURE.  I think I almost have this unraveled and would like to submit a series of patches to simplify things.  Please let me know how you would like to proceed (new bug to track this, communicate via the mailing list, or whatever you prefer).
Comment 2 Fabian Groffen gentoo-dev 2016-02-16 18:30:40 UTC
this bug should be fine, looking forward to your patches
Comment 3 Eric N. Vander Weele 2016-02-16 20:31:10 UTC
So it turns out that the 'nls' USE flag for sys-devel/gettext controls whether it builds and installs 'libintl'.  

Observing the history of sys-devel/gettext, it was split out to have sys-devel/libint be a separate ebuild.  However, in the gentoo tree, https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-devel/gettext?id=2bb8a68aaa9007e1b4f7437453bcf66de097f524 indicates that '--without-included-gettext' controls libint; which it does not.

Additionally, https://gitweb.gentoo.org/repo/proj/prefix.git/commit/sys-devel/gettext?id=1f7ac307c1e7f68d9fbcebc582d75ed16ae7bcc3 attempted in the prefix tree compensated for this by removing the related libint files (which is the root cause for this bug).

Now the motivation for removing the libint files in the prefix tree of sys-devel/gettext is because the collision-protect FEATURE is enabled by $EPREFIX/usr/portage/profiles/prefix/make.defaults.  It turns out that many profiles *do not* use collision-protect, which is why the overriding of libint files haven't been an issue.

$ grep -R collision-protect $EPREFIX/usr/portage/profiles
arch/amd64/x32/make.defaults:FEATURES="collision-protect multilib-strict"
default/linux/amd64/dev/32bit-userland/make.defaults:FEATURES="collision-protect multilib-strict"
prefix/make.defaults:FEATURES="collision-protect"
targets/developer/make.defaults:FEATURES="collision-protect sign splitdebug test test-fail-continue userpriv usersandbox"


I think the near-term resolution is to remove the 'nls' USE flag from sys-devel/gettext and delegate that it *must* be enabled for sys-devel/libint (since it provides the library).  @Fabian, I think these should taken upstream by the gentoo tree.  Could you help me with that?

After we resolve this issue, I noticed that 'nls' USE flag is enabled by default in the prefix profile (linking to a parent profile that enables it).  The next thing I would like to do is simplify the collision-protect and nls usage in bootstrap-prefix.sh (some rudimentary attempts exhibited circular dependencies due to 'nls' usage).

I'll work on creating patches based on the gentoo tree ebuilds for gettext and libint and post them here.
Comment 4 Eric N. Vander Weele 2016-02-16 22:00:55 UTC
By sys-devel/libint, I meant dev-libs/libintl.
Comment 5 Eric N. Vander Weele 2016-02-16 23:52:15 UTC
Discovered bug 564168 for the gentoo tree.  This should probably depend upon that one.
Comment 6 Fabian Groffen gentoo-dev 2016-02-17 08:04:05 UTC
ok, perhaps the nls dep trick on libintl and disabling everything on gettext is the way forward, assuming gettext doesn't build/install less when it's disabled (like translations for itself or something)
Comment 7 Marko Vendelin 2016-02-18 10:01:53 UTC
I wonder if there is a way around this bug to make it possible to install and use prefix now. Maybe the problematic gettext should be blacklisted? Or the workaround from bug 564168 should be used with libintl provided by gettext?
Comment 8 Eric N. Vander Weele 2016-02-18 17:56:56 UTC
It turns out there there is an underlying root cause at play here.

It turns out that sys-apps/net-tools is not adding '-lintl' when the 'nls' USE flag is used.  The underlying Makefile from upstream net-tools doesn't add the '-lintl' library either when compiling with I18N support.  I'm going submit a patch and bug report to get this resolved with the net-tools ebuild and work on getting a patch upstream so the ebuild doesn't need to compensate for the underlying build-system not adding libintl when linking.

Even with what I just described resolved, there is still the issue sys-devel/gettext emerging after dev-libs/libintl due to https://gitweb.gentoo.org/repo/proj/prefix.git/commit/sys-devel/gettext?id=1f7ac307c1e7f68d9fbcebc582d75ed16ae7bcc3.  However, the root issue of this is due to bug 564168.

The simple workaround is to '-nls' when emerging sys-apps/net-tools and emerge gettext and then libintl, I think...
Comment 9 Marko Vendelin 2016-02-20 21:01:53 UTC
There is still a problem with bootstrapping prefix. First, there are few other packages out there that have the same problem as I have modified the boostrap script to remove nls USE flag from the following:

sys-devel/gettext -nls # this one should build, just not needed here 
sys-apps/net-tools -nls
sys-apps/attr -nls
sys-apps/util-linux -nls

Second, I modified the bootstrap script to emerge in the stage3 gettext and, after it, libintl. 

Third, in the end of the stage3, emerge --depclean is run which removed binutils. As a result, there is no linker for emerge -e system (and all is broken on that stage). So, I commented the line with emerge --depclean in the end of stage 3. 

Even after these steps, I am still stuck. In 

emerge -e system 

the build brakes on sys-devel/binutils-2.24-r2 . Error is 

x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold  -I/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold -I/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/../include -I/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/../elfcpp -DLOCALEDIR="\"/shared/envs/sysbio/gentoo-1602/usr/share/binutils-data/x86_64-pc-linux-gnu/2.24/locale\"" -DBINDIR="\"/shared/envs/sysbio/gentoo-1602/usr/x86_64-pc-linux-gnu/binutils-bin/2.24\"" -DTOOLBINDIR="\"/shared/envs/sysbio/gentoo-1602/usr/x86_64-pc-linux-gnu/bin\"" -DTOOLLIBDIR="\"/shared/envs/sysbio/gentoo-1602/usr/x86_64-pc-linux-gnu/lib\""   -W -Wall    -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=fileread.o -O2 -pipe -O2 -pipe -MT fileread.o -MD -MP -MF .deps/fileread.Tpo -c -o fileread.o /shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/fileread.cc
In file included from /shared/envs/sysbio/gentoo-1602/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/include/g++-v4/ext/hash_map:60:0,
                 from /shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/system.h:92,
                 from /shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/gold.h:35,
                 from /shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/fileread.cc:24:
/shared/envs/sysbio/gentoo-1602/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/include/g++-v4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^
/shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/fileread.cc:88:8: error: redefinition of ‘struct iovec’
 struct iovec { void* iov_base; size_t iov_len; };
        ^
In file included from /usr/include/bits/fcntl-linux.h:38:0,
                 from /usr/include/bits/fcntl.h:61,
                 from /usr/include/fcntl.h:35,
                 from /shared/envs/sysbio/gentoo-1602/var/tmp/portage/sys-devel/binutils-2.24-r2/work/binutils-2.24/gold/fileread.cc:29:
/usr/include/bits/uio.h:43:8: error: previous definition of ‘struct iovec’
 struct iovec
        ^
Makefile:836: recipe for target 'fileread.o' failed


Alternatively, if I use LATEST_TREE_YES=1 before boostrapping, I am stuck with the system that seem to have lost libncurses.6 in stage3:

...
>>> Installing (1 of 1) virtual/os-headers-0::gentoo_prefix
 * checking 0 files for package collisions
>>> Merging virtual/os-headers-0 to /
>>> virtual/os-headers-0 merged.
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.
[[: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory
Failed to validate a sane '/dev'.
bash process substitution doesn't work; this may be an indication of a broken '/dev/fd'.
/shared/envs/sysbio/gentoo-1602/bin/bash: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory


Any idea how to fix these errors?
Comment 10 Fabian Groffen gentoo-dev 2016-02-20 21:58:19 UTC
nls: I remember we disable it during the bootstrap, so this must be post-sync or something

stage3: why do you need gettext/libintl there?

depclean: if portage removes binutils, then something is clearly wrong, which indicates earlier problems

binutils: we might need a newer, or older version here to suit your system, what system is it you're bootstrapping on?  I'm thinking perhaps RAP could help you out here.
Comment 11 Marko Vendelin 2016-02-21 06:49:53 UTC
On the basis of current http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh :

nls: it seems to me that its enabled by default. On line 213, in bootstrap_setup(): echo 'USE="unicode nls"'

As such, I don't really need it, so maybe I should try without. Although, binutils will be a problem anyway (see below).


stage3: gettext is emerged there. In bootstrap_stage3(), line 1272

depclean: Its in the end of stage3. While doing it, it did warn about the system having no packages in world and telling that things may break over there. They did.

binutils: I am running current Gentoo as a base. We use prefix to allow users to tune their environment in one main server. Gentoo has 
sys-devel/binutils-2.25.1-r1 right now. So, maybe that's a problem.

How do I get to RAP? I heard a bit about it, but I haven't stumbled on installation instructions, or how to switch to it, nor the current state of it.
Comment 12 Marko Vendelin 2016-02-21 15:22:23 UTC
As for binutils bug, I've got the same error while installing prefix on 

CentOS release 6.5 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.5 (Final)
Rocks release 6.1 (Emerald Boa)
CentOS release 6.5 (Final)

So, it seems not to be limited to current Gentoo
Comment 13 Marko Vendelin 2016-03-20 12:48:41 UTC
Its possible to get prefix bootstrapped, but one has to add -lintl to few packages. However, there seem to be a problem with gcc. Namely, libstdc++ starts depending on -lintl if gcc is emerged after gettext + libintl. Unfortunately, gcc does not add libintl into required libs for g++ which means that compilation of any c++ program would require addition of -lintl by user. It reminds of bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56779 . To avoid it, I have run the following commands:

emerge --unmerge gettext dev-libs/libintl virtual/libintl
emerge -v --nodeps gcc
emerge -1v gettext dev-libs/libintl virtual/libintl

This prevents gcc finding libintl.h in prefix and allows to use g++ without -lintl if its not needed by user code.

I don't know why my setup triggers it, maybe current Gentoo has something that leads to it in glibc/gettext of the system
Comment 14 Michael Schubert 2016-03-22 12:06:03 UTC
This is a warning to *NOT* run the above commands after a finished bootstrap - it breaks everything.
Comment 15 Marko Vendelin 2016-03-22 12:22:37 UTC
Agreed: my 'fix' may break everything to pieces. You may have to use LD_LIBRARY_PATH to glue pieces together while emerging gcc & gettext. 

However, this is surely *NOT* the fix that we need. As it is, situation with -lintl is killing prefix: its very hard to bootstrap it & and you are afraid to install anything in it. Hopefully, someone will find a proper fix.
Comment 16 Alexey Shvetsov archtester gentoo-dev 2016-03-28 10:53:01 UTC
This gettext symbol should be provided by system libc, thats why pulling in dev-libs/libintl target on prefix linux targets is wrong. See #578434 and gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56779. 

So it shouldnt be used on hosts with glibc.
Comment 17 Fabian Groffen gentoo-dev 2016-04-08 09:57:29 UTC
I think my recent LDFLAGS fix can also be the fix for this problem.
Comment 18 redneb 2016-04-10 12:28:05 UTC
(In reply to Fabian Groffen from comment #17)
> I think my recent LDFLAGS fix can also be the fix for this problem.

Unfortunately it didn't. I tried to bootstrap a brand new prefix (on an amd64 gentoo linux host) with the new bootstrap-prefix.sh (i.e. the one with LDFLAGS="-L${ROOT}/usr/lib") and it still has the same issue with the undefined references to `libintl_gettext'.
Comment 19 Daa Jaa 2016-04-12 13:00:43 UTC
@Marko Vendelin:

You can replace emerge -u system by exit.

After that "exit" has been executed, you can type:

  bootstrap-prefix.sh $EPREFIX startscript

This create the script $EPREFIX/startprefix that you can source to enter your prefix.

Your prefix will be working almost normally, but not up to date. Don't try emerge -e system though.
Comment 20 Thomas Scheller 2016-04-12 14:33:49 UTC
(In reply to Daa Jaa from comment #19)
> You can replace emerge -u system by exit.

I can confirm, this workaround works for me to get a working prefix beeing able to emerge some software.
Comment 21 Thomas Scheller 2016-04-12 16:49:17 UTC
After deleting "$EPREFIX/usr/include/libintl.h" I am able to run "emerge net-tools" with success.
Also "emerge --deep --newuse -u @world" works fine.
No clue about side-effects.
Comment 22 Daa Jaa 2016-04-13 14:43:46 UTC
@Marko Vendelin: if you upload here your patch to bootstrap-prefix.sh, I will modify it so that the bootstraps succeeds. This means inserting "rm $EPREFIX/usr/include/libintl.h" just after emerge --sync ...
Comment 23 William Throwe 2016-04-16 14:25:34 UTC
I'm not sure, but this may be related to bug 574822.
Comment 24 Fabian Groffen gentoo-dev 2016-04-20 07:55:32 UTC
I'm wondering if this would be fixed by Michael's fix from bug #574822.
Comment 25 redneb 2016-04-20 17:38:17 UTC
(In reply to Fabian Groffen from comment #24)
> I'm wondering if this would be fixed by Michael's fix from bug #574822.

Unfortunately, emerging sys-apps/net-tools still fails with the same libintl_gettext errors. This happens at the second to last step of stage3, namely:

    CFLAGS= CXXFLAGS= USE="-git" emerge -u system

If I remember correctly, in the past it failed earlier, so maybe the situation has improved a little bit.
Comment 26 Michael Haubenwallner (RETIRED) gentoo-dev 2016-04-21 07:55:05 UTC
(In reply to redneb from comment #25)
> (In reply to Fabian Groffen from comment #24)
> > I'm wondering if this would be fixed by Michael's fix from bug #574822.
> 
> Unfortunately, emerging sys-apps/net-tools still fails with the same
> libintl_gettext errors.

As far as I am aware of, a new tree snapshot is created around midnight UTC.
And be aware to set LATEST_TREE=yes to actually use it.

try$ ls -ld <your-prefix>/var/db/pkg/*/libi*

If you have anything else than virtual/{libiconv,libintl}-0-r2
then you have bootstrapped using an old tree snapshot.
Comment 27 redneb 2016-04-21 20:54:58 UTC
(In reply to Michael Haubenwallner from comment #26)
> As far as I am aware of, a new tree snapshot is created around midnight UTC.
> And be aware to set LATEST_TREE=yes to actually use it.

Forcing the latest tree makes everything work correctly now, thanks.
Comment 28 Fabian Groffen gentoo-dev 2016-04-22 07:07:53 UTC
I bumped the snapshot yesterday, so that should fix this issue.

Thanks all for input, fixes and testing!