[gambit-list] Building and linking to a static library

Vijay Mathew vijay.the.lisper at gmail.com
Tue Mar 8 11:32:53 EST 2016


Hi Brad,

Here are the steps to reproduce the error I am getting.
This is the structure of the sample project folder:

myapp
--> core
----> a.scm
----> b.scm
--> myapp.scm

The contents of the scheme files are:

````
;; core/a.scm
(define (fa)
  "hello from a")

;; core/b.scm
(define (fb)
  "hello from b")

;; myapp.scm
(display (fa))
(newline)
(display (fb))
(newline)
````

I build an executable like this:

````
$ gsc -o myapp -exe ./core/*.scm myapp.scm
$ ./myapp

=> hello from a
=> hello from b
````

All is fine. Now I try to bundle core as a static library:

````
$ gsc -c -o ./core/b.c ./core/b.scm
$ gsc -c -o ./core/a.c ./core/a.scm
$ gsc -link -flat -o ./core/ab.c ./core/*.c
$ gsc -obj -o ./core/ab.o ./core/ab.c
$ ar -rc ab.a ./core/ab.o
````

I link the library while building the app:

````
$ gsc -o myapp -ld-options "ab.a" -exe myapp.scm
*** WARNING -- "fa" is not defined,
***            referenced in: ("/Users/me/myapp/app.c")
*** WARNING -- "fb" is not defined,
***            referenced in: ("/Users/me/myapp/app.c")
````

Now if I run `./myapp` it gives me this error:

````
$ ./myapp
*** ERROR IN | app| -- Operator is not a PROCEDURE
(#!unbound)
````

So what am I doing wrong?

Thanks,

--Vijay


On Tue, Mar 8, 2016 at 1:00 AM, Bradley Lucier <lucier at math.purdue.edu>
wrote:

> Personally, I don't have enough information yet to offer help.
>
> Perhaps you could show us a transcript of your session with the commands
> you gave and the errors you observed.
>
> Or perhaps you could try to imitate the commands in the makefiles in lib/
> gsi/ and gsc/ to make
>
> find . -name '*.a'
> ./gsi/libgambitgsi.a
> ./gsc/libgambitgsc.a
> ./lib/libgambit.a
>
> after following the build instructions on github:
>
> https://github.com/feeley/gambit
>
> Brad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20160308/ffe7126b/attachment.htm>


More information about the Gambit-list mailing list