quil-lang/quilc

Build fails

yurivict opened this issue · 18 comments

Please see the log here:
quilc-failure.txt

Version: 1.26.0
FreeBSD 13.1

Please see the log here:

quilc-failure.txt

Version: 1.26.0

FreeBSD 13.1

Do you have libffi installed on your system? It (and a few other things, like libblas and liblapack) are prerequisites.

libffi, blas, and lapack are installed.

The issue here is that SBCL/CFFI are not finding it (libffi) in any standard search paths.

It is installed as /usr/local/lib/libffi.so

It is installed as /usr/local/lib/libffi.so

Are you certain that's findable by your SBCL+CFFI?

Try, as a test, pushing "/usr/local/lib/" onto cffi:*foreign-library-directories* before loading QUILC per this documentation.

I also notice that

Unable to load any of the alternatives:
("libffi.so.7" "libffi32.so.7" "libffi.so.6" "libffi32.so.6" "libffi.so.5"
"libffi32.so.5")

doesn't list a plain libffi.so, which sounds silly and wrong.

So a second thing to try is to symlink your libffi.so to libffi.so.X for a reasonable integer X.

I hope some of this advice is helpful... I don't have a non-Mac BSD system to try on.

The number is "8": /usr/local/lib/libffi.so.8

These names with numbers shouldn't be listed.

The newest CFFI has 8 listed. Here is the relevant source code. You could try vendoring CFFI to your Quicklisp local-projects directory.

You could also add to the list of complaints about CFFI not being updated with a release here. :)

Why doesn't quilc use this version?

Why doesn't quilc use this version?

This is not QUILC's decision. This is a dependency of a dependency that QUILC uses—a quasi-standard library for interacting with C libraries—and the dependency^2 is responsible for loading this library.

After the previous issue (with libffi.so) is patched there's this failure now:

===>  Building for quilc-1.26.0
gmake[1]: Entering directory '/disk-samsung/freebsd-ports/devel/quilc/work/quilc-1.26.0'
sbcl --noinform --no-userinit --no-sysinit --non-interactive --load /disk-samsung/freebsd-ports/devel/quilc/work/quicklisp/setup.lisp --eval '(push (truename ".") asdf:*central-registry*)' --eval "(push (truename \"../\") ql:*local-project-directories*)" \
	 \
	--eval "(ql:quickload '(quilc ))" \
	--eval "(ql:write-asdf-manifest-file \"system-index.txt\")"
To load "quilc":
  Load 1 ASDF system:
    quilc
; Loading "quilc"
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
.........................Heap exhausted during garbage collection: 0 bytes available, 64 requested.
 Gen  Boxed   Cons    Raw   Code  SmMix  Mixed  LgRaw LgCode  LgMix Waste%       Alloc        Trig   Dirty GCs Mem-age
  2    7734   1087   1813      0    323    645     10      0     31    0.6   379392896    10737090   11643   0  0.8073
  3    6072    962   1718      2    277    521     58      0    130    0.7   316787744     2000000    1790   0  0.0000
  4       0      0      0      0      0      0      0      0      0    0.0           0     2000000       0   0  0.0000
  5       0      0      0      0      0      0      0      0      0    0.0           0     2000000       0   0  0.0000
  6     315    122    184      2     14     11     10      0     55    3.2    22618896     2000000       9   0  0.0000
  7    7019   1055   1437      0    322    593     73      0    172    0.5   347788640     2000000   10671   0  0.0000
Tot   21140   3226   5152      4    936   1770    151      0    388    0.7  1066588176 [99.3% of 1073709056 max]
GC control variables:
   *GC-INHIBIT* = true
   *GC-PENDING* = true
   *STOP-FOR-GC-PENDING* = false
fatal error encountered in SBCL pid 47913 pthread 0x82440d000:
Heap exhausted, game over.

   0: fp=0x8273f59f0 pc=0x21cf975a SB-C::MAKE-TN-REF
   1: fp=0x8273f5a10 pc=0x21a1bd54 SB-C::REFERENCE-TN
   2: fp=0x8273f5a50 pc=0x21a49c7c SB-C::EMIT-MOVE
   3: fp=0x8273f5a90 pc=0x21c4c8b6 SB-C::MOVE-RESULTS-COERCED
   4: fp=0x8273f5ad8 pc=0x21a40438 SB-C::MOVE-LVAR-RESULT
   5: fp=0x8273f5b30 pc=0x21df554c SB-C::IR2-CONVERT-REF
   6: fp=0x8273f5b68 pc=0x21dfec23 SB-C::IR2-CONVERT-BLOCK
   7: fp=0x8273f5b90 pc=0x21dfe24b SB-C::IR2-CONVERT
   8: fp=0x8273f5bf8 pc=0x21c1c388 SB-C::%COMPILE-COMPONENT
   9: fp=0x8273f5c20 pc=0x21b39bd5 SB-C::COMPILE-COMPONENT
  10: fp=0x8273f5c58 pc=0x21d7b421 SB-C::SUB-COMPILE-TOPLEVEL-LAMBDAS
  11: fp=0x8273f5ca0 pc=0x21b3a4af SB-C::COMPILE-TOPLEVEL-LAMBDAS
  12: fp=0x8273f5ce8 pc=0x21b8263a SB-C::COMPILE-TOPLEVEL
  13: fp=0x8273f5d08 pc=0x21c1d419 SB-C::CONVERT-AND-MAYBE-COMPILE
  14: fp=0x8273f5d80 pc=0x21c1e3f0 SB-C::PROCESS-TOPLEVEL-FORM
  15: fp=0x8273f5db0 pc=0x21c1d5b8 SB-C::PROCESS-TOPLEVEL-PROGN
  16: fp=0x8273f5e28 pc=0x21c1e363 SB-C::PROCESS-TOPLEVEL-FORM
  17: fp=0x8273f5ea0 pc=0x21c1e4d8 SB-C::PROCESS-TOPLEVEL-FORM
  18: fp=0x8273f5ed0 pc=0x21c1d5b8 SB-C::PROCESS-TOPLEVEL-PROGN
  19: fp=0x8273f5f48 pc=0x21c1e363 SB-C::PROCESS-TOPLEVEL-FORM
  20: fp=0x8273f5fc0 pc=0x21c1e4d8 SB-C::PROCESS-TOPLEVEL-FORM
  21: fp=0x8273f6090 pc=0x21c20bbd (LAMBDA (SB-KERNEL::FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-C::SUB-COMPILE-FILE)
  22: fp=0x8273f6148 pc=0x21b81f17 SB-C::%DO-FORMS-FROM-INFO
  23: fp=0x8273f6208 pc=0x21c1f22a (FLET "LAMBDA0" :IN "SYS:SRC;COMPILER;MAIN.LISP")
  24: fp=0x8273f62b0 pc=0x21b81691 (FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT)
  25: fp=0x8273f6408 pc=0x21c20340 SB-C::SUB-COMPILE-FILE
  26: fp=0x8273f6540 pc=0x220e494c COMPILE-FILE
  27: fp=0x8273f65c0 pc=0x2243ef19 UIOP/UTILITY::CALL-WITH-MUFFLED-CONDITIONS
  28: fp=0x8273f65f0 pc=0x22449e76 UIOP/PATHNAME::CALL-WITH-ENOUGH-PATHNAME
  29: fp=0x8273f66e0 pc=0x22464d89 UIOP/LISP-BUILD::COMPILE-FILE*
  30: fp=0x8273f6738 pc=0x2248e6be ASDF/LISP-ACTION::PERFORM-LISP-COMPILATION
  31: fp=0x8273f6780 pc=0x224c7b32 (SB-PCL::EMF ASDF/ACTION::PERFORM)
  32: fp=0x8273f6810 pc=0x22485e02 (LAMBDA () :IN ASDF/ACTION::CALL-WHILE-VISITING-ACTION)
  33: fp=0x8273f6980 pc=0x2248cd88 (SB-PCL::FAST-METHOD ASDF/ACTION::PERFORM-WITH-RESTARTS :AROUND (T T))
  34: fp=0x8273f69c0 pc=0x2249ed65 (SB-PCL::FAST-METHOD ASDF/PLAN::PERFORM-PLAN (T))
  35: fp=0x8273f6aa0 pc=0x21b814e0 (FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT)
  36: fp=0x8273f6b10 pc=0x2249e9a9 (SB-PCL::FAST-METHOD ASDF/PLAN::PERFORM-PLAN :AROUND (T))
  37: fp=0x8273f6b70 pc=0x224a0cd7 (SB-PCL::FAST-METHOD ASDF/OPERATE::OPERATE (ASDF/OPERATION::OPERATION ASDF/COMPONENT::COMPONENT))
  38: fp=0x8273f6be0 pc=0x224c4962 (SB-PCL::EMF ASDF/OPERATE::OPERATE)
  39: fp=0x8273f6ca8 pc=0x224a03d9 (LAMBDA () :IN ASDF/OPERATE::OPERATE)
  40: fp=0x8273f6d80 pc=0x2249fc9c (SB-PCL::FAST-METHOD ASDF/OPERATE::OPERATE :AROUND (T T))
  41: fp=0x8273f6df0 pc=0x224c4962 (SB-PCL::EMF ASDF/OPERATE::OPERATE)
  42: fp=0x8273f6eb8 pc=0x224a03d9 (LAMBDA () :IN ASDF/OPERATE::OPERATE)
  43: fp=0x8273f6f90 pc=0x2249fc9c (SB-PCL::FAST-METHOD ASDF/OPERATE::OPERATE :AROUND (T T))
  44: fp=0x8273f7188 pc=0x2247ab7d ASDF/SESSION::CALL-WITH-ASDF-SESSION
  45: fp=0x8273f7250 pc=0x224a058e (LAMBDA () :IN ASDF/OPERATE::OPERATE)
  46: fp=0x8273f7440 pc=0x2247ab7d ASDF/SESSION::CALL-WITH-ASDF-SESSION
  47: fp=0x8273f7518 pc=0x2249fc9c (SB-PCL::FAST-METHOD ASDF/OPERATE::OPERATE :AROUND (T T))
  48: fp=0x8273f7560 pc=0x224a22c2 ASDF/OPERATE::LOAD-SYSTEM
  49: fp=0x8273f7580 pc=0x225542c5 QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS
  50: fp=0x8273f7790 pc=0x22554dc6 QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES
  51: fp=0x8273f77c0 pc=0x2251e774 (SB-PCL::FAST-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T))
  52: fp=0x8273f7800 pc=0x2251ec51 (SB-PCL::FAST-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL::SBCL T))
  53: fp=0x8273f7938 pc=0x22556904 (SB-PCL::FAST-METHOD QUICKLISP-CLIENT::QUICKLOAD (T))
  54: fp=0x8273f7960 pc=0x2254f716 QL-DIST::CALL-WITH-CONSISTENT-DISTS
  55: fp=0x8273f7a28 pc=0x21b4b6b7 SB-INT::SIMPLE-EVAL-IN-LEXENV
  56: fp=0x8273f7a40 pc=0x21a49e23 EVAL
  57: fp=0x8273f7bf0 pc=0x21c689df SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS
  58: fp=0x8273f7dc0 pc=0x21ba18de SB-IMPL::TOPLEVEL-INIT
  59: fp=0x8273f7e60 pc=0x21f43b19 (FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP)
  60: fp=0x8273f7f28 pc=0x21f43917 (FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-IMPL::START-LISP)
  61: fp=0x8273f7fc8 pc=0x21f436c3 SB-IMPL::%START-LISP
gmake[1]: *** [Makefile:29: system-index.txt] Error 1
gmake[1]: Leaving directory '/disk-samsung/freebsd-ports/devel/quilc/work/quilc-1.26.0'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

This patch helped:

@@ -2,13 +2,13 @@ COMMIT_HASH=$(shell git rev-parse --short HEAD)
 LISP_CACHE ?= $(HOME)/.cache/common-lisp
 RIGETTI_LISP_LIBRARY_HOME=../
 SBCL_BIN=sbcl
-SBCL=$(SBCL_BIN) --noinform --no-userinit --no-sysinit --non-interactive
+SBCL=$(SBCL_BIN) --dynamic-space-size 4096 --noinform --no-userinit --no-sysinit --non-interactive
 QUICKLISP_HOME=$(HOME)/quicklisp
 QUICKLISP_SETUP=$(QUICKLISP_HOME)/setup.lisp
 QUICKLISP=$(SBCL) --load $(QUICKLISP_HOME)/setup.lisp \

Maybe you can apply this upstream.

After this I am able to build quilc on FreeBSD.

Yep, recent SBCLs need more memory while compiling. Probably a good idea to apply that patch.

Sorry for the difficulties but I'm glad you got it to work out!

Sorry for the difficulties but I'm glad you got it to work out!

No problem!


I created the FreeBSD port for quilc:

Above I was able to build quilc-1.26.0

But the current master fails:

To load "quilc":
  Load 1 ASDF system:
    quilc
; Loading "quilc"
Unhandled ASDF/FIND-COMPONENT:MISSING-DEPENDENCY-OF-VERSION in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                                         {1002878073}>:
  Component #:MAGICL/CORE does not match version 0.10.0, required by
  #<SYSTEM "cl-quil">

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1002878073}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK Component #:MAGICL/CORE does not match version 0.10.0, required by #<SYSTEM "cl-quil"> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* Component #:MAGICL/CORE does not match version 0.10.0, required by #<SYSTEM "cl-quil">)
2: (INVOKE-DEBUGGER Component #:MAGICL/CORE does not match version 0.10.0, required by #<SYSTEM "cl-quil">)
3: (ERROR Component #:MAGICL/CORE does not match version 0.10.0, required by #<SYSTEM "cl-quil">)
4: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "quilc" :PROMPT NIL)
5: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<unused argument> #<FUNCTION (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {1007D54ECB}>) [fast-method]
6: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL:SBCL T)) #<QL-IMPL:SBCL {10073DF4A3}> #<FUNCTION (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {1007D54ECB}>) [fast-method]
7: ((:METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) (QUILC) :PROMPT NIL :SILENT NIL :VERBOSE NIL) [fast-method]
8: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<FUNCTION (LAMBDA NIL :IN QUICKLISP-CLIENT:QUICKLOAD) {1007D4BF8B}>)
9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-CLIENT:QUICKLOAD (QUOTE (QUILC))) #<NULL-LEXENV>)
10: (EVAL (QUICKLISP-CLIENT:QUICKLOAD (QUOTE (QUILC))))
11: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:LOAD . "/disk-samsung/freebsd-ports/lang/quilc/work/quicklisp/setup.lisp") (:EVAL . "(push (truename \".\") asdf:*central-registry*)") (:EVAL . "(push (truename \"../\") ql:*local-project-directories*)") (:EVAL . "(ql:quickload '(quilc ))") (:EVAL . "(ql:write-asdf-manifest-file \"system-index.txt\")") (:QUIT)))
12: (SB-IMPL::TOPLEVEL-INIT)
13: ((FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP))
14: ((FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-IMPL::START-LISP))
15: (SB-IMPL::%START-LISP)

Do you have a local copy of MAGICL?

Yes:

$ find . -iname "magicl*"
./work/quilc-1.26.0-52-g0561b21/src/magicl-constructors.lisp
./work/quicklisp/dists/quicklisp/archives/magicl-v0.9.1.tgz
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/src/magicl.lisp
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/magicl-transcendental.asd
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/magicl-tests.asd
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/magicl.asd
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/magicl-examples.asd
./work/quicklisp/dists/quicklisp/software/magicl-v0.9.1/magicl-gen.asd
./work/quicklisp/dists/quicklisp/installed/releases/magicl.txt
./work/quicklisp/dists/quicklisp/installed/systems/magicl-tests.txt
./work/quicklisp/dists/quicklisp/installed/systems/magicl.txt
./work/quicklisp/dists/quicklisp/installed/systems/magicl-examples.txt
./work/quicklisp/dists/quicklisp/installed/systems/magicl-transcendental.txt
./work/quicklisp/dists/quicklisp/installed/systems/magicl-gen.txt