Over the last month or so I've been rewriting Hugs' support for the Foreign Function Interface Extension to bring it into line with the current specification (release candidate 4): http://www.cse.unsw.edu.au/~chak/haskell/ffi/ The bulk of that code I could write and test myself (with some help from Sigbjorn Finne and Johan Nordlander) but to port it to other platforms and test it on other platforms I need some help. I have put a snapshot of the CVS repository at http://www.reid-consulting-uk.ltd.uk/downloads/hugs98-ffi-06072002-src.tar.g... I'm looking for volunteers on Unix-like platforms to download this file (832 kB) and try to configure, build and test Hugs according to the attached script. I'm hoping to get many reports of success and failure (with information about the platform and C compiler used). This should take about 5-10 minutes for people with a fast internet connection. I'm also hoping that a few Brave Souls will mail me minor fixes for problems turned up in the process and that a few Heroes will find the time and cunningness to port the ffi to whole new architectures (i.e., not x86 or PowerPC). Please mail reports to hugs-bugs as a convenient way of keeping others informed about your progress. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ ps This snapshot is for testing the ffi only. Other parts of Hugs are in a state of flux and probably work but may not. Unless you routinely track Hugs' CVS commits, I'd recommend deleting this snapshot once you've tested the ffi. Here's how to test this version of Hugs on Unix-like platforms. The instructions are in 4 stages and take the form of a series of Unix shell commands so the simplest thing to do is to cut and paste the commands for each stage into a shell window and check things work ok. # first download hugs98-ffi-06072002-src.tar.gz to /tmp cd /tmp tar zxvf hugs98-ffi-06072002-src.tar.gz echo << EOF ******************************************************************* Stage 1: Checking platform and compiler - for use in any reports of success/ failure. ******************************************************************* EOF uname -a cc -v echo << EOF On my machine this generates output like this: Linux bbb 2.4.19-pre10 #4 Mon Jun 10 22:20:35 BST 2002 i686 unknown Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease) EOF echo << EOF ******************************************************************* Stage 2: Configuring Hugs ******************************************************************* EOF cd hugs98/src/unix ./configure --prefix=/tmp/test echo << EOF The last 20 lines or so of output should contain something like this. ... checking if '/LD' builds loadable libraries... checking if '-shared' builds loadable libraries... -shared checking if '-bundle' builds loadable libraries... (cached) -shared checking if '-bundle -lc' builds loadable libraries... (cached) -shared checking if '-shared -nostdlib' builds loadable libraries... (cached) -shared checking if '-r' builds loadable libraries... (cached) -shared checking if '-rdynamic' builds loadable libraries... (cached) -shared checking if '-G' builds loadable libraries... (cached) -shared checking if '-Aa +z' builds loadable libraries... (cached) -shared ... This shows that configure successfully found a way to build dynamically loadable files using the -shared flag. We can check what effect this had on configuration by examining hugs98/src/config.h: EOF grep DLL ../config.h grep UNDERSCORE ../config.h echo << EOF On my machine this produces: #define MKDLL_CMD "gcc -shared" /* #undef LEADING_UNDERSCORE */ EOF echo << EOF ******************************************************************* Stage 3: Building Hugs ******************************************************************* EOF cd .. make install_ffi echo << EOF ******************************************************************* Stage 4: Testing Hugs ******************************************************************* EOF cd ../tests sh testScript ffi echo << EOF This should generate output like this: ---------------------------------------------------------------- -- Testing foreign function interface. ---------------------------------------------------------------- -- !!! Testing marshalling of all the basic types -- !!! Testing all the different forms of foreign import -- !!! Testing static, dynamic and wrapped import of trig function -- !!! Testing static, dynamic and wrapped import of trig function -- !!! Testing marshalling of strings -- !!! Testing marshalling of strings -- !!! Testing system calls -- !!! Testing system calls ---------------------------------------------------------------- EOF The most likely problems are during configuration since this code has only been very lightly tested. If it fails at this point, those with a little time on their hands and some mild hacking skills could try one of the following: 1) If you have GNU autoconf on your machine, and you know how to build shared libraries on your machine, try adding an appropriate test to hugs98/src/configure.in, rerun autoconf and rerun from 'configure' onwards. The part of configure.in to change is around like 599 and reads: dnl Try the MS Visual C flags HUGS_TRY_DYNLINK("/LD") dnl Try the gcc flags HUGS_TRY_DYNLINK("-shared") dnl Try the MacOS X flags HUGS_TRY_DYNLINK("-bundle") dnl Try the MacOS X flags HUGS_TRY_DYNLINK("-bundle -lc") dnl Try the gcc flags HUGS_TRY_DYNLINK("-shared -nostdlib") dnl Some other gcc flags HUGS_TRY_DYNLINK("-r") dnl Some other gcc flags HUGS_TRY_DYNLINK("-rdynamic") dnl Try the SunOS flags HUGS_TRY_DYNLINK("-G") dnl Try the HPUX flags HUGS_TRY_DYNLINK("-Aa +z") Each of the HUGS_TRY_DYNLINK lines tests whether passing those flags to the C compiler will successfully compile and link a file built with the dynamic loading/linking mechanism on that platform. 2) If you know how to build shared libraries on your machine, try modifying the settings of DLL_FLAGS and LEADING_UNDERSCORE in hugs98/src/config.h and rerun from 'make install_ffi' onwards. The other likely source of problems is in the implementation of foreign import wrappers which are currently only implemented for the x86 and PowerPC architectures. This may fail in three ways: 1) You have an x86 or PowerPC but Hugs fails to recognize this. Those with some mild porting skills could fix this by improving the current #ifdef tests in mkThunk (hugs98/src/builtin.c line 2266) which are: #if defined(__i386__) ... #elif defined(__ppc__) && defined(__GNUC__) ... #endif 2) You have some other architecture. The following is not for the timid. Those with assembly language and machine code skills could read - the implementation of mkThunk (hugs98/src/builtin.c lines 2206-2334) - the bottom half of hugs98/doc/ffi-notes.txt - the code used by GHC (fptools/ghc/rts/Adjustor.c) http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/rts/Adjustor.c?rev=1.19&content-type=text/x-cvsweb-markup and extend the implementation of mkThunk in Hugs appropriately. Although the amount of code required is quite small, the amount of trickery required is quite high so it would be best to coordinate any effort. If your platform is not a 32-bit platform, there will probably be problems with the marshalling libraries (Storable in particular) as well. The configuration script contains some tests to determine the size and alignment of various types but this information is not currently used in the compiler or in the libraries.
Here's my first report for the FFI test build. Note that this is a very old version of gcc, and I have had this 'sigset_t' problem on Solaris several times before with other software. My next report will be on the same machine with a newer version of gcc. Regards, Malcolm
uname -a
SunOS doozer 5.6 Generic_105181-15 sun4u sparc SUNW,Ultra-5_10
gcc -v
Reading specs from /sys/lib/gcc/sparc-sun-solaris2.5/2.7.2/specs gcc version 2.7.2
./configure --prefix=/tmp/test
OK.
grep DLL ../config.h grep UNDERSCORE ../config.h
OK.
cd ..; make install_ffi
gcc -c -g -O2 hugs.c machdep.c: In function `breakOn': In file included from hugs.c:137: machdep.c:1251: `sigset_t' undeclared (first use this function) machdep.c:1251: (Each undeclared identifier is reported only once machdep.c:1251: for each function it appears in.) machdep.c:1251: parse error before `mask' machdep.c:1251: `mask' undeclared (first use this function) machdep.c:1254: parse error before `mask' machdep.c: In function `ignoreBreak': machdep.c:1260: `sigset_t' undeclared (first use this function) machdep.c:1260: parse error before `mask' machdep.c:1260: `mask' undeclared (first use this function) *** Error code 1 make: Fatal error: Command failed for target `hugs.o'
Malcolm Wallace
Here's my first report for the FFI test build.
Thanks Malcolm. Your report reminds me of a recent problem in GHC (also reported by you and also involving the ffi). http://www.haskell.org/pipermail/glasgow-haskell-bugs/2002-March/002286.html It seems to be a general problem in Hugs not with the ffi part in particular. The breakage seems to be in the macro ctrlbrk in hugs98/src/prelude.h but I don't know how to test any fixes I might make. I've collected reports on this page http://www.reid-consulting-uk.ltd.uk/projects/ffi/index.html -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
Here's my second report on the Hugs FFI build for Solaris. The newer version of gcc seems to have fixed the earlier build problem. However, as you can see, there is now a linking problem with the Storable module. Regards, Malcolm
uname -a
SunOS doozer 5.6 Generic_105181-15 sun4u sparc SUNW,Ultra-5_10
gcc -v
Reading specs from /york/pkg/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.5/2.95.2/specs gcc version 2.95.2 19991024 (release)
cd hugs98/src/unix; ./configure --prefix=/tmp/test
... checking for bison... bison -y ./configure: test: unknown operator == ... otherwise OK.
grep DLL ../config.h grep UNDERSCORE ../config.h
OK.
cd ..; make install_ffi
OK, until after installing the docs, then: ./hugs +q -w Storable +G +L"Storable_aux.c" < /dev/null __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2001 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: December 2001 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Text relocation remains referenced against symbol offset in file szChar 0x1524 /usr/tmp/ccLj4nGG.o <unknown> 0xdb8 /usr/tmp/ccLj4nGG.o <unknown> 0xaa0 /usr/tmp/ccLj4nGG.o <unknown> 0x15c4 /usr/tmp/ccLj4nGG.o <unknown> 0x8 /usr/tmp/ccLj4nGG.o <unknown> 0xc /usr/tmp/ccLj4nGG.o <unknown> 0x24 /usr/tmp/ccLj4nGG.o <unknown> 0x28 /usr/tmp/ccLj4nGG.o <unknown> 0x40 /usr/tmp/ccLj4nGG.o <unknown> 0x44 /usr/tmp/ccLj4nGG.o <unknown> 0xac4 /usr/tmp/ccLj4nGG.o <unknown> 0x70 /usr/tmp/ccLj4nGG.o <unknown> 0x74 /usr/tmp/ccLj4nGG.o <unknown> 0xa0 /usr/tmp/ccLj4nGG.o <unknown> 0xa4 /usr/tmp/ccLj4nGG.o <unknown> 0xbc /usr/tmp/ccLj4nGG.o <unknown> 0xc0 /usr/tmp/ccLj4nGG.o <unknown> 0xd8 /usr/tmp/ccLj4nGG.o <unknown> 0xdc /usr/tmp/ccLj4nGG.o <unknown> 0xaf8 /usr/tmp/ccLj4nGG.o <unknown> 0x108 /usr/tmp/ccLj4nGG.o <unknown> 0x10c /usr/tmp/ccLj4nGG.o <unknown> 0x138 /usr/tmp/ccLj4nGG.o <unknown> 0x13c /usr/tmp/ccLj4nGG.o <unknown> 0x154 /usr/tmp/ccLj4nGG.o <unknown> 0x158 /usr/tmp/ccLj4nGG.o <unknown> 0x170 /usr/tmp/ccLj4nGG.o <unknown> 0x174 /usr/tmp/ccLj4nGG.o <unknown> 0xb40 /usr/tmp/ccLj4nGG.o <unknown> 0x1a8 /usr/tmp/ccLj4nGG.o <unknown> 0x1ac /usr/tmp/ccLj4nGG.o <unknown> 0x1d8 /usr/tmp/ccLj4nGG.o <unknown> 0x1dc /usr/tmp/ccLj4nGG.o <unknown> 0x1f4 /usr/tmp/ccLj4nGG.o <unknown> 0x1f8 /usr/tmp/ccLj4nGG.o <unknown> 0x210 /usr/tmp/ccLj4nGG.o <unknown> 0x214 /usr/tmp/ccLj4nGG.o <unknown> 0xb98 /usr/tmp/ccLj4nGG.o <unknown> 0x244 /usr/tmp/ccLj4nGG.o <unknown> 0x248 /usr/tmp/ccLj4nGG.o <unknown> 0x274 /usr/tmp/ccLj4nGG.o <unknown> 0x278 /usr/tmp/ccLj4nGG.o <unknown> 0x290 /usr/tmp/ccLj4nGG.o <unknown> 0x294 /usr/tmp/ccLj4nGG.o <unknown> 0x2ac /usr/tmp/ccLj4nGG.o <unknown> 0x2b0 /usr/tmp/ccLj4nGG.o <unknown> 0xbe0 /usr/tmp/ccLj4nGG.o <unknown> 0x2dc /usr/tmp/ccLj4nGG.o <unknown> 0x2e0 /usr/tmp/ccLj4nGG.o <unknown> 0x30c /usr/tmp/ccLj4nGG.o <unknown> 0x310 /usr/tmp/ccLj4nGG.o <unknown> 0x328 /usr/tmp/ccLj4nGG.o <unknown> 0x32c /usr/tmp/ccLj4nGG.o <unknown> 0x344 /usr/tmp/ccLj4nGG.o <unknown> 0x348 /usr/tmp/ccLj4nGG.o <unknown> 0xc30 /usr/tmp/ccLj4nGG.o <unknown> 0x374 /usr/tmp/ccLj4nGG.o <unknown> 0x378 /usr/tmp/ccLj4nGG.o <unknown> 0x3a4 /usr/tmp/ccLj4nGG.o <unknown> 0x3a8 /usr/tmp/ccLj4nGG.o <unknown> 0x3c0 /usr/tmp/ccLj4nGG.o <unknown> 0x3c4 /usr/tmp/ccLj4nGG.o <unknown> 0x3dc /usr/tmp/ccLj4nGG.o <unknown> 0x3e0 /usr/tmp/ccLj4nGG.o <unknown> 0xc78 /usr/tmp/ccLj4nGG.o <unknown> 0x414 /usr/tmp/ccLj4nGG.o <unknown> 0x418 /usr/tmp/ccLj4nGG.o <unknown> 0x444 /usr/tmp/ccLj4nGG.o <unknown> 0x448 /usr/tmp/ccLj4nGG.o <unknown> 0x460 /usr/tmp/ccLj4nGG.o <unknown> 0x464 /usr/tmp/ccLj4nGG.o <unknown> 0x47c /usr/tmp/ccLj4nGG.o <unknown> 0x480 /usr/tmp/ccLj4nGG.o <unknown> 0xcc8 /usr/tmp/ccLj4nGG.o <unknown> 0x4b4 /usr/tmp/ccLj4nGG.o <unknown> 0x4b8 /usr/tmp/ccLj4nGG.o <unknown> 0x4e4 /usr/tmp/ccLj4nGG.o <unknown> 0x4e8 /usr/tmp/ccLj4nGG.o <unknown> 0x500 /usr/tmp/ccLj4nGG.o <unknown> 0x504 /usr/tmp/ccLj4nGG.o <unknown> 0x51c /usr/tmp/ccLj4nGG.o <unknown> 0x520 /usr/tmp/ccLj4nGG.o <unknown> 0xd10 /usr/tmp/ccLj4nGG.o <unknown> 0x54c /usr/tmp/ccLj4nGG.o <unknown> 0x550 /usr/tmp/ccLj4nGG.o <unknown> 0x57c /usr/tmp/ccLj4nGG.o <unknown> 0x580 /usr/tmp/ccLj4nGG.o <unknown> 0x598 /usr/tmp/ccLj4nGG.o <unknown> 0x59c /usr/tmp/ccLj4nGG.o <unknown> 0x5b4 /usr/tmp/ccLj4nGG.o <unknown> 0x5b8 /usr/tmp/ccLj4nGG.o <unknown> 0xd6c /usr/tmp/ccLj4nGG.o <unknown> 0x5ec /usr/tmp/ccLj4nGG.o <unknown> 0x5f0 /usr/tmp/ccLj4nGG.o <unknown> 0x61c /usr/tmp/ccLj4nGG.o <unknown> 0x620 /usr/tmp/ccLj4nGG.o <unknown> 0x638 /usr/tmp/ccLj4nGG.o <unknown> 0x63c /usr/tmp/ccLj4nGG.o <unknown> 0x654 /usr/tmp/ccLj4nGG.o <unknown> 0x658 /usr/tmp/ccLj4nGG.o <unknown> 0xdb4 /usr/tmp/ccLj4nGG.o <unknown> 0x688 /usr/tmp/ccLj4nGG.o <unknown> 0x68c /usr/tmp/ccLj4nGG.o <unknown> 0x6b8 /usr/tmp/ccLj4nGG.o <unknown> 0x6bc /usr/tmp/ccLj4nGG.o <unknown> 0x6d4 /usr/tmp/ccLj4nGG.o <unknown> 0x6d8 /usr/tmp/ccLj4nGG.o <unknown> 0x6f0 /usr/tmp/ccLj4nGG.o <unknown> 0x6f4 /usr/tmp/ccLj4nGG.o <unknown> 0xe10 /usr/tmp/ccLj4nGG.o <unknown> 0x720 /usr/tmp/ccLj4nGG.o <unknown> 0x724 /usr/tmp/ccLj4nGG.o <unknown> 0x750 /usr/tmp/ccLj4nGG.o <unknown> 0x754 /usr/tmp/ccLj4nGG.o <unknown> 0x76c /usr/tmp/ccLj4nGG.o <unknown> 0x770 /usr/tmp/ccLj4nGG.o <unknown> 0x788 /usr/tmp/ccLj4nGG.o <unknown> 0x78c /usr/tmp/ccLj4nGG.o <unknown> 0xe58 /usr/tmp/ccLj4nGG.o <unknown> 0x7b8 /usr/tmp/ccLj4nGG.o <unknown> 0x7bc /usr/tmp/ccLj4nGG.o <unknown> 0x7e8 /usr/tmp/ccLj4nGG.o <unknown> 0x7ec /usr/tmp/ccLj4nGG.o <unknown> 0x804 /usr/tmp/ccLj4nGG.o <unknown> 0x808 /usr/tmp/ccLj4nGG.o <unknown> 0x820 /usr/tmp/ccLj4nGG.o <unknown> 0x824 /usr/tmp/ccLj4nGG.o <unknown> 0xea8 /usr/tmp/ccLj4nGG.o <unknown> 0x858 /usr/tmp/ccLj4nGG.o <unknown> 0x85c /usr/tmp/ccLj4nGG.o <unknown> 0x888 /usr/tmp/ccLj4nGG.o <unknown> 0x88c /usr/tmp/ccLj4nGG.o <unknown> 0x8a4 /usr/tmp/ccLj4nGG.o <unknown> 0x8a8 /usr/tmp/ccLj4nGG.o <unknown> 0x8c0 /usr/tmp/ccLj4nGG.o <unknown> 0x8c4 /usr/tmp/ccLj4nGG.o <unknown> 0xef8 /usr/tmp/ccLj4nGG.o <unknown> 0x8f0 /usr/tmp/ccLj4nGG.o <unknown> 0x8f4 /usr/tmp/ccLj4nGG.o <unknown> 0x920 /usr/tmp/ccLj4nGG.o <unknown> 0x924 /usr/tmp/ccLj4nGG.o <unknown> 0x93c /usr/tmp/ccLj4nGG.o <unknown> 0x940 /usr/tmp/ccLj4nGG.o <unknown> 0xf48 /usr/tmp/ccLj4nGG.o <unknown> 0x96c /usr/tmp/ccLj4nGG.o <unknown> 0x970 /usr/tmp/ccLj4nGG.o <unknown> 0x988 /usr/tmp/ccLj4nGG.o <unknown> 0x98c /usr/tmp/ccLj4nGG.o <unknown> 0x9b8 /usr/tmp/ccLj4nGG.o <unknown> 0x9bc /usr/tmp/ccLj4nGG.o <unknown> 0x9d4 /usr/tmp/ccLj4nGG.o <unknown> 0x9d8 /usr/tmp/ccLj4nGG.o <unknown> 0xf94 /usr/tmp/ccLj4nGG.o <unknown> 0xa04 /usr/tmp/ccLj4nGG.o <unknown> 0xa08 /usr/tmp/ccLj4nGG.o <unknown> 0xa20 /usr/tmp/ccLj4nGG.o <unknown> 0xa24 /usr/tmp/ccLj4nGG.o <unknown> 0xa50 /usr/tmp/ccLj4nGG.o <unknown> 0xa54 /usr/tmp/ccLj4nGG.o <unknown> 0xa6c /usr/tmp/ccLj4nGG.o <unknown> 0xa70 /usr/tmp/ccLj4nGG.o <unknown> 0xfe0 /usr/tmp/ccLj4nGG.o <unknown> 0xa9c /usr/tmp/ccLj4nGG.o <unknown> 0x102c /usr/tmp/ccLj4nGG.o <unknown> 0x15b8 /usr/tmp/ccLj4nGG.o <unknown> 0xac8 /usr/tmp/ccLj4nGG.o <unknown> 0xaf4 /usr/tmp/ccLj4nGG.o <unknown> 0xec4 /usr/tmp/ccLj4nGG.o <unknown> 0xb10 /usr/tmp/ccLj4nGG.o <unknown> 0xb14 /usr/tmp/ccLj4nGG.o <unknown> 0x15b4 /usr/tmp/ccLj4nGG.o <unknown> 0x15a8 /usr/tmp/ccLj4nGG.o <unknown> 0xb44 /usr/tmp/ccLj4nGG.o <unknown> 0xb64 /usr/tmp/ccLj4nGG.o <unknown> 0xb68 /usr/tmp/ccLj4nGG.o <unknown> 0xb94 /usr/tmp/ccLj4nGG.o <unknown> 0x15a4 /usr/tmp/ccLj4nGG.o <unknown> 0xbb0 /usr/tmp/ccLj4nGG.o <unknown> 0xbb4 /usr/tmp/ccLj4nGG.o <unknown> 0x156c /usr/tmp/ccLj4nGG.o <unknown> 0x1568 /usr/tmp/ccLj4nGG.o <unknown> 0xbe4 /usr/tmp/ccLj4nGG.o <unknown> 0xbfc /usr/tmp/ccLj4nGG.o <unknown> 0xc00 /usr/tmp/ccLj4nGG.o <unknown> 0xc2c /usr/tmp/ccLj4nGG.o <unknown> 0x1534 /usr/tmp/ccLj4nGG.o <unknown> 0xc48 /usr/tmp/ccLj4nGG.o <unknown> 0xc4c /usr/tmp/ccLj4nGG.o <unknown> 0x1530 /usr/tmp/ccLj4nGG.o <unknown> 0x14fc /usr/tmp/ccLj4nGG.o <unknown> 0xc7c /usr/tmp/ccLj4nGG.o <unknown> 0xc94 /usr/tmp/ccLj4nGG.o <unknown> 0xc98 /usr/tmp/ccLj4nGG.o <unknown> 0xcc4 /usr/tmp/ccLj4nGG.o <unknown> 0x14f8 /usr/tmp/ccLj4nGG.o <unknown> 0xce0 /usr/tmp/ccLj4nGG.o <unknown> 0xce4 /usr/tmp/ccLj4nGG.o <unknown> 0x14c4 /usr/tmp/ccLj4nGG.o <unknown> 0x14c0 /usr/tmp/ccLj4nGG.o <unknown> 0xd14 /usr/tmp/ccLj4nGG.o <unknown> 0xd38 /usr/tmp/ccLj4nGG.o <unknown> 0xd3c /usr/tmp/ccLj4nGG.o <unknown> 0xd68 /usr/tmp/ccLj4nGG.o <unknown> 0x148c /usr/tmp/ccLj4nGG.o <unknown> 0xd84 /usr/tmp/ccLj4nGG.o <unknown> 0xd88 /usr/tmp/ccLj4nGG.o <unknown> 0x1488 /usr/tmp/ccLj4nGG.o <unknown> 0x13e0 /usr/tmp/ccLj4nGG.o <unknown> 0x15c8 /usr/tmp/ccLj4nGG.o <unknown> 0xddc /usr/tmp/ccLj4nGG.o <unknown> 0xde0 /usr/tmp/ccLj4nGG.o <unknown> 0xe0c /usr/tmp/ccLj4nGG.o <unknown> 0x1454 /usr/tmp/ccLj4nGG.o <unknown> 0xe28 /usr/tmp/ccLj4nGG.o <unknown> 0xe2c /usr/tmp/ccLj4nGG.o <unknown> 0x1450 /usr/tmp/ccLj4nGG.o <unknown> 0x141c /usr/tmp/ccLj4nGG.o <unknown> 0xe5c /usr/tmp/ccLj4nGG.o <unknown> 0xe74 /usr/tmp/ccLj4nGG.o <unknown> 0xe78 /usr/tmp/ccLj4nGG.o <unknown> 0xea4 /usr/tmp/ccLj4nGG.o <unknown> 0x1418 /usr/tmp/ccLj4nGG.o <unknown> 0xec0 /usr/tmp/ccLj4nGG.o <unknown> 0x1048 /usr/tmp/ccLj4nGG.o <unknown> 0x13e4 /usr/tmp/ccLj4nGG.o <unknown> 0x10c8 /usr/tmp/ccLj4nGG.o <unknown> 0xefc /usr/tmp/ccLj4nGG.o <unknown> 0xf14 /usr/tmp/ccLj4nGG.o <unknown> 0xf18 /usr/tmp/ccLj4nGG.o <unknown> 0xf44 /usr/tmp/ccLj4nGG.o <unknown> 0x13ac /usr/tmp/ccLj4nGG.o <unknown> 0xf60 /usr/tmp/ccLj4nGG.o <unknown> 0xf64 /usr/tmp/ccLj4nGG.o <unknown> 0x13a8 /usr/tmp/ccLj4nGG.o <unknown> 0x10e0 /usr/tmp/ccLj4nGG.o <unknown> 0xf98 /usr/tmp/ccLj4nGG.o <unknown> 0xfb0 /usr/tmp/ccLj4nGG.o <unknown> 0xfb4 /usr/tmp/ccLj4nGG.o <unknown> 0x1374 /usr/tmp/ccLj4nGG.o <unknown> 0xfe4 /usr/tmp/ccLj4nGG.o <unknown> 0xffc /usr/tmp/ccLj4nGG.o <unknown> 0x1000 /usr/tmp/ccLj4nGG.o <unknown> 0x1370 /usr/tmp/ccLj4nGG.o <unknown> 0x1130 /usr/tmp/ccLj4nGG.o <unknown> 0x1030 /usr/tmp/ccLj4nGG.o <unknown> 0x1184 /usr/tmp/ccLj4nGG.o <unknown> 0x104c /usr/tmp/ccLj4nGG.o <unknown> 0x1078 /usr/tmp/ccLj4nGG.o <unknown> 0x107c /usr/tmp/ccLj4nGG.o <unknown> 0x1094 /usr/tmp/ccLj4nGG.o <unknown> 0x1098 /usr/tmp/ccLj4nGG.o <unknown> 0x133c /usr/tmp/ccLj4nGG.o <unknown> 0x10c4 /usr/tmp/ccLj4nGG.o <unknown> 0x1188 /usr/tmp/ccLj4nGG.o <unknown> 0x11d4 /usr/tmp/ccLj4nGG.o <unknown> 0x10e4 /usr/tmp/ccLj4nGG.o <unknown> 0x1110 /usr/tmp/ccLj4nGG.o <unknown> 0x1114 /usr/tmp/ccLj4nGG.o <unknown> 0x112c /usr/tmp/ccLj4nGG.o <unknown> 0x1200 /usr/tmp/ccLj4nGG.o <unknown> 0x1338 /usr/tmp/ccLj4nGG.o <unknown> 0x115c /usr/tmp/ccLj4nGG.o <unknown> 0x1160 /usr/tmp/ccLj4nGG.o <unknown> 0x1204 /usr/tmp/ccLj4nGG.o <unknown> 0x1220 /usr/tmp/ccLj4nGG.o <unknown> 0x11b4 /usr/tmp/ccLj4nGG.o <unknown> 0x11b8 /usr/tmp/ccLj4nGG.o <unknown> 0x11d0 /usr/tmp/ccLj4nGG.o <unknown> 0x1304 /usr/tmp/ccLj4nGG.o <unknown> 0x125c /usr/tmp/ccLj4nGG.o <unknown> 0x121c /usr/tmp/ccLj4nGG.o <unknown> 0x1258 /usr/tmp/ccLj4nGG.o <unknown> 0x1300 /usr/tmp/ccLj4nGG.o <unknown> 0x1290 /usr/tmp/ccLj4nGG.o <unknown> 0x1294 /usr/tmp/ccLj4nGG.o <unknown> 0x12c8 /usr/tmp/ccLj4nGG.o <unknown> 0x12cc /usr/tmp/ccLj4nGG.o szInt32 0x1364 /usr/tmp/ccLj4nGG.o szInt64 0x132c /usr/tmp/ccLj4nGG.o szInt16 0x139c /usr/tmp/ccLj4nGG.o szWord8 0x12f4 /usr/tmp/ccLj4nGG.o szFloat 0x147c /usr/tmp/ccLj4nGG.o wrWord32 0x100 /usr/tmp/ccLj4nGG.o wrWord64 0x68 /usr/tmp/ccLj4nGG.o wrWord16 0x1a0 /usr/tmp/ccLj4nGG.o wrDouble 0x5e4 /usr/tmp/ccLj4nGG.o wrFunPtr 0x718 /usr/tmp/ccLj4nGG.o szStablePtr 0x140c /usr/tmp/ccLj4nGG.o rdInt8 0xda8 /usr/tmp/ccLj4nGG.o rdChar 0x1150 /usr/tmp/ccLj4nGG.o wrPtr 0x7b0 /usr/tmp/ccLj4nGG.o wrInt 0x8e8 /usr/tmp/ccLj4nGG.o szWord32 0x1284 /usr/tmp/ccLj4nGG.o szWord64 0x124c /usr/tmp/ccLj4nGG.o szWord16 0x12bc /usr/tmp/ccLj4nGG.o szDouble 0x1444 /usr/tmp/ccLj4nGG.o szFunPtr 0x14b4 /usr/tmp/ccLj4nGG.o rdInt32 0xc6c /usr/tmp/ccLj4nGG.o rdWord32 0x9f8 /usr/tmp/ccLj4nGG.o rdInt64 0xbd4 /usr/tmp/ccLj4nGG.o rdInt16 0xd04 /usr/tmp/ccLj4nGG.o rdWord8 0xb34 /usr/tmp/ccLj4nGG.o rdFloat 0xf84 /usr/tmp/ccLj4nGG.o szPtr 0x14ec /usr/tmp/ccLj4nGG.o szInt 0x155c /usr/tmp/ccLj4nGG.o wrInt8 0x4ac /usr/tmp/ccLj4nGG.o wrChar 0x850 /usr/tmp/ccLj4nGG.o rdStablePtr 0xe4c /usr/tmp/ccLj4nGG.o rdWord64 0x960 /usr/tmp/ccLj4nGG.o rdWord16 0xa90 /usr/tmp/ccLj4nGG.o szInt8 0x13d4 /usr/tmp/ccLj4nGG.o rdDouble 0xee4 /usr/tmp/ccLj4nGG.o rdFunPtr 0x1020 /usr/tmp/ccLj4nGG.o wrInt32 0x36c /usr/tmp/ccLj4nGG.o wrInt64 0x2d4 /usr/tmp/ccLj4nGG.o wrInt16 0x40c /usr/tmp/ccLj4nGG.o wrWord8 0x23c /usr/tmp/ccLj4nGG.o wrFloat 0x680 /usr/tmp/ccLj4nGG.o rdPtr 0x10b8 /usr/tmp/ccLj4nGG.o rdInt 0x11f4 /usr/tmp/ccLj4nGG.o wrStablePtr 0x544 /usr/tmp/ccLj4nGG.o ld: fatal: relocations remain against allocatable but non-writable sections collect2: ld returned 1 exit status ERROR "/tmp/test/share/hugs/lib/exts/Storable.hs" - Error while running compilation command 'cd '/tmp/test/share/hugs/lib/exts'; gcc -shared "-I/tmp/test/share/hugs/include" "Storable.c" -o "Storable.so" Storable_aux.c' Ptr> [Leaving Hugs] ./hugs +q -w MarshalAlloc +G < /dev/null __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2001 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: December 2001 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions ERROR "/tmp/test/share/hugs/lib/exts/Storable.hs" - Error while importing DLL "/tmp/test/share/hugs/lib/exts/Storable.so": ld.so.1: ./hugs: fatal: /tmp/test/share/hugs/lib/exts/Storable.so: open failed: No such file or directory Ptr> [Leaving Hugs] ./hugs +q -w MarshalUtils +G < /dev/null __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2001 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: December 2001 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions ERROR "/tmp/test/share/hugs/lib/exts/Storable.hs" - Error while importing DLL "/tmp/test/share/hugs/lib/exts/Storable.so": ld.so.1: ./hugs: fatal: /tmp/test/share/hugs/lib/exts/Storable.so: open failed: No such file or directory Ptr> [Leaving Hugs]
Malcolm Wallace
Here's my second report on the Hugs FFI build for Solaris.
Thank you again. I'm not sure what's going on but I'm guessing that the problem is that my autoconf test for how to build loadable libraries wasn't thorough enough. I've tried to beef up the configure check to something that would certainly contain relocations and I'm hoping that configure will zero in on the right command or fail instead of succeeding with the wrong command. Could I ask you to try again with this CVS snapshot? http://www.reid-consulting-uk.ltd.uk/downloads/hugs98-ffi-09072002-src.tar.g... I'm collected reports on this page http://www.reid-consulting-uk.ltd.uk/projects/ffi/index.html -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
Here's my second report on the Hugs FFI build for Solaris.
I'm not sure what's going on but I'm guessing that the problem is that my autoconf test for how to build loadable libraries wasn't thorough enough.
Ok, another try on the same machine setup but with the new package incorporating your autoconf fixes: hugs98-ffi-09072002b. Now I get the same results as Sven does under Solaris 2.7.
uname -a
SunOS doozer 5.6 Generic_105181-15 sun4u sparc SUNW,Ultra-5_10
gcc -v
Reading specs from /york/pkg/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.5/2.95.2/specs gcc version 2.95.2 19991024 (release)
./configure --prefix=/tmp/test
Seems ok - here are the highlights regarding dynamic linking: checking for function_dlopen... no checking for library_dl... yes checking for function_shl_load... no checking for library_dld... no ... checking if '/LD' builds loadable libraries... checking if '-shared' builds loadable libraries... checking if '-bundle' builds loadable libraries... checking if '-bundle -lc' builds loadable libraries... checking if '-shared -nostdlib' builds loadable libraries... checking if '-r' builds loadable libraries... -r checking if '-rdynamic' builds loadable libraries... (cached) -r checking if '-G' builds loadable libraries... (cached) -r checking if '-Aa +z' builds loadable libraries... (cached) -r
grep DLL ../config.h grep UNDERSCORE ../config.h
#define MKDLL_CMD "gcc -r" /* #undef LEADING_UNDERSCORE */
cd ..; make install_ffi
OK
cd ../tests; sh testScript ffi
---------------------------------------------------------------- -- Testing foreign function interface. ---------------------------------------------------------------- -- !!! Testing marshalling of all the basic types -- !!! Testing all the different forms of foreign import -- !!! Testing static, dynamic and wrapped import of trig function -- !!! Testing static, dynamic and wrapped import of trig function /tmp/test/bin/hugs +q +w -pHugs: ffi/Sin.hs < ffi/Sin.input expected stdout not matched by reality *** ffi/Sin.output Tue Jun 18 21:02:08 2002 --- /tmp/runtest2119.3 Tue Jul 9 14:48:11 2002 *************** *** 7,13 **** Testing sin==IO wrapped_sin (should return lots of Trues) - [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True] - - Testing sin==Id wrapped_sin (should return lots of Trues) - [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True] Hugs:[Leaving Hugs] --- 7,10 ---- Testing sin==IO wrapped_sin (should return lots of Trues) + ERROR - Foreign import wrapper is not supported on this architecture Hugs:[Leaving Hugs] -- !!! Testing marshalling of strings -- !!! Testing marshalling of strings -- !!! Testing system calls -- !!! Testing system calls ----------------------------------------------------------------
Thanks Malcolm. I've added your report to http://www.reid-consulting-uk.ltd.uk/projects/ffi/index.html It looks like it's working ok now on Solaris (except for the lack of f.i.wrapper) -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
uname -a
FreeBSD 4.6-STABLE i386
cc -v
Using builtin specs. gcc version 2.95.4 20020320 [FreeBSD]
cd hugs98/src/unix ./configure --prefix=/tmp/test
ok
grep DLL ../config.h #define MKDLL_CMD "gcc -shared" grep UNDERSCORE ../config.h /* #undef LEADING_UNDERSCORE */
cd .. make install_ffi
ok
cd ../tests sh testScript ffi
ok Regards, Olli -- IST & IIS _ INF _ UniBwM ___________ http://ist.unibw-muenchen.de/People/obraun/ Tele-Consulting GmbH _______________ http://www.tele-consulting.com/ ___ obraun@ FreeBSD: The Power To Serve ________ http://www.freebsd.org/ ___________________
Oliver Braun
It fails on FreeBSD 5.0 current, the "work-in-progress" upcoming major release (but FreeBSD 5.0 current is a "moving target" at the moment):
uname -a
FreeBSD 5.0-CURRENT i386
cc -v
Using built-in specs. Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 3.1 [FreeBSD] 20020509 (prerelease)
ld -v
GNU ld version 2.12.0 [FreeBSD] 2002-04-10
cd hugs98/src/unix ./configure --prefix=/tmp/test
ok
grep DLL ../config.h #define MKDLL_CMD "gcc -shared" grep UNDERSCORE ../config.h /* #undef LEADING_UNDERSCORE */
cd .. make install_ffi
<snip> /bin/cp ../docs/*.txt /tmp/test/share/hugs/docs /bin/cp ../docs/server.* /tmp/test/share/hugs/docs /bin/cp ../Readme /tmp/test/share/hugs /bin/cp ../License /tmp/test/share/hugs /bin/cp ../Credits /tmp/test/share/hugs ./hugs +q -w Storable +G +L"Storable_aux.c" < /dev/null __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2001 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: December 2001 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Storable> hugs in free(): error: page is already free [Leaving Hugs] hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call hugs in free(): error: recursive call [ ... ~10000000 times ] BTW, hugs December 2001 release builds and works on this machine. Regards, Olli -- IST & IIS _ INF _ UniBwM ___________ http://ist.unibw-muenchen.de/People/obraun/ Tele-Consulting GmbH _______________ http://www.tele-consulting.com/ ___ obraun@ FreeBSD: The Power To Serve ________ http://www.freebsd.org/ ___________________
* Oliver Braun
It fails on FreeBSD 5.0 current, the "work-in-progress" upcoming major release (but FreeBSD 5.0 current is a "moving target" at the moment):
I forgot to mention: I used second test release (9 July 2002). Regards, Olli -- IST & IIS _ INF _ UniBwM ___________ http://ist.unibw-muenchen.de/People/obraun/ Tele-Consulting GmbH _______________ http://www.tele-consulting.com/ ___ obraun@ FreeBSD: The Power To Serve ________ http://www.freebsd.org/ ___________________
It fails on FreeBSD 5.0 current, the "work-in-progress" upcoming major release (but FreeBSD 5.0 current is a "moving target" at the moment):
Thanks for another fine report, Olli. I suspect that the FreeBSD folk have a bit of extra debugging turned on for this very reason which is why you caught an error that had been missed on every other platform. What seems to have happened is that Hugs frees the library when it deletes a script (e.g., when it shuts down). Unfortunately, Hugs didn't remember that it had freed the library so, in some circumstances, it could free the same dll twice. I've fixed this bug and made up another tarfile: http://www.reid-consulting-uk.ltd.uk/downloads/hugs98-ffi-09072002c-src.tar.... Hopefully this fixes the problem. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
* Alastair Reid
It fails on FreeBSD 5.0 current, the "work-in-progress" upcoming major release (but FreeBSD 5.0 current is a "moving target" at the moment):
I suspect that the FreeBSD folk have a bit of extra debugging turned on for this very reason which is why you caught an error that had been missed on every other platform.
What seems to have happened is that Hugs frees the library when it deletes a script (e.g., when it shuts down). Unfortunately, Hugs didn't remember that it had freed the library so, in some circumstances, it could free the same dll twice.
I've fixed this bug and made up another tarfile:
http://www.reid-consulting-uk.ltd.uk/downloads/hugs98-ffi-09072002c-src.tar....
Hopefully this fixes the problem.
Unfortunately not. Still the same error. Regards, Olli -- IST & IIS _ INF _ UniBwM ___________ http://ist.unibw-muenchen.de/People/obraun/ Tele-Consulting GmbH _______________ http://www.tele-consulting.com/ ___ obraun@ FreeBSD: The Power To Serve ________ http://www.freebsd.org/ ___________________
Alastair:
Hopefully this fixes the problem.
Oliver Braun
Unfortunately not. Still the same error.
Oh well, I'll need to think about this a bit harder. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
In a nutshell: My system is a SuSE 7.3 Linux on x86, and everything went well. More detailed:
uname -a
Linux jeanluc 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown
cc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.3/specs gcc version 2.95.3 20010315 (SuSE)
grep DLL ../config.h
#define MKDLL_CMD "gcc -shared"
grep UNDERSCORE ../config.h
/* #undef LEADING_UNDERSCORE */
cd .. ; make install_ffi
OK
cd ../tests ; sh testScript ffi
OK Cheers, S.
Sven Panne
In a nutshell: My system is a SuSE 7.3 Linux on x86, and everything went well.
Thanks very much Sven, much appreciated. I've added your report to this summary page http://www.reid-consulting-uk.ltd.uk/projects/ffi/index.html -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
Thanks to Sigbjorn Finne, Oliver Braun, Sven Panne, Malcolm Wallace and Simon Marlow I now have test results for Windows, Linux/x86, FreeBSD/x86 and Solaris/Sparc. I'd be interested in seeing reports for: - MacOSX/PPC (should work), - HPUX (may need some help in configure and, of course, foreign import wrapper isn't implemented), and - Alpha (may configure and build but will probably fail most runtime tests because of portability problems in lib/exts/Storable.hs). and, of course, any other platforms. I'm collecting reports on this page: http://www.reid-consulting-uk.ltd.uk/projects/ffi/index.html and have put together a new CVS snapshot for testing: http://www.reid-consulting-uk.ltd.uk/downloads/hugs98-ffi-09072002-src.tar.g... The test procedure is described on the report page. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
participants (5)
-
Alastair Reid -
Alastair Reid -
Malcolm Wallace -
Oliver Braun -
Sven Panne