Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 598874 - x11-drivers/nvidia-drivers-375.10: cannot find -lnvidia-ml
Summary: x11-drivers/nvidia-drivers-375.10: cannot find -lnvidia-ml
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-03 18:08 UTC by Keith Harrison
Modified: 2016-11-12 10:45 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,444.76 KB, text/plain)
2016-11-03 18:08 UTC, Keith Harrison
Details
emerge --info (emerge.info,6.77 KB, text/plain)
2016-11-03 18:09 UTC, Keith Harrison
Details
Patch for x11-drivers/nvidia-drivers-375.10-r1 (nvidia-drivers-375.10-r1_ebuild.patch,531 bytes, patch)
2016-11-04 21:01 UTC, David Haller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Harrison 2016-11-03 18:08:55 UTC
Created attachment 452278 [details]
build.log

Fresh install of nvidia-drivers-375.10 fails with the following error:

x86_64-pc-linux-gnu-gcc -O2 -pipe -fno-strict-aliasing -fno-omit-frame-pointer -Wformat=2 -Wno-unused-parameter -Wno-format-zero-length -DNV_LINUX -DNV_X86_64 -DNV_ARCH_BITS=64   -I /usr/include/nvidia/gdk  -I . -I image_data -I libXNVCtrl -I XF86Config-parser/.. -I libXNVCtrlAttributes -I xpm_data -I common-utils -I common-unix/virtual-resolutions -I _out/Linux_x86_64 -I /usr/include -DPROGRAM_NAME=\"nvidia-settings\" -Wl,-O1 -Wl,--as-needed -L/usr/X11R6/lib64   \
    -rdynamic -o _out/Linux_x86_64/nvidia-settings.unstripped _out/Linux_x86_64/command-line.o _out/Linux_x86_64/config-file.o _out/Linux_x86_64/lscf.o _out/Linux_x86_64/nvidia-settings.o _out/Linux_x86_64/parse.o _out/Linux_x86_64/query-assign.o _out/Linux_x86_64/app-profiles.o _out/Linux_x86_64/glxinfo.o _out/Linux_x86_64/NvCtrlAttributes.o _out/Linux_x86_64/NvCtrlAttributesNvControl.o _out/Linux_x86_64/NvCtrlAttributesVidMode.o _out/Linux_x86_64/NvCtrlAttributesXv.o _out/Linux_x86_64/NvCtrlAttributesGlx.o _out/Linux_x86_64/NvCtrlAttributesXrandr.o _out/Linux_x86_64/NvCtrlAttributesUtils.o _out/Linux_x86_64/NvCtrlAttributesNvml.o _out/Linux_x86_64/nvgetopt.o _out/Linux_x86_64/common-utils.o _out/Linux_x86_64/msg.o _out/Linux_x86_64/nvvr.o _out/Linux_x86_64/g_stamp.o libXNVCtrl/libXNVCtrl.a -L../../ -lnvidia-ml -lXxf86vm -ljansson -lX11 -lXext -lm -ldl
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnvidia-ml
collect2: error: ld returned 1 exit status
make: *** [Makefile:287: _out/Linux_x86_64/nvidia-settings.unstripped] Error 1
make: Leaving directory '/var/tmp/portage/x11-drivers/nvidia-drivers-375.10/work/nvidia-settings-375.10/src'
 * ERROR: x11-drivers/nvidia-drivers-375.10::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=x11-drivers/nvidia-drivers-375.10::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=x11-drivers/nvidia-drivers-375.10::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-375.10/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-375.10/temp/environment'.
 * Working directory: '/var/tmp/portage/x11-drivers/nvidia-drivers-375.10/work'
 * S: '/var/tmp/portage/x11-drivers/nvidia-drivers-375.10/work/'

As a workaround one can build without tools first:

USE="-tools" emerge -1 nvidia-drivers

Then building with tools comples fine as expected:

USE="tools" emerge -1 nvidia-drivers
Comment 1 Keith Harrison 2016-11-03 18:09:54 UTC
Created attachment 452280 [details]
emerge --info
Comment 3 David Haller 2016-11-04 21:01:11 UTC
Created attachment 452396 [details, diff]
Patch for x11-drivers/nvidia-drivers-375.10-r1

This works for me.
Comment 4 Zac Medico gentoo-dev 2016-11-10 20:59:35 UTC
(In reply to David Haller from comment #3)
> Created attachment 452396 [details, diff] [details, diff]
> Patch for x11-drivers/nvidia-drivers-375.10-r1
> 
> This works for me.

Same here. I guess it didn't fail for jer because he had an installed libnvidia-ml.so for it to link against.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-10 21:17:01 UTC
(In reply to Zac Medico from comment #4)
> I guess it didn't fail for jer because he had an installed
> libnvidia-ml.so for it to link against.

No.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-11 09:16:56 UTC
This happens because no library symlinks are in place.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-11 09:19:29 UTC
Comment on attachment 452396 [details, diff]
Patch for x11-drivers/nvidia-drivers-375.10-r1

>diff -urN a/nvidia-drivers-375.10-r1.ebuild b/nvidia-drivers-375.10-r1.ebuild
>--- a/nvidia-drivers-375.10-r1.ebuild	2016-11-04 21:57:32.523464933 +0100
>+++ b/nvidia-drivers-375.10-r1.ebuild	2016-11-04 21:57:50.047464833 +0100
>@@ -176,6 +176,7 @@
> 	if use tools; then
> 		cp "${DISTDIR}"/nvml.h-${PV} "${S}"/nvidia-settings-${PV}/src/nvml.h || die
> 		sed -i -e 's|-lnvidia-ml|-L../../ &|g' nvidia-settings-${PV}/src/Makefile || die
>+		ln -sf libnvidia-ml.so.${PV} libnvidia-ml.so

That doesn't fix the 32/libnvidia-ml.so case.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-11 09:41:38 UTC
Please try again with -r1.

commit 38279d34de57f768e1bcc79a264f5b096059e734
Author: Jeroen Roovers <jer@gentoo.org>
Date:   Fri Nov 11 10:39:57 2016 +0100

    x11-drivers/nvidia-drivers: Set up libnvidia-ml.so symlinks (bug #598874).

    Package-Manager: portage-2.3.2
Comment 9 Zac Medico gentoo-dev 2016-11-11 16:38:03 UTC
375.10-r1 works for me now. Thanks!
Comment 10 David Haller 2016-11-12 07:05:36 UTC
(In reply to Jeroen Roovers from comment #8)
> Please try again with -r1.
> 
> commit 38279d34de57f768e1bcc79a264f5b096059e734

Please, do proper patch handling. Your patch (see below) looks good, but overwriting -r1 is bad!
I had to reconstruct the old -r1 from my local overlay...

==== saved nvidia-drivers-375.10-r1.ebuild vs. current (with diff -U4) ====
diff -U4 a/nvidia-drivers-375.10-r1.ebuild b/nvidia-drivers-375.10-r1.ebuild
@@ -174,8 +174,16 @@
 
 src_prepare() {
        if use tools; then
                cp "${DISTDIR}"/nvml.h-${PV} "${S}"/nvidia-settings-${PV}/src/nvml.h || die
+
+               ln -s libnvidia-ml.so.${PV} libnvidia-ml.so || die
+               if use multilib; then
+                       pushd 32/ 2>/dev/null || die
+                       ln -s libnvidia-ml.so.${PV} libnvidia-ml.so || die
+                       popd 2>/dev/null || die
+               fi
+
                sed -i -e "s|-lnvidia-ml|-L../../ &|g" nvidia-settings-${PV}/src/Makefile || die
        fi
 
        eapply "${FILESDIR}"/${P}-profiles-rc.patch
====

Will that work on 32bit non-multilib hosts???

Also, I'd propose a slightly different patch:

==== a/nvidia-drivers-375.10-r1.ebuild b/nvidia-drivers-375.10-r1.ebuild
@@ -176,6 +176,8 @@
        if use tools; then
                cp "${DISTDIR}"/nvml.h-${PV} "${S}"/nvidia-settings-${PV}/src/nvml.h || die
                sed -i -e "s|-lnvidia-ml|-L../../ &|g" nvidia-settings-${PV}/src/Makefile || die
+               ln -s libnvidia-ml.so.${PV} libnvidia-ml.so || die
+               test -d 32 && ln -sf libnvidia-ml.so.${PV} 32/libnvidia-ml.so
        fi
 
        eapply "${FILESDIR}"/${P}-profiles-rc.patch
====

(does the 32/ subdir exists in all 64bit builds? Anyway the symlink is
relative, thus it'll point to the 32/libnvidia-ml.so.${PV} lib and the
'test' catches it missing (on 32bit?)).

Anyway: the real reason for the build failure was the missing
libnvidia-ml.so symlink to the actual lib. So, please do credit me
in your patches / Changelog entries! Pinning the problem (what/where
and why) down is often much harder than the actual fix.

Of course, ultimately nvidia should fix their build.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-12 10:38:15 UTC
(In reply to David Haller from comment #10)
> (In reply to Jeroen Roovers from comment #8)
> > Please try again with -r1.
> > 
> > commit 38279d34de57f768e1bcc79a264f5b096059e734
> 
> Please, do proper patch handling. Your patch (see below) looks good, but
> overwriting -r1 is bad!

I have no idea why that would be bad. The Gentoo revision wasn't changed because the commit fixed a build failure. 

> I had to reconstruct the old -r1 from my local overlay...

Blame git?
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2016-11-12 10:45:43 UTC
(In reply to Zac Medico from comment #9)
> 375.10-r1 works for me now. Thanks!

Thanks.