[Vm-dev] Compiling Cog on FreeBSD

Frank Shearar frank.shearar at gmail.com
Thu Jan 10 21:40:01 UTC 2013


First, thanks Eliot for fixing up the UUID plugin.

With that fixed, the next error I get when compiling (32 bit) on
FreeBSD is this:

sqUnixMemory.c
/usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:
In function 'sqMakeMemoryExecutableFromTo':
/usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:298:
error: 'pageMask' undeclared (first use in this function)

The line number looks a bit wrong, because pageMask is in a #define on
line 293. (Ah, it's because line 298 uses the #define.) At any rate,
the relevant function + context looks like this:

#if COGVM
# define roundDownToPageBoundary(v) ((v)&pageMask)
# define roundUpToPageBoundary(v) (((v)+pageSize-1)&pageMask)
void
sqMakeMemoryExecutableFromTo(unsigned long startAddr, unsigned long endAddr)
{
        unsigned long firstPage = roundDownToPageBoundary(startAddr);
        if (mprotect((void *)firstPage,
                                 endAddr - firstPage + 1,
                                 PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
                perror("mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)");
}

void
sqMakeMemoryNotExecutableFromTo(unsigned long startAddr, unsigned long endAddr)
{
        unsigned long firstPage = roundDownToPageBoundary(startAddr);
        if (mprotect((void *)firstPage,
                                 endAddr - firstPage + 1,
                                 PROT_READ | PROT_WRITE) < 0)
                perror("mprotect(x,y,PROT_READ | PROT_WRITE)");
}
#endif /* COGVM */

A bit confusing, given that pageMask is declared on line 100, as
whatever C calls a top level form. A global?

What can I do to make things work?

The full ouput's viewable here: http://squeakci.org/job/CogVM-FreeBSD/13/console

frank


More information about the Vm-dev mailing list