[Vm-dev] Compiling Interpreter VM on FreeBSD

Frank Shearar frank.shearar at gmail.com
Wed Jan 2 22:16:53 UTC 2013


On 2 January 2013 21:05, Frank Shearar <frank.shearar at gmail.com> wrote:
> On 2 January 2013 20:37, Frank Shearar <frank.shearar at gmail.com> wrote:
>> On 2 January 2013 20:33, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>>
>>> Hi Frank,
>>>
>>>     I *think* this is fixed in the Cog branch.  If you have time and could compile the Cog version I'd appreciate it.  The fix would then be just to copy the Cog version across.
>>
>> Thanks, Eliot. I was setting up a Cog-on-fbsd CI job while I waited,
>> so hopefully I can get back to you soon!
>
> What I'm doing on the Cog side is the same as I'm doing for the
> Interpreter: grab the latest bleeding edge tarball [1], untar it, cd
> platforms/unix && make. That, on Cog, fails with this:
>
> checking sanity of generated src directory... bad
> missing file: /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/bld/plugins.int
> *** Error code 1
>
> Ah, but I see there's a unixbuild directory. Following the HowToBuild
> instructions lets me configure a VM, and when compiling I hit a
> _different_ error.
>
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:62:23:
> error: execinfo.h: No such file or directory
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:823:3:
> error: #error need to implement extracting pc from a ucontext_t on
> this system
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:
> In function 'reportStackState':
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:827:
> error: 'fp' undeclared (first use in this function)
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:827:
> error: (Each undeclared identifier is reported only once
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:827:
> error: for each function it appears in.)
> /usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:827:
> error: 'sp' undeclared (first use in this function)
> *** Error code 1
>
> That is likely because while there's a # elif __FreeBSD__ && __i386__
> clause, this is an amd64 machine I'm compiling on. Dang.

Adding this to sqUnixMain.c:

# elif __FreeBSD__ && __x86_64__
                        void *fp = (void *)(uap ? uap->uc_mcontext.mc_rbp: 0);
	                void *sp = (void *)(uap ? uap->uc_mcontext.mc_rsp: 0);

and installing devel/libexecinfo to get execinfo.h gets me further:

/usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixITimerHeartbeat.c:168:3:
error: #error "no high res clock defined". So, adding this to
sqUnixITimerHeartbeat.c:

#elif defined(__GNUC__)	&& defined(__x86_64__)
    // From http://sci.tuomastonteri.fi/programming/cplus/x86timer
    uint32_t lo, hi;
    /* We cannot use "=A", since this would use %rax on x86_64 */
    __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
    return (uint64_t)hi << 32 | lo;

I can get a whole lot further. Far enough to hit this:

vm/vm.a(sqUnixMain.o)(.text+0x2481): In function `reportStackState':
/usr/home/frank/temp/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src/platforms/unix/vm/sqUnixMain.c:799:
undefined reference to `backtrace'

which looks to be a linking error.

So that should mean that, in fact, the Cog branch _does_ have UUID
stuff working for FreeBSD?

frank

> It looks like this fails before the plugins get compiled, so I can't
> verify that the UUID stuff works on the Cog branch.
>
> frank
>
> [1] Right now that's
> http://squeakci.org/job/CogVM/lastSuccessfulBuild/artifact/Squeak-vm-unix-4.6.0-Cog-2646-unofficial-src-201301020322.tar.gz
>> frank
>>
>>> On Wed, Jan 2, 2013 at 11:22 AM, Frank Shearar <frank.shearar at gmail.com> wrote:
>>>>
>>>>
>>>> I'm setting up more CI jobs, this time to give FreeBSD some love. So I
>>>> have a script that gets the bleeding edge Interpreter source, cd
>>>> platform/unix; make. The results are here:
>>>> http://squeakci.org/job/InterpreterVM-FreeBSD/13/console
>>>>
>>>> The punchline is that compilation fails thusly:
>>>>
>>>> In file included from
>>>> /usr/home/frank/temp/jenkins/workspace/InterpreterVM-FreeBSD/target/Squeak-vm-unix-4.10.7-2646-unofficial-src/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c:9:
>>>> /usr/local/include/uuid/uuid.h:44: error: conflicting types for 'uuid_t'
>>>> /usr/include/sys/uuid.h:74: error: previous declaration of 'uuid_t' was here
>>>> /usr/home/frank/temp/jenkins/workspace/InterpreterVM-FreeBSD/target/Squeak-vm-unix-4.10.7-2646-unofficial-src/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c:
>>>> In function 'MakeUUID':
>>>> /usr/home/frank/temp/jenkins/workspace/InterpreterVM-FreeBSD/target/Squeak-vm-unix-4.10.7-2646-unofficial-src/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c:29:
>>>> warning: passing argument 1 of 'uuidgen' from incompatible pointer
>>>>
>>>> The relevant source is here:
>>>>
>>>>
>>>> int MakeUUID(char *location)
>>>> {
>>>> #if defined(HAVE_UUID_CREATE) && !defined(HAVE_UUIDGEN) &&
>>>> !defined(HAVE_UUID_GENERATE)
>>>>   size_t  len= 16;      /* 128 bits */
>>>>   uuid_t *uuid;
>>>>   uuid_create(&uuid);
>>>>   uuid_make(uuid, UUID_MAKE_V1);
>>>>   uuid_export(uuid, UUID_FMT_BIN, (void **)&location, &len);
>>>>   uuid_destroy(uuid);
>>>> #else
>>>>   uuid_t uuid;
>>>> #  if defined(HAVE_UUIDGEN)
>>>>   uuidgen(&uuid, 1);   // <-- this is line 29, the offender
>>>> #  elif defined(HAVE_UUID_GENERATE)
>>>>   uuid_generate(uuid);
>>>> #  endif
>>>>   memcpy((void *)location, (void *)&uuid, sizeof(uuid));
>>>> #endif
>>>>   return 1;
>>>> }
>>>>
>>>> Any ideas? I'm happy to do legwork, but Bozhe moi! This I know from nothing!
>>>>
>>>> frank
>>>
>>>
>>>
>>>
>>> --
>>> best,
>>> Eliot
>>>


More information about the Vm-dev mailing list