Trouble compiling GNU Smalltalk

Hello!

I’m trying to compile GNU Smalltalk on beta5, x64. Got the latest sources from github: GitHub - gnu-smalltalk/smalltalk: GNU Smalltalk.
After install all the dependencies (bison, flex, texinfo, libtool_libltdl, libffi, libffi_devel, libsigsegv, libsigsegv_devel), and fixing a var declaration in iconv.c, I’ve managed to get to build up this far:

sysdep/posix/files.c:278:28: error: 'AF_UNIX' undeclared (first use in this function)
  278 |       result = socketpair (AF_UNIX, SOCK_STREAM, 0, fd);
      |                            ^~~~~~~
sysdep/posix/files.c:278:37: error: 'SOCK_STREAM' undeclared (first use in this function)
  278 |       result = socketpair (AF_UNIX, SOCK_STREAM, 0, fd);
      |                                     ^~~~~~~~~~~
make[3]: *** [Makefile:746: sysdep.lo] Error 1
make[3]: Leaving directory '/boot/home/smalltalk-master/libgst'

I’ve no idea how to fix that. Any help is appreciated!

See also: Porting Smalltalk.

Porting things generally requires not only compiling source on a new platform, but also patching it so it would compile and run.

Also, are you sure you want GNU Smalltalk instead of any other smalltalk?

That thread concludes with suggestions for how to proceed with I/O scheduling in opensmalltalk. Stopped there? Are you sure you want opensmalltalk?

If that’s the hardest one you run into with this port, you’re looking good.

This is a case of include file structure variation among UNIX platforms. The stuff you need is here, but the includes in file.c are looking in the wrong place. What you have to do:

  • Look in Haiku’s include files for the missing symbols AF_UNIX and SOCK_STREAM. You’re looking for POSIX support, which is in /boot/system/develop/headers/posix/.
  • Find them in sys/socket.h.
  • Look at files.c and work that include in there. There will be some includes involving network functionality, and that’s where this goes. Maybe there’s already #include <socket.h>, and you can try just sticking the sys/ in there.
  • But don’t change the existing includes – add your changes.
#if defined(__HAIKU__)
#include <sys/socket.h>
#else  /* the part that was already here ... */
#include <socket.h>
#endif

I’d be surprised if something like that isn’t already right there, waiting for you to add Haiku to the set of more enlightened platforms.

It will probably be a little more work than this, but not much.

Are you sure you want opensmalltalk?

Yes, since all cool smalltalk stuff uses it. I’ll continue porting it when I find some time.