Building CogVM on FreeBSD

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Building CogVM on FreeBSD

Pierce Ng-2
Hi,

Here's how to build the Cog VM on FreeBSD.

First, some numbers. Cog, PharoCore 1.1.1, FreeBSD 7.3:

  439108061 bytecodes/sec; 44986622 sends/sec
  484848484 bytecodes/sec; 44903004 sends/sec
  464609800 bytecodes/sec; 45028548 sends/sec
  480300187 bytecodes/sec; 46726917 sends/sec
  485768500 bytecodes/sec; 47229357 sends/sec

4.0.3-2202, a slighly older non-compatible Pharo image, same FreeBSD 7.3:

  525667351 bytecodes/sec; 15328014 sends/sec
  548473486 bytecodes/sec; 14943262 sends/sec
  545260915 bytecodes/sec; 14728594 sends/sec
  545260915 bytecodes/sec; 14600418 sends/sec
  524590163 bytecodes/sec; 14646769 sends/sec

Build the VM on a 32bit FreeBSD boxen.

- Download the sources:

  $ svn co http://squeakvm.org/svn/squeak/branches/Cog/platforms
  $ svn co http://squeakvm.org/svn/squeak/branches/Cog/src
  $ svn co http://squeakvm.org/svn/squeak/branches/Cog/unixbuild

- Apply the following patches from the FreeBSD port of Squeak, found in
/usr/ports/lang/squeak/files:

  patch-platforms__Cross__plugins__Mpeg3Plugin__libmpeg__mpeg3io.h
  patch-platforms__unix__config__configure
  patch-platforms__unix__plugins__PseudoTTYPlugin_openpty.h
  patch-platforms__unix__plugins__SqueakFFIPrims__ffi-config

- Apply the following patch to platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c:

--- sqFFIPlugin.c.bak 2010-12-03 23:41:56.000000000 +0800
+++ sqFFIPlugin.c 2010-12-04 14:38:02.000000000 +0800
@@ -10,7 +10,7 @@
 *****************************************************************************/
 
 #include <stdio.h>
-#if !WIN32
+#if !defined(WIN32 ) && !defined(__FreeBSD__)
 # include <alloca.h>
 #endif
 #include <string.h>

- Configure the VM as follows in the 'bld' directory:

$ ../../platforms/unix/config/configure \
  CFLAGS="-g -O -msse2 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" \
  --without-npsqueak

- Build the VM. Voila.

HTH.



Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Frank Shearar
On 2010/12/04 09:30, Pierce Ng wrote:
> Hi,
>
> Here's how to build the Cog VM on FreeBSD.

Glad to see your mail make it to squeak-dev, Pierce. I posted some
comments on vm-dev, and I'll reproduce them here. (I don't know if
you're subscribed there.)

> - Download the sources:
>
>    $ svn co http://squeakvm.org/svn/squeak/branches/Cog/platforms
>    $ svn co http://squeakvm.org/svn/squeak/branches/Cog/src
>    $ svn co http://squeakvm.org/svn/squeak/branches/Cog/unixbuild
>
> - Apply the following patches from the FreeBSD port of Squeak, found in
> /usr/ports/lang/squeak/files:
>
>    patch-platforms__Cross__plugins__Mpeg3Plugin__libmpeg__mpeg3io.h
>    patch-platforms__unix__config__configure
>    patch-platforms__unix__plugins__PseudoTTYPlugin_openpty.h
>    patch-platforms__unix__plugins__SqueakFFIPrims__ffi-config

Typo nit: this should be

   patch-platforms__unix__plugins__PseudoTTYPlugin__openpty.h

(note the double underscore)

> - Apply the following patch to platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c:
>
> --- sqFFIPlugin.c.bak 2010-12-03 23:41:56.000000000 +0800
> +++ sqFFIPlugin.c 2010-12-04 14:38:02.000000000 +0800
> @@ -10,7 +10,7 @@
>   *****************************************************************************/
>
>   #include<stdio.h>
> -#if !WIN32
> +#if !defined(WIN32 )&&  !defined(__FreeBSD__)
>   # include<alloca.h>
>   #endif
>   #include<string.h>

Dump this into a file foo, and add
"platforms/Cross/plugins/SqueakFFIPrims/" in front of the filename, so
you can patch < foo


>
> - Configure the VM as follows in the 'bld' directory:
>
> $ ../../platforms/unix/config/configure \
>    CFLAGS="-g -O -msse2 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0" \
>    --without-npsqueak
>
> - Build the VM. Voila.

And building completed without error! I haven't attempted running an
image; I only have terminal access to a FreeBSD machine.

I'd mentioned in vm-dev that it would be really useful to have an image
that only evaluated "3 + 4" and wrote that to stdout. (Maybe someone
already has one?) We could use that with a Hudson instance, and verify
our VM builds automatically.

frank

Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

David T. Lewis
On Sun, Dec 05, 2010 at 06:14:54PM +0000, Frank Shearar wrote:

>
> And building completed without error! I haven't attempted running an
> image; I only have terminal access to a FreeBSD machine.
>
> I'd mentioned in vm-dev that it would be really useful to have an image
> that only evaluated "3 + 4" and wrote that to stdout. (Maybe someone
> already has one?) We could use that with a Hudson instance, and verify
> our VM builds automatically.
>
> frank
Actually, you do not need a special image for this. Just supply a start
script when you start Squeak, and run headless using the -vm-display-null
parameter. The script can evaluate 3+4, write output to /dev/tty, then exit.
An example start script is attached.

Dave




3plus4.st (466 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Frank Shearar
On 2010/12/05 19:15, David T. Lewis wrote:

> On Sun, Dec 05, 2010 at 06:14:54PM +0000, Frank Shearar wrote:
>
>>
>> And building completed without error! I haven't attempted running an
>> image; I only have terminal access to a FreeBSD machine.
>>
>> I'd mentioned in vm-dev that it would be really useful to have an image
>> that only evaluated "3 + 4" and wrote that to stdout. (Maybe someone
>> already has one?) We could use that with a Hudson instance, and verify
>> our VM builds automatically.
>>
>> frank
>
> Actually, you do not need a special image for this. Just supply a start
> script when you start Squeak, and run headless using the -vm-display-null
> parameter. The script can evaluate 3+4, write output to /dev/tty, then exit.
> An example start script is attached.

Excellent!

Turns out I'd only run configure, not make, so when I've figured out
what make's telling me I did wrong (it might be a 64-bit thing judging
by "warning: cast from pointer to integer of different size"), I'll give
it a whirl.

frank

Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

David T. Lewis
On Sun, Dec 05, 2010 at 07:58:53PM +0000, Frank Shearar wrote:

> On 2010/12/05 19:15, David T. Lewis wrote:
> >On Sun, Dec 05, 2010 at 06:14:54PM +0000, Frank Shearar wrote:
> >
> >>
> >>And building completed without error! I haven't attempted running an
> >>image; I only have terminal access to a FreeBSD machine.
> >>
> >>I'd mentioned in vm-dev that it would be really useful to have an image
> >>that only evaluated "3 + 4" and wrote that to stdout. (Maybe someone
> >>already has one?) We could use that with a Hudson instance, and verify
> >>our VM builds automatically.
> >>
> >>frank
> >
> >Actually, you do not need a special image for this. Just supply a start
> >script when you start Squeak, and run headless using the -vm-display-null
> >parameter. The script can evaluate 3+4, write output to /dev/tty, then
> >exit.
> >An example start script is attached.
>
> Excellent!
>
> Turns out I'd only run configure, not make, so when I've figured out
> what make's telling me I did wrong (it might be a 64-bit thing judging
> by "warning: cast from pointer to integer of different size"), I'll give
> it a whirl.

You'll get a lot of these warnings when compiling 64-bit. Many can be
ignored, but some things do not work at all when compiled this way.
If you have specific problems, bring it up on vm-dev (yes I know you
originally asked the 3 + 4 question on vm-dev ;-)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Amir Ansari
In reply to this post by Pierce Ng-2


Hi!

I can't get this to work on FreeBSD 8.1... It's a fresh installation, nothing in /etc/make.conf

Here's the error:


"Makefile", line 270: warning: duplicate script for target "cogit.o" ignored
gcc -g -O2 -msse2 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0 -msse -DLSB_FIRST=1  -DHAVE_CONFIG_H  -DSQUEAK_BUILTIN_PLUGIN  -I/root/CogVM/unixbuild/bld -I/root/CogVM/unixbuild/bld -I/root/CogVM/platforms/unix/vm -I/root/CogVM/platforms/Cross/vm -I/root/CogVM/src/vm -I/root/CogVM/platforms/Cross/vm -I/root/CogVM/platforms/unix/vm -I/root/CogVM/src/vm   -I/root/CogVM/platforms/Cross/plugins/FilePlugin  -I/root/CogVM/platforms/unix/plugins/B3DAcceleratorPlugin  -I/root/CogVM/unixbuild/bld -I/root/CogVM/unixbuild/bld -I/root/CogVM/platforms/unix/vm -I/root/CogVM/platforms/Cross/vm -I/root/CogVM/src/vm -I/usr/local/include   -c -o gcc3x-cointerp.o /root/CogVM/src/vm/gcc3x-cointerp.c
/root/CogVM/src/vm/gcc3x-cointerp.c:978: error: conflicting types for 'readImageFromFileHeapSizeStartingAt'
/root/CogVM/platforms/Cross/vm/sq.h:480: error: previous declaration of 'readImageFromFileHeapSizeStartingAt' was here
/root/CogVM/src/vm/gcc3x-cointerp.c:1340: warning: initialization from incompatible pointer type
/root/CogVM/src/vm/gcc3x-cointerp.c:1471: warning: initialization from incompatible pointer type
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'interpret':
/root/CogVM/src/vm/gcc3x-cointerp.c:1886: warning: ignoring asm-specifier for non-static local variable 'currentBytecode'
/root/CogVM/src/vm/gcc3x-cointerp.c:1888: warning: ignoring asm-specifier for non-static local variable 'localIP'
/root/CogVM/src/vm/gcc3x-cointerp.c:1890: warning: ignoring asm-specifier for non-static local variable 'localSP'
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'addNewMethodToCache':
/root/CogVM/src/vm/gcc3x-cointerp.c:8733: warning: assignment from incompatible pointer type
/root/CogVM/src/vm/gcc3x-cointerp.c:8751: warning: assignment from incompatible pointer type
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'callbackEnter':
/root/CogVM/src/vm/gcc3x-cointerp.c:9488: warning: assignment discards qualifiers from pointer target type
/root/CogVM/src/vm/gcc3x-cointerp.c:9489: warning: assignment discards qualifiers from pointer target type
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'highBit':
/root/CogVM/src/vm/gcc3x-cointerp.c:16134: warning: left shift count >= width of type
/root/CogVM/src/vm/gcc3x-cointerp.c:16135: warning: right shift count >= width of type
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'primitiveGetLogDirectory':
/root/CogVM/src/vm/gcc3x-cointerp.c:28104: warning: assignment makes pointer from integer without a cast
/root/CogVM/src/vm/gcc3x-cointerp.c: In function 'primitiveGetWindowLabel':
/root/CogVM/src/vm/gcc3x-cointerp.c:28223: warning: assignment makes pointer from integer without a cast
/root/CogVM/src/vm/gcc3x-cointerp.c: At top level:
/root/CogVM/src/vm/gcc3x-cointerp.c:37962: error: conflicting types for 'readImageFromFileHeapSizeStartingAt'
/root/CogVM/platforms/Cross/vm/sq.h:480: error: previous declaration of 'readImageFromFileHeapSizeStartingAt' was here
*** Error code 1

Stop in /root/CogVM/unixbuild/bld/vm.
*** Error code 1

Stop in /root/CogVM/unixbuild/bld.



Thanks,
Amir



--- In [hidden email], Pierce Ng <pierce@...> wrote:
>
> Hi,
>
> Here's how to build the Cog VM on FreeBSD.
> ...


Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Frank Shearar
On 2010/12/06 08:04, fractallyte wrote:
>
>
> Hi!
>
> I can't get this to work on FreeBSD 8.1... It's a fresh installation, nothing in /etc/make.conf
>
> Here's the error:
>
>
<snip>

I'm really happy to see other FreeBSDers out in the community! Would you
mind reposting this to vm-dev though?

frank

Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Igor Stasenko
On 6 December 2010 10:54, Frank Shearar <[hidden email]> wrote:

> On 2010/12/06 08:04, fractallyte wrote:
>>
>>
>> Hi!
>>
>> I can't get this to work on FreeBSD 8.1... It's a fresh installation,
>> nothing in /etc/make.conf
>>
>> Here's the error:
>>
>>
> <snip>
>
> I'm really happy to see other FreeBSDers out in the community! Would you
> mind reposting this to vm-dev though?
>


+1
i love FreeBSD. It was a first unix system i begun working with more
than 10 years ago.

Do not hesitate to ask about anything on vm-dev or squeak-dev.

> frank
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Building CogVM on FreeBSD

Amir Ansari


Thanks, I've just signed up to vm-dev...

I've been running FreeBSD on my servers for a while, but now I'm trying it on my laptop.  The switchover (from Gentoo) has been fairly smooth, EXCEPT for my essential Smalltalk environment.  Unfortunately, I've had no luck with the latest squeakvm or cogvm!

Amir