[Vm-dev] ffi-test-main.c fails on FreeBSD

Gary Dunn osp at aloha.com
Thu Nov 19 09:47:51 UTC 2009

In conjunction with getting Open Cobalt running on FreeBSD I have been
looking into the problems with SqueakFFIPrims on FreeBSD and have
reached a point that is beyond my understanding. I am not sure if the
fix should come from the VM side or the FreeBSD port maintainer.

I needed to get source code back into the ports tree so I did a make
in /usr/ports/lang/squeak. I already had the 3.9 tarball, so that just
repopulated the source and did the initial build.

In the "files" folder I found patch files typical for a FreeBSD port.
These patch source files from a generic tarball to work with FreeBSD.
The one of interest was


which contains

--- platforms/unix/plugins/SqueakFFIPrims/ffi-config.org        Wed Apr
26 20:27:53 2006
+++ platforms/unix/plugins/SqueakFFIPrims/ffi-config    Wed Apr 26
20:29:00 2006
@@ -39,6 +39,7 @@
 case ${abi} in
     linux)             abi=sysv;;
+    freebsd*)          abi=sysv;;
     darwin*)           abi=darwin;;
     *)                 abi=libffi; lib="-lffi";;

I then had the folder


In it is a file 00README which explains how to test FFI.

It says to run ffi-test-config but I have no such file.

It says to type "make" to build a test suite but the build failed.

It says to try with make CPU=any ABI=libffi LIB=-lffi

which also failed. I traced the problem to the gcc search paths for
includes and libraries -- turns out FreeBSD only searches /usr/include
and /usr/lib when the required files are in /usr/local/include
and /usr/local/lib.

After some fiddling I finally had a "main" to test. It failed:
ffi-test-main.c failed at line 361. Here is a bit from that file, ending
with line 361:

    for (ul= 0;  ul < 15;  ++ul)
    GO(FFITypeSingleFloat, many);
    f= ffiReturnFloatValue();
    CHECK(f - ff < FLT_EPSILON);

I worked out the CHECK macro but could not find what FLT_EPSILON is. At
that point I decided to stop and come to you for help.

Where do I go from here?

Gary Dunn, Honolulu
osp at aloha.com
Sent from Slate001

More information about the Vm-dev mailing list