abysssol / ollama-flake

A nix flake for https://github.com/ollama/ollama
Creative Commons Zero v1.0 Universal
48 stars 11 forks source link

CUDA unsupported GNU version! gcc versions later than 11 are not supported! #3

Closed lfdominguez closed 9 months ago

lfdominguez commented 9 months ago

Hi, I'm trying to compila the gpu version, but fail with this:

 #error -- unsupported GNU version! gcc versions later than 11 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

I have an NVidia 3060 Laptop.

abysssol commented 9 months ago

It sounds to me like you are using ollama-flake as a flake input and overriding nixpkgs with an older version than what's expected. Like this:

ollama = {
  url = "github:abysssol/ollama-flake";
  inputs.nixpkgs.follows = "nixpkgs";
};

If that is the case, you have a few options:

  1. update your version of nixpkgs
    nix flake lock --update-input nixpkgs
  2. remove the input override, letting ollama-flake use it's locked version of nixpkgs
    ollama = {
     url = "github:abysssol/ollama-flake";
     #inputs.nixpkgs.follows = "nixpkgs"; # remove this part
    };
  3. in the newest flake version (tag 1.3.0), you can override inputs per package
    nix flake lock --update-input ollama
    # at use of ollama-flake
    (ollama.packages.${system}.cuda.override { cudaGcc = pkgs.gcc11; }) # use older version of gcc

Hopefully this is helpful and one of these options is relevant, but if not just leave some more details/context and I'll see how I can help.

lfdominguez commented 9 months ago

Well that's the problem, inputs.nixpkgs.follows = "nixpkgs"; but I'm using a more recent nixpkgs, that's why ollama fail to build, I'm using gcc > 11 on my nixpkgs... Thanks

abysssol commented 9 months ago

I believe that you are using an older version of nixpkgs because it contains a version of nvcc (nvidia cuda compiler) which requires a version of gcc <= 11. On the latest nixpkgs-unstable, nvcc works with gcc12, though not gcc13 (I had to override it to gcc12 in the flake). So, it seems that your version of nvcc hasn't been updated to support gcc12, which implies an older nvcc and nixpkgs.

lfdominguez commented 9 months ago

Ahhh you mean nixpkgs unstable... I understand now, nop I'm on stable branch only hehehe thanks