libnvidia-wfb.so issue with custom install

This is long time issue.
Since I install Nvidia drivers in a custom dir, Nvidia libs wont use libnvidia-wfb.so and report errors when trying to do so.
This is fix by relinking libwfb.so to the default xorg libwfb.so, but I really want to fix this, because I don’t think Devs build a libnvidia-wfb.so for nothing.

Is the lib by default linked to /usr/xorg/modules ?
If so, isn’t that possible to get source to rebuild it or use /etc/alternative to fix the LIB_PATH or something ?

wfb is for Window Frame Buffer, I think, so this is quite important to help to fix. I’ve already notice that most of distros prebuild package are also using default libwfb.so, so probably same issue.

libnvidia-wfb.so is only needed for older Xorg server with no default wfb.so.
So using default libwfb is on purpose.

As you can see, it’s not overrided by the driver upon install if there is already one available.
http://us.download.nvidia.com/XFree86/Linux-x86/256.35/README/installedcomponents.html

I know is not overrided, only backup, then linked.
Maybe I didn’t explain myself correctly, english is not my native language.

In the default install way, nvidia-installer put libnvidia-wfb.so.1 and libnvidia-wfb.so.xxx in /usr/lib(x)/xorg/modules, then it link libnvidia-wfb.so.1 to libwfb.so and make a backup of the original one in /var/lib/nvidia. After that everything work fine.

In my case, my default install dir is opt/nvidia/, then inside there are /lib /lib64 /xorg/modules, but when libnvidia.so.1 is linked by libwfb.so >

[ 63860.887] (EE) NVIDIA(0): Need libwfb but wfbScreenInit not found
[ 63861.058] (EE) 
Fatal server error:
[ 63861.058] (EE) AddScreen/ScreenInit failed for driver 0

patatra !

My only way is to remove libwfb.so link in /opt/nvidia/xorg/modules, preserve the original in /usr/lib64/xorg/modules and launch ldconfig.

No matter libwfb.so is for older xorg server, it’s necessary for xorg server to launch.

Okkk, think I got it.

What you mean in fact, is that libwfb.so is installed on newer xorg server and libnvidia-wfb.so take only the relay if libwfb.so doesn’t exist. Am I right?
Then, if in my installation way libwfb.so is nevertheless installed it is because /xorg/modules is in a very custom dir and nvidia-installer doesn’t detect it ?

Right. libnvidia-wfb is only for very old X servers that don’t provide their own libwfb.so.

From a technical stanpoint, libnvidia-wfb.so.1 uses the FILE_TYPE_XMODULE_NEWSYM flag in the manifest file which triggers this code in nvidia-installer:

/* create any needed symbolic links */
    
    for (i = 0; i < p->num_entries; i++) {
        if (p->entries[i].caps.is_symlink) {
            /* if it's a NEWSYM and the file already exists, don't add a command
             * for it */
            if (p->entries[i].type == FILE_TYPE_XMODULE_NEWSYM) {
                struct stat buf;
                if(!stat(p->entries[i].dst, &buf) || errno != ENOENT) {
                    ui_expert(op, "Not creating a symlink from %s to %s "
                                  "because a file already exists at that path "
                                  "or the path is inaccessible.",
                                  p->entries[i].dst, p->entries[i].target);
                    continue;
                }
            }

            add_command(c, SYMLINK_CMD, p->entries[i].dst,
                        p->entries[i].target);
        }
    }

Maybe the stat() call is failing for your custom setup? If you have the xorg-server.pc file in the pkg-config search path, it should be picking up your custom module directory. Did you install it to a nonstandard location and forget to set PKG_CONFIG_PATH maybe?

No, PKG_CONFIG_PATH is correctly set. I just think now nvidia-installer need some LD_library to be set as env options. Setting X lib and else as customs options seems to change the binary behaviour when he look for X libraries.

As exemple, the libs install functions in my script look like this:
xorg_dir=/opt/nvidia/xorg

$install_bin -s -z -N --no-x-check --no-distro-scripts \
	$nocheck --no-kernel-module --skip-module-unload --no-recursion --opengl-headers \
	$add_glvnd $force_glvnd --install-compat32-libs --compat32-prefix=$croot_all \
	--x-prefix=$xorg_dir --x-module-path=$xorg_dir/modules \
	--opengl-prefix=$croot_all --opengl-libdir=$master$ELF_64 \
	--utility-prefix=$tool_dir --utility-libdir=$tool_dir/$master$ELF_64 \
	$docs $profile $SIGN_S $SElinux $temp --log-file-name=$lib_logfile

Every vars are set as appropriate, but I think now I have to set defautl X libraries path at the beginnig of the line. Alas, I don’t know how to do that.

Maybe I had to set --x-prefix to default env X prefix and --x-module-path to custom ?
If it’s only that, I’m just something like an idiot…

I partly find my problem out.
First, xorg-server.pc wasn’t in my path :3
Second, my nvidia-command line wans’t so good and after a big few test is better this way:
knowing croot_all=/opt/nvidia

$install_bin -s -z -N --no-x-check --no-distro-scripts \
	$nocheck --no-kernel-module --skip-module-unload --no-recursion --opengl-headers \
	$add_glvnd $force_glvnd --install-compat32-libs --compat32-prefix=$croot_all \
	--x-prefix=/usr --x-module-path=$croot_all \
	--opengl-prefix=$croot_all \
	--utility-prefix=$tool_dir --utility-libdir=$tool_dir/$master$ELF_64 \
	$docs $profile $SIGN_S $SElinux $temp --log-file-name=$lib_logfile

Probably the same for --utility-prefix, but I will see that with the next update.

Still left installer still want to have /usr/lib/libGL.so.1 as link. Probably a default behaviour in the binary installer, but there’s not prejudice for final install.

Oh, and an other thing good to know:
If you try to re-install libs only, the default behaviour remove kernel modules and dkms dedicated dirs in /var/lib/dkms.