Building Blender for other machines

I’ve just compiled my first Blender build (4.1) on my backup PC (Win 11 / 1st time ever compiling on Win). CUDA toolkit and Optix 8 SDK is installed. Afterwards CUDA was available on backup computer with a GTX750Ti in it.

Then I copied this build to my main PC with a RTX3060Ti on it. To my surprise neither CUDA nor Optix is available. Instead I get this message:

Why is this? Can I compile only builds for the current hardware? How can I fix this?

Did you follow these build instructions? Which options did you enable?
https://wiki.blender.org/wiki/Building_Blender/GPU_Binaries#NVIDIA

1 Like

I think so. In CMakeCache.txt both is ON by default. I never used CMake before and don’t know how to change any configuration with. I just copied CMake and added it’s location to PATH.

On backup PC CUDA was available, but after installing CUDA toolkit.

I just compiled by typing “make”. At the moment I compile a second time with “make release” which includes GPU binaries. I guess this maybe was the fault. Will see.

Still compiling kernels…

I found this line in CMakeCache.txt: CYCLES_CUDA_BINARIES_ARCH:STRING=sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75;sm_86;sm_89;compute_75

I think I only need sm_30 and sm_86. Next time I exclude the others.

The line: WITH_CYCLES_CUDA_BINARIES:BOOL=OFF probably is overwritten by “make release” I hope. Otherwise the second try will fail, too.

But I think I’am on a good way. I don’t want to waste your time, brecht. :wink:

I now have CUDA on both machines, but the wrong kernel image on main pc. Optix is still missing. I’ll dive into this later. As I said, it is my first try.

I tried to compile Blender all night, this time with CUDA and Optix. I added two variables to the CMakeCache.txt. Both are path to Optix (/include + /SDK).

A ‘make nobuild’ says, CUDA and Optix were found and Blender will compile with. Then I tried ‘make release’ and the process aborts after a while with these bunch of errors:

Can someone help me to fix that?! Cannot find something helpful on the internet. What am I doing wrong?

It might be easier to hop on https://blender.chat in the #blender-builds channel. People might help you there.

1 Like

Just for reference, here are the basic steps I use to get a version of Blender built with CUDA and OptiX.

Although typically when I’m in cmake-gui, I also remove many of the CYCLES_CUDA_BINARIES_ARCH because I don’t need them for my computer. (Each number (E.G. sm_89) is a different Nvidia GPU architecture or architecture revision. For example, sm_89 is Ada Lovelace (RTX 40 series), if you don’t have a RTX 40 series GPU, then you don’t need sm_89).

I believe a change was made to Blender which resulting in these errors on Windows. To fix it you would either need to adjust the code, wait until someone else fixes it, or go to an older version of the Blender source code that didn’t have this issue.

But just like @filedescriptor said, if you’re experiencing issues with building Blender, it’s a good idea to go to Blender Chat and ask for help on the blender-builds channel.

2 Likes

It’s fine to ask here as well, help with build issues is what this forum category is for. Just depends if you prefer chat or a forum.

The build issue with ssize_t was fixed so updating to latest main should resolve it.

1 Like

Third night and still have no working build.

prefs

Compiling ends with no errors, but CUDA and Optix are still not usable. It is all updated and fresh installed, including Windows 11. I added Optix location to PATH, so I dont have to configure CMake all the time.

@Alaska Your post was helpful in learning to configure CMake. Thank you for that.

@brecht I’ll stay here for now. I am definately team forums. :laughing:

I can be hard to identify the cause for the CUDA issue without access to your computer, and I’ve personally never had the error message you had so I’m not sure how to fix it. Besides the error message isn’t particularly useful. “Invalid kernel image”, but what’s invalid about it? It’s corrupt? Something about it requires a feature that you don’t have in your GPU drivers? It’s missing? I don’t know.

So I’ll go over a list of things that might be useful in identifying what the issue is.

Just so things are clear, it seems you’re compiling Blender on a second computer, then transferring it to your main computer. Your main computer has a RTX 3060 Ti graphics cards.


Confirming CUDA and OptiX work on your main computer:

For this, just download an experimental build of Blender and see if CUDA and OptiX works. Blender Builds - blender.org

If it works, then we know the issue is likely your build of Blender. If it doesn’t work, then a bunch of things could be causing it and the error with likely help.

If it doesn’t work, here’s some things to check:

  1. Are your GPU drivers up to date?
  2. Does turning your computer off and on again help?
  3. Have you run out of disk space?
  4. Is there something else going on? Corrupt storage? Memory errors? Bad power supply? etc. This is both for your main computer you’re running Blender on, and the second computer you’re compiling Blender on.

Figuring out why your build doesn’t work:

Once we know that CUDA and OptiX doesn’t work properly with your builds, but works with the builds from the Blender foundation, we need to work on figuring out what’s causing that issue.

The main culprits are:

  1. Errors during building (which you claim there are none)
  2. Incompatible CUDA, OptiX, compiler versions.
  3. Something else.

Let’s start with something simple:

  • Only compile the CUDA kernel you need (Speeds up compilation, and reduces memory usage which could solve some obscure errors).
    • You have a RTX 3060 Ti, that means you only need the sm_86 kernel. So run cmake-gui /path/to/cmake/file , search for CYCLES_CUDA_BINARIES_ARCH and change it to sm_86. Select Generate, wait until it finishes, then run make and test. Note: You are ONLY compiling the sm_86 kernel, this means CUDA and OptiX will only work on sm_86 compatible devices like the RTX 30 series GPUs like your RTX 3060 Ti.

If the option listed above doesn’t help (which it likely won’t), then you need to start looking into other potential causes for the issue.

  • Visual Studio Version:
    • The Blender build bot uses Visual Studio 16.X. Maybe downgrading to that could fix your issues (I know downgrading to Visual Studio 16.X fixed some issues in other areas of Blender for me).
      • The easiest way to do this is uninstall Visual Studio, reboot your computer, install Visual Studio 16.11 (Download the community version from here and install the “Desktop Developer with C++” work load as suggested here), then reboot your computer. After that, delete your old build folder (the one named like this build_windows_x64_vc16_Release) and go through the steps of building again. make nobuild, cmake-gui, make, etc. At the top of make nobuild it should say Compiler Detection successful, detected VS2019
  • CUDA Version
    • You are using some version of CUDA 12. Blender should support building with it, but maybe it doesn’t. So you could try downgrading to a version known to work with Blender. CUDA 11.4.1 and 12.1.1 are the two modern versions of CUDA used by Blender. So maybe try uninstalling CUDA, reboot your computer, then try installing one of those versions from here, then reboot again. Once you’ve done that, delete your build folder (the one named like this build_windows_x64_vc16_Release) and go through the steps of building again. make nobuild, cmake-gui, make
  • OptiX Version
    • Similar to CUDA. You are using OptiX 8.X. It should work with Blender, but maybe it doesn’t. You could try downgrading to a older version known to work. So… uninstall OptiX, reboot, download and install 7.3.0 (known to work) from here, then reboot again. Once you’ve done that, delete your build folder (the one named like this build_windows_x64_vc16_Release) and go through the steps of building again. make nobuild, cmake-gui, make.

Hopefully this will solve your issue. But if it doesn’t then we’ll need to do more trouble shooting.

2 Likes

Maybe CUDA Toolkit is the problem. I installed 12.2. At the moment the computer is compiling. If that doesn’t work, I’ll try an earlier version, as recommended. I don’t think Optix 8 is a problem, because CUDA isn’t working as well. Will see. Thank you so far. :slight_smile:

Reminder that cmake is extremely aggressive about caching the state of the universe between runs. If you’re changing the universe (different paths, different compilers, different CUDAs, different cmake options) it’s always best to completely removing the previous build directory just in case.

Your screenshot above is weird. It’s says it failed to load the CUDA kernel from a path inside Program Files. Did you put your custom build there? Beyond that I’m out of ideas. As long as you’re running the Install target, all required files will be in place, and blender will be ready to run right inside that build directory too.

The build now runs perfectly on backup pc, where the build was made, on both CUDA and Optix.

I installed newest NVIDIA drivers on main pc, but that hasn’t solved the problem. Blender could not find compatible GPU for Cycles. Something is wrong with the build. Thereis no kernel lib directory in addons/cycles, as I would expect.

I think, I have to try CUDA Toolkit 11.4.3. I will install it tomorrow, because I now need a break.

You’re right. When I create a custom build with ‘make’, thereis no kernel lib in addons/cycles. A ‘make release’ creates all kernels, which needs a lot of time. But release builds aren’t work as well on main pc.

Thereis something else wrong. Probably an error on configuring CMake. I usually delete all files before a new try. But I am not really sure, all sources are included. To me building Blender on my own is all new.

Success!

I wanted to gave CUDA 12.2 Toolkit a last try. Documentation says, ‘make’ builds never have binaries in it. I think you cannot change that in configuration. At least on my system it seems it is not possible.

But in blender/CMakeLists.txt you can change, what binaries are included in releases. I simply changed one line to ‘sm_30 sm_86’. Then I build Blender with ‘make release’. With needed binaries included, the build works on both GPUs.

I don’t know, why earlier build releases with all binaries in it, doesn’t work on both machines. Without changing this line in CMakeLists.txt thereis no difference, I guess.

I now try to build a 4.0 version, maybe 3.65 as well. Will see, if that works the same.

Thanks to all for now!