Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dlib Build Issue: Doesn't actually build with cuda + others #279924

Closed
RobbieBuxton opened this issue Jan 9, 2024 · 0 comments · Fixed by #279927
Closed

Dlib Build Issue: Doesn't actually build with cuda + others #279924

RobbieBuxton opened this issue Jan 9, 2024 · 0 comments · Fixed by #279927

Comments

@RobbieBuxton
Copy link
Contributor

RobbieBuxton commented Jan 9, 2024

Describe the bug

Not building with CUDA

When you set cudaSupport = True, although it sets the CMAKE flag correctly the resulting package isn't actually built correctly as cmake can't find cuda so it unsets the flag. This is due to the incorrect usage of pkgs.stdenv.mkDerivation instead of pkgs.cudaPackages.backendStdenv.mkDerivation when building the cuda related packages. The correct usage can be seen in the OpenCV package. It also tries to build with CUDA by default which is wrong.

dlib takes fftw as a build input

Dlib hasn't supported fftw since 2015 however there are leftover references to it in cmake which might lead people to think it does support fftw. fftw should be removed.

Taking in openblas rather than blas and adding lapack

As mentioned in this pr it makes more sense to have blas as an input into dlib rather that openblas so that people can override it with other BLAS implementations e.g mkl more easily if they want to. The package was also missing lapack which should be added.

Steps To Reproduce

Steps to reproduce the behavior:
Build the package, it tries to build with CUDA by default.

I made an example repo with a fairly simple nix flake that let's you switch between my patch and the original package.

Fix

I have created a PR which fixes these issues.

Expected behavior

For it to build with CUDA.

Screenshots

How CMAKE fails
Screenshot_20240109_230744

For this simple c code

#include <iostream>
#include <opencv2/core.hpp>
#include <dlib/dnn.h>

int main()
{
    #ifdef DLIB_USE_CUDA
        std::cout << "Dlib is compiled with CUDA support." << std::endl;
    #else
        std::cout << "Dlib is not compiled with CUDA support." << std::endl;
    #endif

    #ifdef DLIB_USE_BLAS
        std::cout << "Dlib is compiled with BLAS support." << std::endl;
    #else
        std::cout << "Dlib is not compiled with BLAS support." << std::endl;
    #endif

    #ifdef DLIB_USE_LAPACK
        std::cout << "Dlib is compiled with LAPACK support." << std::endl;
    #else
        std::cout << "Dlib is not compiled with LAPACK support." << std::endl;
    #endif
    
    return 0;
}

switching from my fix to the original bugged package on 23.11 before openblas was added.

Screenshot_20240109_231202

Notify maintainers

@christopherpoole

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[robbieb@nixos:~/Random/dlib-nixpkgs-test]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.69, NixOS, 23.11 (Tapir), 23.11.2451.2d2ea8eab9e4`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(robbieb): `""`
 - channels(root): `"nixos-23.11, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a 👍 reaction to issues you find important.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants