How to build 3.0 Unix VM with FFI working?

Joshua Channing Gargus schwa at cc.gatech.edu
Fri Mar 23 16:36:18 UTC 2001


Hi Ned,

Does "FFITester testAll" work with the vm you built?  I'm able to
use the X11 FFI examples, but the above doensn't work for me.  The
problem seems to be that #testAll tries to find an external library
to find its functions in; however, an external SqueakFFIPrims doesn't
exist since I compiled it internally.

I'm not sure if this was clear.  What I think happens is:

1) Squeak looks for SqueakFFIPrims first externally, and then internally
   when it is not found (this is to load the capability to call external 
   libraries)
2) Squeak looks for SqueakFFIPrims again externally (this is to find the
   test* functions)

When I try the X11 example, 2) is replaced by a search for libX11.so, 
which does exist externally.

Does this sound about right?

Thanks,
Joshua

On Thu, Mar 15, 2001 at 06:29:37PM -0800, Ned Konz wrote:
> On Thursday 15 March 2001 10:51, Ned Konz wrote:
> 
> > So: can someone tell me how this is supposed to work?
> >
> > Why can't the FFI plugin be installed as easily as the StarSqueak plugin?
> 
> Why yes, I can tell myself how this is supposed to work. Here's my notes on 
> installing this (and the JPEG reader plugin by the way) successfully from a 
> 3.1 image (read the whole thing before you do it):
> 
> Make sure that you have libffi built and installed. Run ldconfig on its 
> directory.
> sudo /sbin/ldconfig -n /usr/local/lib
> 
> remove all the .c and .h files in your Squeak directory
> 
> edit Interpreter>>translate:doInlining:forBrowserPlugin:, and uncomment the 
> FFIPlugin
> 
> Interpreter translate: 'interp.c' doInlining: true.
> 
> wait a long time
> 
> move all the .c and .h files to your src/generated directory
> 
> go to your build directory
> 
> make distclean
> 
> rm */* (external plugin stuff)
> 
> ../src/unix/configure
> 
> edit sqUnixConfig.h to define HAVE_LIBFFI (not sure if this is needed)
> 
> edit Makefile to add -lffi to LIBS definition
> 
> make
> 
> oops, get undef'd symbols called by interp.c:
> 
> sqGrowMemoryBy
> sqShrinkMemoryBy
> sqMemoryExtraBytesLeft
> 
> OK, try to define these.
> 
> 		limit = sqGrowMemoryBy(memoryLimit, delta);
> should return memoryLimit
> 
> 		limit1 = sqShrinkMemoryBy(memoryLimit, delta1);
> should return memoryLimit
> 
> sqMemoryExtraBytesLeft(aBool) probably should return 0
> 
> put these defs in sqUnixConfig.h for right now (where should they go?):
> 
> #define sqGrowMemoryBy(memoryLimit, delta) 	(memoryLimit)
> #define sqShrinkMemoryBy(memoryLimit, delta1)	(memoryLimit)
> #define sqMemoryExtraBytesLeft(aBool) 0
> 
> make clean
> 
> make
> 
> sudo make install
> 
> well... let's try it out...
> 
> Hmm... Squeak starts. It loads a 107K JPEG image in 1 second vs. 107 seconds 
> before, so I guess the JPEG plugin works.
> 
> The X11 FFI plugin examples don't work because they are trying to load 'X11' 
> not 'libX11'. Converting these makes it work (apparently), but I can't see 
> anything. I think someone else mentioned this on the list.
> 
> Seems like the loader should look for libWhatever after it tries looking for 
> Whatever.
> 
> -- 
> Ned Konz
> currently: Stanwood, WA
> email:     ned at bike-nomad.com
> homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list