How to use the POSIX package of Guile 2.2?

Context:

I am currently coding the generate-ninja-build.scm script in git commit cb7530e3ff10 of my GPLv3+ project bismon (funded by H2020 research projects). This is contractually some Linux free software project supposed to run on Debian.

That script should become an improvement over the existing shell script bismon/generate-ninja-builder.sh which generates some build.ninja file for the ninja tool (some build automation one).

Question:

The current generate-ninja-build.scm has just (outside of copyright notice comment) :

 (use-modules
  ;; see https://www.gnu.org/software/guile/manual/html_node/Modules.html
   (ice-9 posix)  ;;;; problematic line, but why ?
   (ice-9 readline)
   (ice-9 format)
   (ice-9 pretty-print)
   )

 ;;;;;;;;;;;;;;;; constants
 (define bm-packages '("glib-2.0" "jansson" "gtk+-3.0"))
 (define bm-gcc "gcc")

but when I run it as ./generate-ninja-build.scm on my Debian/Sid, whose guile --version gives

guile (GNU Guile) 2.2.4
Packaged by Debian (2.2.4-deb+1-3)

I am getting:

rimski.x86_64 ~/bismon 8:17 .0 % ./generate-ninja-build.scm 
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/basile/bismon/./generate-ninja-build.scm
;;; WARNING: compilation of /home/basile/bismon/generate-ninja-build.scm failed:
;;; no code for module (ice-9 posix)
Backtrace:
           9 (primitive-load "/home/basile/bismon/./generate-ninja-b…")
In ice-9/eval.scm:
   721:20  8 (primitive-eval (use-modules (ice-9 posix) (ice-9 #) # …))
In ice-9/psyntax.scm:
  1235:36  7 (expand-top-sequence ((use-modules (ice-9 posix) (…) …)) …)
  1182:24  6 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)
   285:10  5 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) …)
In ice-9/boot-9.scm:
  3377:20  4 (process-use-modules _)
   222:17  3 (map1 (((ice-9 posix)) ((ice-9 readline)) ((ice-9 #)) #))
  3378:31  2 (_ ((ice-9 posix)))
   2803:6  1 (resolve-interface _ #:select _ #:hide _ #:prefix _ # _ …)
In unknown file:
           0 (scm-error misc-error #f "~A ~S" ("no code for modu…" …) …)

ERROR: In procedure scm-error:
no code for module (ice-9 posix)

however the output of locate ice-9/posix includes:

/usr/lib/x86_64-linux-gnu/guile/2.0/ccache/ice-9/posix.go
/usr/lib/x86_64-linux-gnu/guile/2.2/ccache/ice-9/posix.go
/usr/share/guile/2.0/ice-9/posix.scm
/usr/share/guile/2.2/ice-9/posix.scm

So I was expecting the (ice-9 posix) line to work.
If I comment that line, everything works as I want.

My ~/.guile just has:

;; file ~/.guile
(use-modules 
  (ice-9 readline)
  (ice-9 format)
  (ice-9 pretty-print))

(activate-readline)

and my interactive guile works like a charm with the expected fancy GNU readline and autocompletion interface.

What am I doing wrong?

Upvotes: 0

Views: 327

Answers (2)

sudo apt install guile-2.2-dev guile-2.0-dev guile-1.8-dev

Consider use Guix instead Debian. All develop dependencies is install by default in replace of Python. http://guix.gnu.org/

Upvotes: 2

Shawn
Shawn

Reputation: 52354

I couldn't find any mention of a (ice-9 posix) module in the guile 2.2 documentation, and while the appropriate file exists in the source tree, the modules/ice-9 directory README says

The non-module files are:

boot-9.scm -- loaded on guile startup

...

posix.scm -- loaded by boot-9.scm

You can't load it because it's not a module file intended to be loaded by user code. Same thing applies at least as far back as guile 1.8, so if you found some documentation or tutorial somewhere including an attempt to load a module by that name, it's simply wrong.

Upvotes: 1

Related Questions