Marc:
I have the following code that used to work in an older beta of gambit:
(define-macro (setup-loader) (set! ##ld-cmd "/usr/ccs/bin/ld -G %s.o libfftw.so.2.0.5 -o %s") '(begin))
(setup-loader)
(c-declare " #include "fftw.h"
fftwnd_plan p;
")
(define fftw2d_create_plan_backward (c-lambda () void "p = fftw2d_create_plan(64, 64, FFTW_BACKWARD, FFTW_ESTIMATE | FFTW_IN_PLACE); "))
(define fftw2d_create_plan_forward (c-lambda () void "p = fftw2d_create_plan(64, 64, FFTW_FORWARD, FFTW_ESTIMATE | FFTW_IN_PLACE); "))
;;; Both forward and backward ffts, depends on which way the plan was created.
(define fftwc (c-lambda (scheme-object) void " int j; double *fp = (double *)((___WORD)___BODY_AS (___arg1,___tSUBTYPED)); fftwnd_one(p, (fftw_complex *)(fp), NULL); for (j = 0; j < 64 * 64 * 2; j++) fp[j] *= .015625; "))
Now I get
Gambit Version 4.0 beta 13
(compile-file "all.scm")
*** ERROR IN #<procedure #2> -- Unbound variable: ##ld-cmd
and there's no ##ld-cmd in gambc40b14, either.
How can I set things up to link all dynamically loaded files against libfftw.so.2.0.5?
Brad
Afficher les réponses par date
Marc:
The following command line seems to work to do what I want to do. Perhaps you should put something like this in the documentation.
This is with gcc.
Brad
peano-115% gsc -dynamic -ld-options "-Wl,-R/export/users/lucier/lang/ scheme/Arrays/srfi/fMRI-test/ /export/users/lucier/lang/scheme/Arrays/ srfi/fMRI-test/libfftw.so.2" all.scm
On Aug 25, 2005, at 10:42 PM, Bradley Lucier wrote:
Marc:
The following command line seems to work to do what I want to do. Perhaps you should put something like this in the documentation.
This is with gcc.
Brad
peano-115% gsc -dynamic -ld-options "-Wl,-R/export/users/lucier/ lang/scheme/Arrays/srfi/fMRI-test/ /export/users/lucier/lang/scheme/ Arrays/srfi/fMRI-test/libfftw.so.2" all.scm
Well, that works on Linux, does anyone know what will work on MacOS X 10.4.2? I tried the following, but no luck:
[Bradley-Luciers-Computer:~/Desktop/srfi/fMRI] lucier% gsc -dynamic -ld-options "-L/Users/lucier/Desktop/srfi/fMRI libfftw.dylib" all.scm [Bradley-Luciers-Computer:~/Desktop/srfi/fMRI] lucier% gsc Gambit Version 4.0 beta 14
(load "all")
dyld: NSLinkModule() error dyld: Library not loaded: /usr/local/lib/libfftw.2.dylib Referenced from: /Users/lucier/Desktop/srfi/fMRI/all.o2 Reason: image not found Trace/BPT trap [Bradley-Luciers-Computer:~/Desktop/srfi/fMRI] lucier% gsc -dynamic -ld-options "-L/Users/lucier/Desktop/srfi/fMRI -R/Users/lucier/ Desktop/srfi/fMRI libfftw.dylib" all.scm powerpc-apple-darwin8-gcc-4.0.0: unrecognized option '-R/Users/ lucier/Desktop/srfi/fMRI'
At 14:46 Uhr -0500 25.08.2005, Bradley Lucier wrote:
(compile-file "all.scm")
*** ERROR IN #<procedure #2> -- Unbound variable: ##ld-cmd
and there's no ##ld-cmd in gambc40b14, either.
How can I set things up to link all dynamically loaded files against libfftw.so.2.0.5?
I run c#cf and the gsc-cc-o command directly to be able to specify linking options. Below is the my-compile-file function from chjmodule.scm.
Christian.
(define c-cf (defined-and-true 'c#cf))
(define (my-compile-file sourcefilepath opts cfilepath objectfilepath #!key cc-opts ld-opts) (if (not c-cf) (error "the gambit binary you're running doesn't have compilation ability (c#cf is missing)")) (and (c-cf sourcefilepath #f opts cfilepath (path-strip-directory objectfilepath)) (let* ((gambcdir (path-expand "~~")) (gambcdir-bin (parameterize ((current-directory (path-expand "bin" gambcdir))) (current-directory))) (exit-status (shell-command (string-append gambcdir-bin "gsc-cc-o " gambcdir " " objectfilepath " " cfilepath " " (or cc-opts "") " " (or ld-opts ""))))) (if (= exit-status 0) #t (error "my-compile-file" 'compile-file (list sourcefilepath opts cfilepath objectfilepath cc-opts ld-opts))))))