First I would emphasize that I am using a Linux From Scratch 7.7 Systemd (Now running kernel 3.14.39) I built these two days, so I don't want to touch anything about glibc/gcc and there is no package manager of any type.
I am now trying to setup NVIDIA driver (346.35) on my laptop (Lenovo T430s). I already got X (1.17) up and running using Intel driver only (I even have KDE Plasma 5 running). The internal display is connected to the Intel card, while the VGA is connected to NVIDIA(from information from my previous installs of Gentoo/Ubuntu/...). Now, since I need functionality of the proprietary driver, I am trying to set it up. However, currently I am getting some errors about GLX. Since it is quite hard to copy the log to another computer, I will type out info that I think is important here. I will provide the entire log if needed.
The error I am encountering is:
(EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
None of the googling results give an useful direction to LFS. I narrowed down an earlier line in log and think it might be the reason causing the error:
(II) UnloadModule: "nvidia"
(II) Unloading nvidia
I have no idea why Xorg decides to unload nvidia module, of course I did not put anything like that in my xorg.conf. Also, that error is the only line of (EE). I basically used the xorg config file from the chapter 32(or so, about XRandR) of NVIDIA readme, just renaming some things to make it clearer.
I also have tried the native libglx.so from xorg-server and the one with NVIDIA driver, but none worked.
EDIT 1
Progress: I added one missing Screen 1 "VGA" line in xorg.conf and the GLX error is gone. However, now glxinfo segfaults and xrandr --listproviders still only gives modesetting. I will post the configuration file if I get it to work.
EDIT 2
More progress: I carefully read the poorly written NVIDIA document about xorg.conf and changed more things, now NVIDI-0 is in providers. However, now I get a black screen and there is such message logged:
(EE) modeset: Failed to load module "glamoregl (something)"
EDIT 3
More progress. I posted https://devtalk.nvidia.com/default/topic/828786/linux/-possible-bug-xorg-black-screen-on-optimus-failed-to-export-gem-buffer-0x1/?offset=2#4518340 on NVIDIA forum. It is quite a pain to update two sites on a separate computer, so I cannot keep adding latest information.