You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. #+TITLE: GNU Guix for developers
  2. * Table of Contents :TOC:
  3. - [[#introduction][Introduction]]
  4. - [[#installing-gnu-guix][Installing GNU Guix]]
  5. - [[#a-clean-slate][A clean slate]]
  6. - [[#troubleshooting][Troubleshooting]]
  7. - [[#ctr1o-problem][ctr1.o problem]]
  8. * Introduction
  9. This document discusses GNU Guix as a developers environment. That is,
  10. if you want to use the latest version of your developers tools in your
  11. home directory and target solutions for other users. I use GNU Guix for
  12. writing software every day - and it is great.
  13. GNU Guix has a number of things going for it:
  14. 1. GNU Guix contains the *latest versions* of tools. Because it is a rolling
  15. distribution
  16. 2. GNU Guix is *predictable*. It gives full control over the dependency graph.
  17. 3. GNU Guix is *reproducible*. If a user also deploys your software with
  18. GNU Guix you get the same environment, all the way down to glibc.
  19. 4. GNU Guix comes with great *tooling*. Because we are all developers!
  20. Most importantly Guix provides *isolation*. That means that if you use
  21. different combinations of dependencies you can rely on the system to
  22. provide them. Examples are using different versions of
  23. interpreters/compilers and different versions of libraries. Simply
  24. create a profile for each combination.
  25. * Installing GNU Guix
  26. See the online documentation and [[]].
  27. * A clean slate
  28. An environment may contain 'impurities'. PATH and LD_LIBRARY_PATH are
  29. notorious examples. Let's make sure we have a sane environment
  30. Search paths will suggest a Guix enviroment, e.g.
  31. #+begin_src sh :lang bash
  32. guix package --search-paths
  33. #+end_src sh :lang bash
  34. renders
  35. #+begin_src sh :lang bash
  36. export PATH="/home/pjotr/.guix-profile/bin:/home/pjotr/.guix-profile/sbin"
  37. export GUIX_LOCPATH="/home/pjotr/.guix-profile/lib/locale"
  38. export C_INCLUDE_PATH="/home/pjotr/.guix-profile/include"
  39. export CPLUS_INCLUDE_PATH="/home/pjotr/.guix-profile/include"
  40. export LIBRARY_PATH="/home/pjotr/.guix-profile/lib"
  41. export GUILE_LOAD_PATH="/home/pjotr/.guix-profile/share/guile/site/2.0"
  42. export GUILE_LOAD_COMPILED_PATH="/home/pjotr/.guix-profile/share/guile/site/2.0"
  43. export PYTHONPATH="/home/pjotr/.guix-profile/lib/python2.7/site-packages"
  44. export R_LIBS_SITE="/home/pjotr/.guix-profile/site-library/"
  45. export GUIX_GTK3_PATH="/home/pjotr/.guix-profile/lib/gtk-3.0"
  46. export GI_TYPELIB_PATH="/home/pjotr/.guix-profile/lib/girepository-1.0"
  47. export XDG_DATA_DIRS="/home/pjotr/.guix-profile/share"
  48. export GIO_EXTRA_MODULES="/home/pjotr/.guix-profile/lib/gio/modules"
  49. export PERL5LIB="/home/pjotr/.guix-profile/lib/perl5/site_perl"
  50. export GEM_PATH="/home/pjotr/.guix-profile/lib/ruby/gems/2.3.0"
  51. #+end_src sh :lang bash
  52. First we empty all setings
  53. #+begin_src sh :lang bash
  54. env -i /bin/bash --login --noprofile --norc
  55. #+end_src sh :lang bash
  56. and now we pick and choose what we need. It may be just enough to set
  57. the path and a HOME directory
  58. : export HOME=/home/pjotr
  59. : export PATH="$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin":$PATH
  60. the library path needs to be set toward your build target.
  61. In the case of Guix
  62. : export LIBRARY_PATH=$HOME/.guix-profile/lib
  63. In the case of your native distribution:
  64. : export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
  65. and optionally set the TERM to something useful
  66. : export TERM=screen
  67. ** Troubleshooting
  68. * ctr1.o problem
  69. When you hit an error like
  70. : /home/pjotr/.guix-profile/bin/ld: cannot find crt1.o: No such file or directory
  71. it means the installed linker can not find its files.
  72. If are creating Guix linked binaries you should set LIBRARY_PATH to
  73. the Guix profile/lib.
  74. If are creating locally linked binaries, use the local linker! Don't
  75. use the Guix ld.
  76. ld is part of the Guix binutils package.
  77. : apt-get install gcc-multilib libc-dev