Closed Ciflire closed 7 months ago
You don't give enough information to reproduce the issue or even figure out what you are trying to do or how you are attempting to do it. Looks like you are missing SDL, but who knows?
https://github.com/Ciflire/nixpkgs-296692
everything is in here
the issue is obtained with the command make ta
You use gcc
in the makefile while only clangStdenv
is provided.
Im also running into the same error using this derivation:
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation {
name = "solar-sim";
src = pkgs.fetchFromGitHub {
owner = "ikalco";
repo = "solar_system_sim";
rev = "a78c873fa32c7170807f3fe27216ec1c61b021d4";
hash = "sha256-JsQwHq80b2pZ1p1vnR3zWMwAwfrgsWo1fLprlqqE0CY=";
};
buildInputs = with pkgs; [
SDL2
SDL2_ttf
];
}
Doesnt matter whether I use stdenv
or gccStdenv
. If I do not include the libraries in buildInputs
I get an error like this:
./src/scenes/scene.h:4:10: fatal error: SDL2/SDL.h: No such file or directory
4 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
But using the derivation above the error is:
/nix/store/n52asici774chzq897pzdbxfb78myf3d-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"
| ^~~~~~~
So to me it seems that the compiler has no problem finding the libraries included in the source files of the repo but somehow cannot compile SDL2_ttf
itself. What am I missing?
This isn’t an issue with SDL2_ttf in nixpkgs. The project you’re trying to build isn’t using pkg-config
to locate the SDL2_ttf headers. If it did, the path to SDL2 would also be added automatically.
You can fix this by setting env.NIX_CFLAGS_COMPILE
in your derivation to -I${lib.getDev SDL2}/include/SDL2
. You also add pkg-config as a nativeBuildInput
then either patch the Makefile
to invoke pkg-config --cflags SDL2_ttf
or update NIX_CFLAGS_COMPILE
with its output in preBuild
in your derivation.
Worked! Thanks for the info!!! :blush:
Describe the bug
Failing to compile C using SDL2_ttf because of relative path in include
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
That it compiles ?
Notify maintainers
@sternenseemann @reckenrode
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.