milahu / nixpkgs

Nix Packages collection
MIT License
0 stars 0 forks source link

SDL2_ttf: error: SDL.h: No such file or directory #60

Open milahu opened 1 month ago

milahu commented 1 month ago
g++ -g3 -Ofast -std=c++14 -D__STDC_CONSTANT_MACROS -Wall -Wextra -Wno-deprecated -Wno-deprecated-declarations -Wdisabled-optimization -Wctor-dtor-privacy -Woverloaded-virtual -Wno-unused -Wno-missing-field-initializers -I/usr/local/include/   -c -o display.o display.cpp
In file included from display.h:3,
                 from display.cpp:1:
/nix/store/d6dwzivh7jb3ajqalpjz5xa0agl3awpw-SDL2_ttf-2.22.0/include/SDL2/SDL_ttf.h:39:10: fatal error: SDL.h: No such file or directory
   39 | #include "SDL.h"
      |          ^~~~~~~

fix:

  # fix: error: SDL.h: No such file or directory
  # https://ask.replit.com/t/sdl-in-c-has-a-problem-with-sdl-ttf-h-not-finding-sdl-h/80983/6
  CPATH = lib.makeSearchPath "include/SDL2" [ SDL2.dev ];
  CFLAGS = "-lSDL2 -lSDL2_ttf";

based on https://ask.replit.com/t/sdl-in-c-has-a-problem-with-sdl-ttf-h-not-finding-sdl-h/80983/7

related

video-compare.nix ```nix { lib , stdenv , llvmPackages , fetchFromGitHub , ffmpeg #, ffmpeg-full , SDL2 , SDL2_ttf }: stdenv.mkDerivation rec { pname = "video-compare"; version = "20240525"; src = fetchFromGitHub { owner = "pixop"; repo = "video-compare"; rev = version; hash = "sha256-OcOFwIiwShQs+wjFgAz5rPDQou/ZC+FGO3ITeuCAbgQ="; }; # fix: error: SDL.h: No such file or directory # https://ask.replit.com/t/sdl-in-c-has-a-problem-with-sdl-ttf-h-not-finding-sdl-h/80983/6 CPATH = lib.makeSearchPath "include/SDL2" [ SDL2.dev ]; CFLAGS = "-lSDL2 -lSDL2_ttf"; buildInputs = [ ffmpeg #ffmpeg-full SDL2 SDL2_ttf ]; postPatch = '' substituteInPlace makefile \ --replace-fail \ "BINDIR = /usr/local/bin/" \ "BINDIR = $out/bin/" ''; preInstall = '' mkdir -p $out/bin ''; meta = with lib; { description = "Split screen video comparison tool using FFmpeg and SDL2"; homepage = "https://github.com/pixop/video-compare"; license = licenses.gpl2Only; maintainers = with maintainers; [ ]; mainProgram = "video-compare"; platforms = platforms.all; }; } ```