chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Windows deployment - Numbers egg


From: Robert Herman
Subject: Re: [Chicken-users] Windows deployment - Numbers egg
Date: Sun, 4 Oct 2015 20:50:59 +0800

Matt,

I tried -deploy, -deploy -static, -static combinations.

"csc -deploy -static Pi-Ch.scm" creates a deploy directory, and the resulting executable is 1.6MB vs 77KB, but it still throws the "cannot the load the extension: numbers".

I then tried putting libchicken.dll in the deploy directory that was created, and making numbers.so a numbers.dll file, since Windows does not use .so files, only .dll. I used chicken-install -r to retrieve the numbers egg into the current directory. I then tried "csc -dll numbers.scm" and it created numbers.so. I tried putting it in the deploy directory, but no luck. I changed the .so to .dll, and again no luck.

I know why some people fall back on Java or Clojure: One example is Nightcode or Nightmod. They both have a single jar file, Nightmod or Nightcode, that is a full IDE, and can deploy to all platforms with a single click, no fuss (except you're on the JVM!). I really don't like Clojure or Java, but I can only get CHICKEN working within MinGW on Windows, and then I am still not able to deploy a working exe file to anybody else who does not have a full install of CHICKEN and MinGW. Please help me stay in the CHICKEN :) Please!

Rob

On 4 October 2015 at 13:31, Matt Welland <address@hidden> wrote:
An alternative to statically compiling is to use the deploy feature of csc to make a directory with all the items you need. When you start working with IUP I think it will be your only choice. Here is a snippet of a Makefile that I used to deploy a project to a directory on windows. You can then use Inno Setup to make an installer http://www.jrsoftware.org/isinfo.php with the directory contents or just zip it up and share.
=====================Makefile example===============
PROXY =

CHICKEN_INSTALL=chicken-install $(PROXY) -deploy -p farmsim

farmsim/farmsim : farmsim.scm boxes.scm common.scm ezxcolors.scm simevents.scm farmsim/coops.so farmsim/format.so farmsim/ezxdisp.so farmsim/ezxgui.so farmsim/qtree.so farmsim/vcd.so farmsim/geolib.so farmsim/pdf.so farmsim/regex.so
	csc -deploy farmsim.scm

farmsim/coops.so :
	$(CHICKEN_INSTALL) coops

farmsim/ezxdisp.so :
	$(CHICKEN_INSTALL) ezxdisp

farmsim/regex.so :
	$(CHICKEN_INSTALL) regex

farmsim/pdf.so :
	$(CHICKEN_INSTALL) pdf

farmsim/format.so :
	$(CHICKEN_INSTALL) format

farmsim/regex.so :
	$(CHICKEN_INSTALL) regex

farmsim/qtree.so : # $(MATTSUTILS)/qtree/qtree.scm
	$(CHICKEN_INSTALL) qtree -l $(MATTSUTILS) -transport local

farmsim/vcd.so :   # $(MATTSUTILS)/vcd/vcd.scm
	$(CHICKEN_INSTALL) vcd -l $(MATTSUTILS) -transport local

farmsim/ezxgui.so : # $(MATTSUTILS)/ezxgui/ezxgui.scm
	$(CHICKEN_INSTALL) ezxgui -l $(MATTSUTILS) -transport local

farmsim/geolib.so : # $(MATTSUTILS)/geolib/geolib.scm 
	$(CHICKEN_INSTALL) geolib -l $(MATTSUTILS) -transport local

On Sat, Oct 3, 2015 at 6:50 PM, Robert Herman <address@hidden> wrote:
I have been learning Chicken by incrementally building a program that returns a number of digits of Pi based on an already-existing algorithm that implements the Chudnovsky method. I have a command line version working, thanks to all of the help here, that writes the file as well as displays the output in the command line.
If I just: csc Pi-Ch.scm I get a 77kB exe that runs fine on my machine. In order to share it with my son, I need to statically compile it with all of its dependencies, like so:

csc -deploy -static Pi-Ch.scm

I returns an error:

Error: (require) cannot load extension: numbers
        Call history:
        Pi-Ch.scm:16: ##sys#require             <--

I found the numbers.so file, but Windows needs a dll file. I plan on downloading the numbers egg source, and seeing if there's any reason I could not compile the numbers.so file to numbers.dll. Any leads or tips?

Next step will be to create an IUP GUI for the program to complete the exercise.

Thanks!

Rob

PS: Here's the code to date:

;;; Program to use the chudnovsky formula to compute pi.
;;; Written by Bakul Shah.
;;; Changed by Bradley Lucier to use standard arithmetic operations
;;; available in Gambit Scheme and to replace (floor (/ ...)) by
;;; (quotient ...)

;; Don't try running this benchmark with Gauche, it'll consume all
;; your computer's memory!

;;;; I removed the conditional statements to make it run across different
;;;; scheme implementations.
;;;; I added the use numbers and extras at the top, and the last 8 lines
;;;; to prompt user and to display the results and write to a file.
;;;; TODO: Deploy to Windows 32-bit, and create an IUP-based GUI for it.
;;;; RPH - 4/10/2015

(use numbers extras)

(define integer-sqrt exact-integer-sqrt)

(define ch-A 13591409)
(define ch-B 545140134)
(define ch-C 640320)
(define ch-C^3 (expt 640320 3))
(define ch-D 12)

(define (ch-split a b)
  (if (= 1 (- b a))
      (let ((g (* (- (* 6 b) 5) (- (* 2 b) 1) (- (* 6 b) 1))))
        (list g
              (quotient (* ch-C^3 (expt b 3)) 24)
              (* (expt -1 b) g (+ (* b ch-B) ch-A))))
      (let* ((mid (quotient (+ a b) 2))
             (gpq1 (ch-split a mid))    ;<<<<====
             (gpq2 (ch-split mid b))    ;<<<<====
             (g1 (car gpq1)) (p1 (cadr gpq1)) (q1 (caddr gpq1))
             (g2 (car gpq2)) (p2 (cadr gpq2)) (q2 (caddr gpq2)))
        (list (* g1 g2)
              (* p1 p2)
              (+ (* q1 p2) (* q2 g1))))))

(define (pich digits)
  (let* ((num-terms (inexact->exact (floor (+ 2 (/ digits 14.181647462)))))
         (sqrt-C (integer-sqrt (* ch-C (expt 100 digits)))))
    (let* ((gpq (ch-split 0 num-terms))
           (gs (car gpq)) (p (cadr gpq)) (q (caddr gpq)))
      (quotient (* p ch-C sqrt-C) (* ch-D (+ q (* p ch-A)))))))

(print "How many digits of Pi to compute?")
(define digits (read))

(print "Here you go:")
(print (pich digits))
(define file-name "pidigits.txt")
(with-output-to-file file-name
  (lambda ()
    (format #t "~A~%" (pich digits))))

_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]