[Vm-dev] ffi-test-main.c fails on FreeBSD
Gary Dunn
osp at aloha.com
Fri Nov 27 00:44:14 UTC 2009
For those of you in or from the US, Happy Thanksgiving, and to everyone
else, all the best. In the lull between the parade and the turkey I
returned to my SqueakFFIPrims on FreeBSD mystery.
On Fri, 2009-11-20 at 09:30 -0800, Eliot Miranda wrote:
>
>
> On Fri, Nov 20, 2009 at 3:26 AM, Gary Dunn <osp at aloha.com> wrote:
>
[snip]
>
> The thing is, this does not fix the real problem. If I load my
> 3.9 image
> and install the FFI package from SqueakMap, then run the
> FFI-Tests in
> SUnit runner I get 21 run, 0 passes, 0 expected failures, 0
> failures, 21
> errors, 0 unexpected passes. When I click on a result and open
> a
> debugger I find
>
> Error: Unable to find function address
>
> invokeWithArguments: argArray
> "Manually invoke the receiver, representing an external
> function."
> <primitive: 'primitiveCalloutWithArgs'
> module:'SqueakFFIPrims'>
> ^self externalCallFailed
>
>
>
> externalCallFailed
> "Raise an error after a failed call to an external
> function"
> | errCode |
> errCode := ExternalFunction getLastError. "this allows
> us to look at
> the actual error code"
> ^self error: (ExternalFunction errorMessageFor:
> errCode).
>
>
>
> error: aString
> "Throw a generic Error exception."
>
> ^Error new signal: aString
>
>
> If the ffi-test-main.c tests are passing, why are the SUnit
> tests all
> failing? Is that 64bit thing a big deal?
>
>
> twice as big a deal as 32-bits... But seriously folks...
>
>
> Have you built a SqueakFFIPrims shared object? Have you installed it
> in the right directory with other plugins?
Not there, but as you suggest later it might be 'built-in'
The Makefile in /usr/ports/lang/squeak/work/Squeak-3.9-7/build begins
with:
MAKEFLAGS= --no-print-directory
VM_MAJOR= 3
VM_MINOR= 9
VM_RELEASE= 7
VM_VERSION= 3.9-7
SQ_MAJOR= 3
SQ_MINOR= 9a
SQ_UPDATE= 7024
SQ_VERSION= 3.9a-7024
DEVEL= @DEVEL@
host= i386-portbld-freebsd7.1
host_cpu= i386
host_vendor= portbld
host_os= freebsd7.1
topdir= /usr/ports/lang/squeak/work/Squeak-3.9-7
cfgdir= /usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/config
srcdir= /usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/src
blddir= /usr/ports/lang/squeak/work/Squeak-3.9-7/build
top_builddir= /usr/ports/lang/squeak/work/Squeak-3.9-7/build
prefix=/usr/local
exec_prefix= ${prefix}
bindir= ${exec_prefix}/bin
libdir= /usr/local/share
datadir= ${prefix}/share
mandir= /usr/local/man
imgdir= /usr/local/share/squeak
plgdir= /usr/local/share/squeak/3.9-7
docdir=/usr/local/share/doc/squeak
SHELL= /bin/sh
MKINSTALLDIRS= $(SHELL) $(cfgdir)/mkinstalldirs
INSTALL= /usr/bin/install -c -o root -g wheel
INSTALL_PROG= install -s -o root -g wheel -m 555 $(INSTALL_ARGS)
INSTALL_DATA= install -o root -g wheel -m 644 $(INSTALL_ARGS)
UNINSTALL= $(SHELL) $(cfgdir)/uninstall
AS= as
AWK= gawk
RANLIB= ranlib
LIBTOOL= $(SHELL) $(top_builddir)/libtool
NM= /usr/bin/nm -B
LN= ln
LN_S= ln -s
CC= cc
DEFS= -DHAVE_CONFIG_H
INCLUDES= -I/usr/ports/lang/squeak/work/Squeak-3.9-7/build
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/vm
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/Cross/vm
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/src/vm
CPPFLAGS= -I/usr/local/include
CFLAGS= -O2 -fno-strict-aliasing -pipe -fomit-frame-pointer
-DLSB_FIRST=1
WFLAGS= -Wall -Wno-unknown-pragmas
LDFLAGS= -L/usr/local/lib
SOFLAGS= @SOFLAGS@
LIBM_CFLAGS= -O -fomit-frame-pointer
LIBS= -lutil -lm -liconv
X_CFLAGS= -O2 -fno-strict-aliasing -pipe -fomit-frame-pointer
-DLSB_FIRST=1
X_INCLUDES= -I/usr/ports/lang/squeak/work/Squeak-3.9-7/build
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/vm
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/Cross/vm
-I/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/src/vm
-I/usr/local/include
X_LIBS= -lGL -lXext -lSM -lICE -L/usr/local/lib -lm -lX11
LIB_UUID=
FFI_DIR= /usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/plugins/SqueakFFIPrims
FFI_C= x86-sysv
FFI_S= x86-sysv-asm
FFI_O= x86-sysv$o x86-sysv-asm$o
...
I assume plgdir is the location of the plugins directory. Mine contains:
$ cd /usr/local/share/squeak/3.9-7
$ ll
total 18276
drwxr-xr-x 2 root wheel - 1024 Apr 9 2009 ./
drwxr-xr-x 3 root wheel - 512 Apr 9 2009 ../
-r-xr-xr-x 1 root wheel - 6228 Apr 9 2009 AioPlugin*
-r-xr-xr-x 1 root wheel - 51232 Apr 9 2009 B3DAcceleratorPlugin*
-r-xr-xr-x 1 root wheel - 8472 Apr 9 2009 PseudoTTYPlugin*
-r-xr-xr-x 1 root wheel - 53456 Apr 9 2009 Squeak3D*
-rw-r--r-- 1 root wheel - 17584742 Apr 9 2009 SqueakV39.sources
-r-xr-xr-x 1 root wheel - 30388 Apr 9 2009 UnixOSProcessPlugin*
-r-xr-xr-x 1 root wheel - 6420 Apr 9 2009
XDisplayControlPlugin*
-rwxr-xr-x 1 root wheel - 18200 Apr 9 2009 npsqueak.so*
-r-xr-xr-x 1 root wheel - 785476 Apr 9 2009 squeak*
-r-xr-xr-x 1 root wheel - 68824 Apr 9 2009 vm-display-X11*
-r-xr-xr-x 1 root wheel - 5128 Apr 9 2009 vm-display-null*
-r-xr-xr-x 1 root wheel - 7552 Apr 9 2009 vm-sound-NAS*
-r-xr-xr-x 1 root wheel - 19720 Apr 9 2009 vm-sound-OSS*
-r-xr-xr-x 1 root wheel - 4136 Apr 9 2009 vm-sound-null*
Nothing there about SqueakFFIPrims.
> Is the export table in SqueakFFIPrims.c correct (calls itself
> SqueakFFIPrims, includes both primitiveCallout and
> primitiveCalloutWithArgs as exports).
>
I have
/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/src/vm/intplugins/SqueakFFIPrims
which contains the single file SqueakFFIPrims.c
Near the top it has
/*** Constants ***/
#define FFIAtomicTypeMask 251658240
#define FFIAtomicTypeShift 24
#define FFIErrorAddressNotFound 13
which explains why the tests fail with error 13.
At the end of the file is the table as described by Eliot.
[snip]
>
> The second tells you that, probably the VM is finding the
> SqueakFFIPrims module but its not finding primitiveCalloutWithArgs
> within it. You can check by tracing execution through
> ioLoadExternalFunctionOfLengthFromModuleOfLength.
Never been there. I Googled and found sqUnixExternalPrims.c by Andreas
Raab,
/* Primitive entry point from the Interpreter. Answer the address of
the
* given function in the given module. Fail the primitive (setting
* successFlag to false) if the function cannot be found.
*/
int ioLoadExternalFunctionOfLengthFromModuleOfLength(
int functionNameIndex, int functionNameLength,
int moduleNameIndex, int moduleNameLength)
{
...
I have that in
/usr/ports/lang/squeak/work/Squeak-3.9-7/platforms/unix/src/vm
How do I trace execution through that? (If I am getting in over my head
please say so. I don't want to waste people's time.)
[snip]
> Note that the table shouldn't be being used because the plugin is
> typically used as an external plugin. If you're building it in then
> ignore what follows and reply saying "I want an internal plugin
> dammit!!"
>
>
> If primitiveCalloutWithArgs isn't missing then is it being exported
> form the module? Use nm on whatever SqueakFFIPrims is compiled to and
> make sure its exported.
I can't find a SqueakFFIPrims.o file. Is there some other way to use nm?
That's it for now, it's time to feast. I will keep on poking, and
certainly appreciate any and all help.
--
Gary Dunn, Honolulu
osp at aloha.com
http://openslate.net/
http://e9erust.blogspot.com/
Sent from Slate001
More information about the Vm-dev
mailing list