Hi David,<br><br><div class="gmail_quote">On Mon, Mar 21, 2011 at 6:50 AM, David Graham <span dir="ltr"><<a href="mailto:dgraham@unthinkable.org">dgraham@unthinkable.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Hello,<br>
<br>
I've noticed a few emails about running Cog on FreeBSD on some of the other mailing lists and was wondering if it would be possible to get a few patches integrated into the main repository? Sorry if I'm not following protocol for patch submission or style, I couldn't find any guidelines. I'd be happy to resubmit if this isn't the place.<br>
</blockquote><div><br></div><div>This'll do. This is the place. Thanks, but I have some reservations.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
With the following patches, Cog r2372 will compile and run on FreeBSD (and PCBSD) 8.2 i386. I've been able to use Squeak, Pharo, and Seaside images. Here is the configure line:<br>
<br>
../../platforms/unix/config/configure CFLAGS="-g -O2 -msse2 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DNOEXECINFO -DDEBUGVM=0" LIBS=-lpthread --without-npsqueak<br></blockquote><div><br></div>
<div>Thanks.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Here is the diff.<br>
Index: platforms/unix/plugins/SqueakFFIPrims/ffi-config<br>
===================================================================<br>
--- platforms/unix/plugins/SqueakFFIPrims/ffi-config (revision 2372)<br>
+++ platforms/unix/plugins/SqueakFFIPrims/ffi-config (working copy)<br>
@@ -39,6 +39,7 @@<br>
<br>
case ${abi} in<br>
linux) abi=sysv;;<br>
+ freebsd) abi=sysv;;<br>
darwin*) abi=darwin;;<br>
*) abi=libffi; lib="-lffi";;<br>
esac<br></blockquote><div><br></div><div>This should be irrelevant. You should not be building the old plugin but instead be using ReentrantFFIPlugin or ThreadedFFIPlugin. Is this simply to get the configure to run? If so I'll try and excise support for the old FFI plugin.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Index: platforms/unix/vm/sqUnixMain.c<br>
===================================================================<br>
--- platforms/unix/vm/sqUnixMain.c (revision 2372)<br>
+++ platforms/unix/vm/sqUnixMain.c (working copy)<br>
@@ -60,6 +60,9 @@<br>
# include <execinfo.h><br>
# define BACKTRACE_DEPTH 64<br>
#endif<br>
+#if __FreeBSD__<br>
+# include <sys/ucontext.h><br>
+#endif<br>
<br>
#if defined(__alpha__) && defined(__osf__)<br>
# include <sys/sysinfo.h><br>
@@ -777,6 +780,9 @@<br>
# elif __linux__ && __i386__<br>
void *fp = (void *)(uap ? uap->uc_mcontext.gregs[REG_EBP]: 0);<br>
void *sp = (void *)(uap ? uap->uc_mcontext.gregs[REG_ESP]: 0);<br>
+# elif __FreeBSD__ && __i386__<br>
+ void *fp = (void *)(uap ? uap->uc_mcontext.mc_ebp: 0);<br>
+ void *sp = (void *)(uap ? uap->uc_mcontext.mc_esp: 0);<br>
# else<br>
# error need to implement extracting pc from a ucontext_t on this system<br>
# endif<br></blockquote><div><br></div><div>Excellent. Thanks.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Index: platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c<br>
===================================================================<br>
--- platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c (revision 2372)<br>
+++ platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c (working copy)<br>
@@ -10,7 +10,7 @@<br>
*****************************************************************************/<br>
<br>
#include <stdio.h><br>
-#if !WIN32<br>
+#if !WIN32 && !__FreeBSD__<br>
# include <alloca.h><br>
#endif<br>
#include <string.h></blockquote></div><br><div>Great, thanks!</div>