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

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

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


From: Matt Birkholz
Subject: Re: [MIT-Scheme-devel] Linking with the new FFI on Mac OS
Date: Wed, 27 Feb 2019 21:21:02 -0700
User-agent: Evolution 3.30.1-1build1

arg_long etc are found in the Scheme executable.  I can't macOS, but it
seems to me that you need to tell your linker more, namely "don't sweat
the undefined."  My Ubuntu link lines chant all kinda mumbo-jumbo like 
"-Wl,-soname -Wl,ffi-test-shim.so".

On Thu, 2019-02-28 at 04:01 +0000, Joel T Gustafson wrote:
> 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
> 
> _______________________________________________
> MIT-Scheme-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/mit-scheme-devel




reply via email to

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