Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724558 - multilib.eclass: non-native multilib does not populate AR and NM, breaks gmp build (was: dev-libs/gmp-6.2.0-r1[abi_x86_32] directly calls "nm")
Summary: multilib.eclass: non-native multilib does not populate AR and NM, breaks gmp ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://archives.gentoo.org/gentoo-de...
Whiteboard:
Keywords:
Depends on:
Blocks: tc-directly
  Show dependency tree
 
Reported: 2020-05-22 09:43 UTC by Kent Fredric (IRC: kent\n) (RETIRED)
Modified: 2020-05-24 21:04 UTC (History)
1 user (show)

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


Attachments
build.log.gz (gmp-6.2.0-r1:20200522-093757.log.gz,8.91 KB, application/gzip)
2020-05-22 09:43 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details
config.log (config.log,184.70 KB, text/plain)
2020-05-22 09:44 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2020-05-22 09:43:43 UTC
Created attachment 640872 [details]
build.log.gz

Under a "no binutils/gcc symlinks" system (See bug #724454):

checking for assembler .type directive... .type $1,@$2
checking for assembler .size directive... .size $1,$2
checking for assembler local label prefix... configure.wrapped: WARNING: "nm" failure
configure.wrapped: WARNING: cannot determine local label, using default L
L
checking for assembler byte directive... .byte
checking how to define a 32-bit word... /var/tmp/portage/dev-libs/gmp-6.2.0-r1/work/gmp-6.2.0/configure.wrapped: line 21722: nm: command not found
/var/tmp/portage/dev-libs/gmp-6.2.0-r1/work/gmp-6.2.0/configure.wrapped: line 21722: nm: command not found
configure.wrapped: error: cannot determine how to define a 32-bit word

 * Package:    dev-libs/gmp-6.2.0-r1
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE:        abi_x86_32 abi_x86_64 amd64 asm cxx elibc_glibc kernel_linux userland_GNU
 * FEATURES:   ccache compressdebug network-sandbox preserve-libs sandbox splitdebug userpriv usersandbox
Comment 1 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2020-05-22 09:44:30 UTC
Created attachment 640874 [details]
config.log
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-22 22:25:25 UTC
It's a problem in NM detection for USE=abi_x86_32.

./configure --host=i686-pc-linux-gnu assumes that 'i686-pc-linux-gnu-nm' exists. Otherwise it falls back to 'nm'.

Binutils only installs 'x86_64-pc-linux-gnu-nm' on ARCH=amd64.

I think it's multilib.eclass's deficiency: at https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/multilib.eclass#n486

We don't override NM here but we should. And probably a bunch of other variables like AR.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-23 07:56:54 UTC
Sent for review as https://archives.gentoo.org/gentoo-dev/message/31ff4f1b297542b755f11fd930906a18
Comment 4 Larry the Git Cow gentoo-dev 2020-05-23 08:17:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd35b529194fdcadf324fd4f0a466a61aa1dfadb

commit dd35b529194fdcadf324fd4f0a466a61aa1dfadb
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-22 22:36:50 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-23 08:17:14 +0000

    multilib.eclass: populate AR, NM, RANLIB, OBJDUMP, STRIP, bug #724558
    
    For both multilib and non-multilib profiles binutils provides
    tools with native CHOST prefix only. For example on amd64 there
    is only 'x86_64-pc-linux-gnu-nm' and 'nm'.
    
    On abi_x86_32 tools are usually configured with --host=i686-pc-linux-gnu.
    Configure tries i686-pc-linux-gnu-nm, then falls back to 'nm'.
    
    The change overrides NM and friends to 'x86_64-pc-linux-gnu-nm' for
    multilib setup similar to other environment variables.
    
    Reported-by: Kent Fredric
    Closes: https://bugs.gentoo.org/724558
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/multilib.eclass | 5 +++++
 1 file changed, 5 insertions(+)
Comment 5 Arfrever Frehtes Taifersar Arahesis 2020-05-24 13:05:10 UTC
(In reply to comment #4)
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=dd35b529194fdcadf324fd4f0a466a61aa1dfadb
> 
> commit dd35b529194fdcadf324fd4f0a466a61aa1dfadb
> Author:     Sergei Trofimovich <slyfox@gentoo.org>
> AuthorDate: 2020-05-22 22:36:50 +0000
> Commit:     Sergei Trofimovich <slyfox@gentoo.org>
> CommitDate: 2020-05-23 08:17:14 +0000
> 
>     multilib.eclass: populate AR, NM, RANLIB, OBJDUMP, STRIP, bug #724558


You forgot to update 2 lists of temporarily modified variables above:

for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH} ; do
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-24 13:59:37 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> (In reply to comment #4)
> > https://gitweb.gentoo.org/repo/gentoo.git/commit/
> > ?id=dd35b529194fdcadf324fd4f0a466a61aa1dfadb
> > 
> > commit dd35b529194fdcadf324fd4f0a466a61aa1dfadb
> > Author:     Sergei Trofimovich <slyfox@gentoo.org>
> > AuthorDate: 2020-05-22 22:36:50 +0000
> > Commit:     Sergei Trofimovich <slyfox@gentoo.org>
> > CommitDate: 2020-05-23 08:17:14 +0000
> > 
> >     multilib.eclass: populate AR, NM, RANLIB, OBJDUMP, STRIP, bug #724558
> 
> 
> You forgot to update 2 lists of temporarily modified variables above:
> 
> for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH} ; do

I assume you meant https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/multilib.eclass#n454 

"""
	# First restore any saved state we have laying around.
	if [[ ${_DEFAULT_ABI_SAVED} == "true" ]] ; then
		for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH} ; do
			vv="_abi_saved_${v}"
			[[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v}
			unset ${vv}
		done
		unset _DEFAULT_ABI_SAVED
	fi

	# We want to avoid the behind-the-back magic of gcc-config as it
	# screws up ccache and distcc.  See #196243 for more info.
	if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
		# Back that multilib-ass up so we can restore it later
		for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH} ; do
			vv="_abi_saved_${v}"
			[[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv}
		done
		export _DEFAULT_ABI_SAVED="true"
                ...
"""

Looks legit. Do you plan to send a patch?
Comment 7 Larry the Git Cow gentoo-dev 2020-05-24 21:03:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1975b0bb9e07557c0a7b06c53b4e78950fe46eda

commit 1975b0bb9e07557c0a7b06c53b4e78950fe46eda
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-24 20:40:50 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-24 21:03:30 +0000

    multilib.eclass: save/restore AR, NM, RANLIB, OBJDUMP, STRIP, bug #724558
    
    A follow-up to commit dd35b529194fdc
    ("populate AR, NM, RANLIB, OBJDUMP, STRIP, bug #724558")
    
    Before the change AR and friends were set for non-default ABI
    and were not restored to defaults for next native ABI.
    
    It should not be a problem for default case as both do match.
    For consistency with other variables now we restore possibly
    unset values for native ABI.
    
    Noticed by Arfrever Frehtes Taifersar Arahesis.
    
    Reported-by: Arfrever Frehtes Taifersar Arahesis
    Bug: https://bugs.gentoo.org/724558
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/multilib.eclass | 5 +++++
 1 file changed, 5 insertions(+)