Conversation
| name = "LD_LIBRARY_PATH"; | ||
| prefix = "$DEVSHELL_DIR/lib"; | ||
| name = "LIBRARY_PATH"; | ||
| value = lib.concatStringsSep ":" (map (x: "${lib.getLib x}/lib") cfg.libraries); |
There was a problem hiding this comment.
value = "$DEVSHELL_DIR/lib";
does not work here?
Also how would programs build like this find their libraries at runtime? This is especially a problem when you run outside of devshell.
There was a problem hiding this comment.
How about setting NIX_LDFLAGS="-rpath $DEVSHELL_DIR/lib";
| description = '' | ||
| Which C compiler to use. | ||
|
|
||
| For gcc, use pkgs.gcc-unwrapped. |
There was a problem hiding this comment.
Having a wrapped and a unwrapped version will behave quite differently here. i.e. the wrapped version of clang will set hardening flags that the unwrapped version of gcc won't. This might be surprising for users.
| prefix = "$DEVSHELL_DIR/include"; | ||
| }) | ||
| ++ (lib.optional cfg.pkg-config { | ||
| name = "PKG_CONFIG_PATH"; |
There was a problem hiding this comment.
You also want to set CC/CXX/LD. Otherwise many buildsystems will default to something like CC = /usr/bin/gcc
| default = [ ]; | ||
| description = "Use this when another language dependens on a dynamic library"; | ||
| example = lib.literalExample '' | ||
| [ pkgs.glibc ] |
There was a problem hiding this comment.
Does glibc in libraries have any effect when a wrapped clang is used?
|
For testing: https://github.com/Mic92/build-system-koans |
|
I'm a bit overwhelmed by the complexity of this work and don't think I can do a good job at it. If somebody wants to take over, I would be happy. |
Maybe we can talk about this next year. |
A few learning:
lduses LIBRARY_PATH, not LD_LIBRARY_PATH to find object files. Link to thelibraries directly to minimize rebuilds.
pkgs.gccdoesn't expose the gcov binary.pkgs.gccis heavily tweaked towork with the nixpkgs stdenv so use
pkgs.gcc-unwrappedinstead.Made
pkg-configoptional, it's not used all the time.