4 ms·
The project compiles LISP to C (with Haskell code-base) and relies on a C compiler to generate executables. This means you will have to get your C dependencies
by heinrichhartman 4y ago
The project compiles LISP to C (with Haskell code-base) and relies on a C compiler to generate executables. This means you will have to get your C dependencies in-place to work with carp.
I was trying this from `nix-shell -p carp` and immediately ran into issue with this when building the hello world example from the README. (Package sdl2 was not found).
Not sure how to fix this just adding `- p SDL` to the nix-shell prompt does not help, as the invoked compiler does not know where to look.
Any recommendations here? I want to avoid using a global clang/gcc installation for various reasons. Is running this under `nix` a good idea? Should I move this into a container?
- tazjin 4y agoYou might have to add `-p pkg-config` (important: in the same invocation!), that may be the lookup mechanism they use.
- xcdzvyn 4y agoSounds like a bug with the Nix package, it should be bundling SDL2 as a buildInput if Carp depends on it. I'd open a issue at nixos/nixpkgs. As the other comment mentions, installing pkg-config and sdl2 alongside carp might work, but I suspect Nix is smart enough to properly isolate derivatives such that it wont.
- tazjin 4y ago> I suspect Nix is smart enough to properly isolate derivatives That's not really relevant here, as carp itself seems to basically do code-gen and then compile stuff on its own (outside of any Nix build), so the environment in which you run carp must be set up such that the compiler and linker running in it can discover the needed libraries. Very often the mechanism used for that is pkg-config. If you wanted a more "Nixy" way to do this, you could write a `buildCarp` suite of functions in Nix that correctly sets all this up inside of a derivation build and takes the Carp code you're compiling as an input, yielding the compiled one as a Nix store path. For just playing around, it seems more reasonable to just add the needed dependencies to the runtime environment of carp.
- shric 4y agoWhy does a hello world need SDL?
- fbn79 4y agoNot needed. I think the example use SDL because the language was born in games dev context.