Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 598994 - x11-drivers/nvidia-drivers No working ebuilds on Gentoo/FreeBSD
Summary: x11-drivers/nvidia-drivers No working ebuilds on Gentoo/FreeBSD
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: AMD64 FreeBSD
: Normal normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2016-11-05 13:01 UTC by Enzo ME
Modified: 2019-10-11 17:37 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,2.67 KB, application/octet-stream)
2016-11-05 13:01 UTC, Enzo ME
Details
[WIP] sample patch for nvidia-drivers-375.10-r1.ebuild (bug598994.patch,5.64 KB, patch)
2016-11-06 02:28 UTC, Yuta SATOH
Details | Diff
Xorg logfile (Xorg.0.log,9.69 KB, text/plain)
2016-11-07 14:28 UTC, Enzo ME
Details
patch for nvidia-drivers-375.10-r1.ebuild (bug598994.patch,6.75 KB, patch)
2016-11-10 10:05 UTC, Yuta SATOH
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enzo ME 2016-11-05 13:01:50 UTC
Created attachment 452422 [details]
build.log

Ebuild not working on freebsd profile. Patching filename nvidia-application-profiles-375.10-rc actually not contains version and has name 
nvidia-application-profiles-rc. Kernel module nvidia.ko is builded in src/nvidia working tree but need to be installed from 'src' working tree. Also ebuild contains functions to install libraries that not present on 'obj' working directory.   

emerge --info:
Portage 2.3.2 (python 3.4.5-final-0, default/bsd/fbsd/amd64/11.0/clang, gcc-5.4.0, freebsd-lib-11.0, 11.0-Gentoo amd64)
=================================================================
                         System Settings
=================================================================
System uname: FreeBSD-11.0-Gentoo-amd64-64bit-ELF
Timestamp of repository gentoo: Sat, 05 Nov 2016 00:45:01 +0000
sh sh
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:         4.4-r1::gentoo
dev-lang/perl:           5.24.0-r2::gentoo
dev-lang/python:         2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:          3.6.3::gentoo
dev-util/pkgconfig:      0.29.1::gentoo
sys-apps/baselayout:     2.3::gentoo
sys-apps/openrc:         0.22.3::gentoo
sys-devel/autoconf:      2.69-r2::gentoo
sys-devel/automake:      1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:      2.26.1::gentoo
sys-devel/gcc:           5.4.0::gentoo
sys-devel/gcc-config:    1.8-r1::gentoo
sys-devel/libtool:       2.4.6-r2::gentoo
sys-devel/make:          4.2.1::gentoo
sys-freebsd/freebsd-lib: 11.0::gentoo (virtual/os-headers)
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64-fbsd ~amd64-fbsd"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-gentoo-freebsd11.0"
CFLAGS="-O2 -pipe -mtune=generic"
CHOST="x86_64-gentoo-freebsd11.0"
CONFIG_PROTECT="/boot/device.hints /etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -mtune=generic"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs chflags config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/lib/systemd"
LANG="ru_RU.UTF-8"
LDFLAGS=""
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X aac aacplus acl amd64-fbsd berkdb bindist consolekit cracklib crypt cxx dbus dri dts faac faad ffmpeg fontconfig gdbm gif gtk2 gtk3 iconv ipv6 mmx mmxext modules mp3 multilib ncurses nls opengl oss pam pcre png python2 readline sound sse sse2 ssl tcpd truetype unicode vorbis x264 xattr xcomposite xrandr zlib" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="FreeBSD" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" L10N="en ru RU" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en ru RU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="BSD" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

clang version: sys-devel/clang-3.9.0-r100
Comment 1 Yuta SATOH 2016-11-06 02:28:06 UTC
Created attachment 452494 [details, diff]
[WIP] sample patch for nvidia-drivers-375.10-r1.ebuild

I confirmed that compile and install was successful.
But, I don't have the nvidia card.

Would you try this patch ?

FYI,
# emerge -pv x11-drivers/nvidia-drivers
Calculating dependencies... done!
[ebuild   R    ] x11-drivers/nvidia-drivers-375.10-r1:0/375::gentoo  USE="X driver kms (-acpi) -compat -gtk3 (-multilib) (-pax_kernel) -static-libs -tools -uvm (-wayland)" 0 KiB

Note,
I have not test with USE=tools.
can not compile gtk+-2 on Gentoo/FreeBSD. I got Segmentation fault...
Comment 2 Enzo ME 2016-11-07 14:25:52 UTC
(In reply to Yuta SATOH from comment #1)
> Created attachment 452494 [details, diff] [details, diff]
> [WIP] sample patch for nvidia-drivers-375.10-r1.ebuild
> 
> I confirmed that compile and install was successful.
> But, I don't have the nvidia card.
> 
> Would you try this patch ?
> 

Yes i did.

Patch and qmerge applyed successfully but still no luck. I try to compile from original ebuild by hands. Create empty files when it need. Copy Linux-elf so.files with renaming when it have to be. And result is only noise display without responsible image.

> Note,
> I have not test with USE=tools.
> can not compile gtk+-2 on Gentoo/FreeBSD. I got Segmentation fault...

glib2 library need to be patched (because freebsd has no some posix thread functions and modes)

diff -urNp a/glib/gthread-posix.c b/glib/gthread-posix.c
--- a/glib/gthread-posix.c	2015-08-30 14:17:42.561235000 +0600
+++ b/glib/gthread-posix.c	2015-08-30 20:33:00.452642000 +0600
@@ -98,7 +98,7 @@ g_mutex_impl_new (void)
   if G_UNLIKELY (mutex == NULL)
     g_thread_abort (errno, "malloc");
 
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) && !defined(__FreeBSD__)
   pthread_mutexattr_init (&attr);
   pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
   pattr = &attr;
@@ -107,7 +107,7 @@ g_mutex_impl_new (void)
   if G_UNLIKELY ((status = pthread_mutex_init (mutex, pattr)) != 0)
     g_thread_abort (status, "pthread_mutex_init");
 
-#ifdef PTHREAD_ADAPTIVE_MUTEX_NP
+#if defined(PTHREAD_ADAPTIVE_MUTEX_NP) && !defined(__FreeBSD__)
   pthread_mutexattr_destroy (&attr);
 #endif
 
@@ -654,7 +654,8 @@ g_cond_impl_new (void)
 #ifdef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP
 #elif defined (HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined (CLOCK_MONOTONIC)
   if G_UNLIKELY ((status = pthread_condattr_setclock (&attr, CLOCK_MONOTONIC)) != 0)
-    g_thread_abort (status, "pthread_condattr_setclock");
+    if G_UNLIKELY ((status = pthread_condattr_setclock (&attr, CLOCK_VIRTUAL)) != 0)
+      pthread_condattr_setclock (&attr, 0);      
 #else
 #error Cannot support GCond on your platform.
 #endif


I have less segfaults with this patch both gtk2 and gtk3 utils
Comment 3 Enzo ME 2016-11-07 14:28:41 UTC
Created attachment 452620 [details]
Xorg logfile

Logfile after applying patch and kldloading new version of nvidia.ko
Comment 4 Enzo ME 2016-11-08 06:25:13 UTC
Additionally kernel module nvidia-modeset.ko compiles successfully but it does not load because it have undeclared symbol that is present in nvidia.ko module.
Comment 5 Yuta SATOH 2016-11-10 10:05:47 UTC
Created attachment 452882 [details, diff]
patch for nvidia-drivers-375.10-r1.ebuild

Thanks for testing.
I confirmed the issue that nvidia-modeset.ko does not work properly.

# kldload nvidia-modeset
kldload: an error occurred while loading the module. Please check dmesg(8) for more details.
# dmesg | tail -n 2
link_elf_obj: symbol nvidia_get_rm_ops undefined
linker_load_file: Unsupported file type


Cause investigation)
# USE=-tools ebuild nvidia-drivers-375.10-r1.ebuild clean compile
# nm /var/tmp/portage/x11-drivers/nvidia-drivers-375.10-r1/work/NVIDIA-FreeBSD-x86_64-375.10/src/nvidia/nvidia.ko | grep nvidia_get_
00000000005c29fc t nvidia_get_card_info
00000000005c4db6 t nvidia_get_rm_ops
# USE=-tools ebuild nvidia-drivers-375.10-r1.ebuild merge
# nm /boot/modules/nvidia.ko | grep nvidia_get_
00000000005c29fc t nvidia_get_card_info

hmm... nvidia_get_rm_ops is removed when merged.
I added kernel_FreeBSD? ( strip ) to RESTRICT.


New patch results,

# nm /boot/modules/nvidia.ko | grep nvidia_get_
00000000005c29fc t nvidia_get_card_info
00000000005c4db6 t nvidia_get_rm_ops
# (Don't forget to unload the old nvidia module.)
# kldunload nvidia
# kldunload nvidia-modeset
# kldload nvidia-modeset
# dmesg | tail -n 1
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  375.10  Fri Oct 14 09:32:07 PDT 2016
Comment 6 Yuta SATOH 2016-11-10 10:08:05 UTC
(In reply to Enzo ME from comment #3)
> Created attachment 452620 [details]
> Xorg logfile
> 
> Logfile after applying patch and kldloading new version of nvidia.ko

I found the following line from your log.

	(II) NVIDIA(0): Validated MetaModes:
	(II) NVIDIA(0):     "NULL"

Please use nvidia-modeset instead of nvidia.
Details please see
https://github.com/freebsd/freebsd-ports/blob/master/x11/nvidia-driver/files/pkg-message.in#L34
Comment 7 Enzo ME 2016-11-10 14:20:58 UTC
Aaaaand oooopen! (c)(CL4P-TP)
Many thanks! It works for me! It seems problem was solved. I hope that maintainers will apply changes to portage tree in future.
Comment 8 Yuta SATOH 2016-11-11 11:17:03 UTC
(In reply to Enzo ME from comment #7)
> Aaaaand oooopen! (c)(CL4P-TP)
> Many thanks! It works for me! It seems problem was solved. I hope that
> maintainers will apply changes to portage tree in future.

Thank you for checking.
please don't close bug until the maintainer merges patch into main tree...

@maintainer,
Would you review the patch ?
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-10-11 17:37:30 UTC
*-fbsd is gone.