Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 565878 - x11-drivers/nvidia-drivers - add USE=module
Summary: x11-drivers/nvidia-drivers - add USE=module
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-11-16 03:21 UTC by FranckSpike
Modified: 2020-07-29 09:21 UTC (History)
1 user (show)

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


Attachments
Add USE=module (nvidia-drivers-355.11-r3.ebuild.patch,3.47 KB, patch)
2015-11-16 03:40 UTC, FranckSpike
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description FranckSpike 2015-11-16 03:21:34 UTC
Added a 'module' use flag.

Reproducible: Always

Steps to Reproduce:
1. Have a x64-only system with a x86-only chroot.
2. Install the nvidia-drivers ebuild in the chroot.

Actual Results:  
The module fails to build because of architecture detection mismatch.

Expected Results:  
The x64 module should've been built, or by disabling module (when not needed) installation we can correctly install the nvidia-drivers ebuild.

I added a 'module' use flag so I can disable it on my setup, maybe other setups might need this.

I run a fully x64 system and made a chroot to run a x86 system. My x64 kernel already has the nvidia module loaded, but I need the nvidia x86 user libraries also installed on my x86 chroot system.

My problen was that the ebuild was also trying to compile the module but failed because of architecture detection mismatch...

So I added a 'module' use flag so I can disable it.

Here's the diff from nvidia-drivers-355.11-r2.ebuild

31c31
< IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
---
> IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm +module"
83c83
<       if use kernel_linux && kernel_is ge 4 3; then
---
>       if use module && use kernel_linux && kernel_is ge 4 3; then
107c107
<       use kernel_linux && check_extra_config
---
>       use module && use kernel_linux && check_extra_config
115c115
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
159c159
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
185c185
<       if use kernel_FreeBSD; then
---
>       if use module && use kernel_FreeBSD; then
188c188
<       elif use kernel_linux; then
---
>       elif use module && use kernel_linux; then
237c237
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
251c251
<       elif use kernel_FreeBSD; then
---
>       elif use module && use kernel_FreeBSD; then
290c290
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
318c318
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
440c440
<       if use kernel_linux; then
---
>       if use module && use kernel_linux; then
467c467
<       use kernel_linux && linux-mod_pkg_postinst
---
>       use module && use kernel_linux && linux-mod_pkg_postinst
498c498
<       use kernel_linux && linux-mod_pkg_postrm
---
>       use module && use kernel_linux && linux-mod_pkg_postrm
Comment 1 FranckSpike 2015-11-16 03:40:23 UTC
Created attachment 417072 [details, diff]
Add USE=module

A patch for nvidia-drivers-355.11-r2.ebuild
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-17 06:45:28 UTC
Can we go back to the premise for a minute and decide whether to use a chroot for this purpose is the proper way about it?
Comment 3 FranckSpike 2015-11-17 14:26:50 UTC
I didn't want to use multilib, I want a full x64 only system with no pollution and no difficulties to get rid of the x86 binaries, but still wanted to execute x86 binaries which are not x64 ready yet.

I think it would be a good idea to open the flexibility of not installing the module under special setup like mine.

It could also be helpful when cross compiling a new linux distribution which is destined to be used with another kernel.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2015-12-06 05:49:28 UTC
We set BUILD_FIXES in pkg_setup() using `uname -m' and it's probably better to just fix that instead.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2015-12-06 06:07:53 UTC
How about this?

--- a/x11-drivers/nvidia-drivers/nvidia-drivers-358.16-r1.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-358.16-r1.ebuild
@@ -130,7 +130,7 @@ pkg_setup() {
                # sets the ARCH to x86 but NVIDIA's wrapping Makefile
                # expects x86_64 or i386 and then converts it to x86
                # later on in the build process
-               BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+               BUILD_FIXES="ARCH=$(use x86 && echo i386 || echo x86_64)"
        fi

        # set variables to where files are in the package structure
Comment 6 FranckSpike 2015-12-07 23:09:00 UTC
This does not fix the issue on my system, I get the exact same error as before:

kernel/nvidia/nv-frontend.c:1:0: error: CPU you selected does not support x86-64 instruction set

I'm not sure exactly what "selected" the CPU, I assume this portage link
/etc/portage/make.profile -> /usr/portage/profiles/default/linux/x86/13.0

And even though $(use x86 && echo i386 || echo x86_64) selects i386, something still tells to try to use the x86-64 instruction set.

Since it is a module that is trying to build, I guess that maybe the x86-64 instruction set selection comes from the kernel source configuration or maybe another uname -m done somewhere else in a configuration script…
Comment 7 FranckSpike 2015-12-07 23:13:15 UTC
Or maybe more logically: i386 is the selected CPU that doesn't support the x86-64 instruction set.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2016-01-10 21:11:25 UTC
I added USE=driver to 3.61.16. I hope it works for you.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2016-01-10 21:11:54 UTC
(In reply to Jeroen Roovers from comment #8)
> I added USE=driver to 3.61.16.

That's 361.16.
Comment 10 Larry the Git Cow gentoo-dev 2020-07-29 09:21:05 UTC
The bug has been referenced in the following commit(s):

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

commit 8dac0f9ca4214634fb46ffd8e83cb6857387bc32
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2020-07-29 09:19:03 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2020-07-29 09:21:02 +0000

    x11-drivers/nvidia-drivers: Backport USE=driver to 340.*
    
    Package-Manager: Portage-3.0.1, Repoman-2.3.23
    Bug: https://bugs.gentoo.org/565878
    Fixes: 003365dfd596c07c7ab9e51126a99ed438ba1dc1
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 .../nvidia-drivers/nvidia-drivers-340.108.ebuild       | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)