mit-scheme-devel
[Top][All Lists]
Advanced

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

[MIT-Scheme-devel] Linking with the new FFI on Mac OS


From: Joel T Gustafson
Subject: [MIT-Scheme-devel] Linking with the new FFI on Mac OS
Date: Thu, 28 Feb 2019 04:01:32 +0000

Hello all!

I'm trying to update some foreign Scheme libraries [1] I wrote a while ago to 
the (apparently new) FFI interface (deprecating link-shim, etc). Unfortunately, 
I'm a noob at C and don't understand linking at all. When I try to build the 
hello world example [2], the linker fails:

$ ls
Makefile        prhello.cdecl
$ export LD_LIBRARY_PATH=/usr/local/lib
$ make
echo '(generate-shim "prhello" "#include <gtk/gtk.h>")' \
        | mit-scheme --batch-mode
;Including prhello.cdecl... done
;Generating "prhello-shim.c"... done
;Generating "prhello-const.c"... done
;Dumping "prhello-types.bin"... done
cc -I/usr/local/lib/mit-scheme-x86-64 -Wall -fPIC `pkg-config --cflags 
gtk+-3.0` -o prhello-shim.o -c prhello-shim.c
cc -shared -fPIC -o prhello-shim.so prhello-shim.o `pkg-config --libs gtk+-3.0`
Undefined symbols for architecture x86_64:
  "_arg_alien_entry", referenced from:
      _Scm_g_signal_connect in prhello-shim.o
  "_arg_long", referenced from:
      _Scm_gtk_window_new in prhello-shim.o
      _Scm_g_signal_connect in prhello-shim.o
  "_arg_pointer", referenced from:
      _Scm_gtk_init in prhello-shim.o
      _Scm_gtk_label_new in prhello-shim.o
      _Scm_gtk_container_add in prhello-shim.o

... and so on for _callback_lunseal, _callback_return, ... _unspecific.

I installed GTK with `brew install gtk+3` and my scheme installation is located 
in /usr/local/lib/mit-scheme-x86-64, which I've updated AUXDIR in the Makefile 
to reflect. This is all on macOS Mojave 10.14.3; my scheme build says it's 
Release 10.1.5 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 
4.118.

Does anyone have a clue how to proceed? I'd really appreciate help 😬

[1]: https://github.com/joeltg/zmq.scm, 
https://github.com/joeltg/portaudio.scm, https://github.com/joeltg/tfhe.scm
[2]: 
https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ffi/Compiling-and-Linking.html


reply via email to

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