[Vm-dev] Cog on linux

Eliot Miranda eliot.miranda at gmail.com
Fri Jul 16 01:04:25 UTC 2010


On Thu, Jul 15, 2010 at 4:49 PM, Rob Withers <reefedjib at yahoo.com> wrote:

>
>  I get the following:
>
> vawhigso at vawhigs.org [~/public_html/squeakelib/Cog]# gcc -m32 -E -dM
> platforms/Cross/vm/sqMemoryFence.h | egrep "86|GNUC"
> #define __GNUC_PATCHLEVEL__ 2
> #define __GNUC__ 4
> #define __DBL_MAX__ 1.7976931348623157e+308
> #define __i386 1
> #define i386 1
> #define __i386__ 1
> #define __GNUC_RH_RELEASE__ 48
> #define __GNUC_MINOR__ 1
> #define __GNUC_GNU_INLINE__ 1
>
> vawhigso at vawhigs.org [~/public_html/squeakelib/Cog]# gcc -m64 -E -dM
> platforms/Cross/vm/sqMemoryFence.h | egrep "86|GNUC"
> #define __GNUC__ 4
> #define __DBL_MAX__ 1.7976931348623157e+308
> #define __x86_64 1
> #define __GNUC_RH_RELEASE__ 48
> #define __x86_64__ 1
> #define __GNUC_PATCHLEVEL__ 2
> #define __GNUC_MINOR__ 1
> #define __GNUC_GNU_INLINE__ 1
> It looks like I match the incantation, as both 32 and 64.  Not sure what to
> change.
>

You need to figure out why, when sqMemoryFence.h is included by
sqExternalSemaphores.c and sqTicker.c, the following macro in
sqMemoryFence.h is not being defined or not being expanded:

#if defined(__GNUC__) && (defined(i386) || defined(__i386) ||
defined(__i386__) || defined(_X86_))
# if defined(__MINGW32__) && !__SSE2__
    /* Andreas is fond of the gcc 2.95 MINGW but it lacks sse2 support */
#   define sqLowLevelMFence() asm volatile (".byte 0x0f;.byte 0xae;.byte
0xf0")
# else
#   define sqLowLevelMFence() asm volatile ("mfence")
# endif
#else
# if !defined(sqLowLevelMFence)
extern void sqLowLevelMFence(void);
# endif
#endif

i.e. from the above
#   define sqLowLevelMFence() asm volatile ("mfence")
should be live and hence in sqExternalSemaphores.c and
sqTicker.c sqLowLevelMFence() should expand to asm volatile ("mfence").

gcc -E or gcc -P will run the preprocessor, so run the make capturing the
compile commands for these two and retry the command deleting -c thefile and
adding -E.  Then look at the output and see what files are included (is
sqMemoryFence.h being included?) and then if it is find out why, if as the
-dM output above indicates, the macro isn't being defined given the above
tests for both __GNUC__ and __i386__.

HTH
Eliot


> Rob
>
>  *From:* Eliot Miranda <eliot.miranda at gmail.com>
> *Sent:* Thursday, July 15, 2010 6:27 PM
> *To:* Squeak Virtual Machine Development Discussion<vm-dev at lists.squeakfoundation.org>
> *Subject:* Re: [Vm-dev] Cog on linux
>
>  ------------------------------
>
>
>
> On Thu, Jul 15, 2010 at 2:54 PM, Rob Withers <reefedjib at yahoo.com> wrote:
>
>>
>> (I am having trouble quoting Eliot's email as well.  Plain text is best)
>>
>
> OK.
>
>
>
>>
>> I finally figured out how to specify to configure to use -m32 on the
>> CFLAGS entries.  It is a part of the invocation of configure.
>>
>> ../../platforms/unix/config/configure CFLAGS="-m32 -g -O2 -msse2
>> -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0"
>> LIBS=-lpthread
>>
>> I seem to have gotten past the problem with sqUnixHeartbeat.c and now I
>> have a new problem:
>>
>> vm/vm.a(sqExternalSemaphores.o): In function `doSignalExternalSemaphores':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:198:
>> undefined reference to `sqLowLevelMFence'
>>
>
> gcc -E -dM should print predefined macros.  e.g.
>
>  McStalker.oscogvm$ gcc -m32 -E -dM platforms/Cross/vm/sqMemoryFence.h |
> egrep "86|GNUC"
> #define __GNUC__ 4
> #define __DBL_MAX__ 1.7976931348623157e+308
> #define __i386 1
> #define i386 1
> #define __i386__ 1
> #define __GNUC_PATCHLEVEL__ 1
> #define __GNUC_MINOR__ 2
> #define __GNUC_GNU_INLINE__ 1
> McStalker.oscogvm$ gcc -m64 -E -dM platforms/Cross/vm/sqMemoryFence.h |
> egrep "86|GNUC"
> #define __GNUC__ 4
> #define __DBL_MAX__ 1.7976931348623157e+308
> #define __x86_64 1
> #define __x86_64__ 1
> #define __GNUC_PATCHLEVEL__ 1
> #define __GNUC_MINOR__ 2
> #define __GNUC_GNU_INLINE__ 1
>
> You'll then see what names are given to define x86/IA32 on your system.
>  You can then edit the following incantation to include your configuration
> (and let me know what it is).
>
>  #if defined(__GNUC__) && (defined(i386) || defined(__i386) ||
> defined(__i386__) || defined(_X86_))
>
> HTH
> Eliot
>
> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:213:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:184:
>> undefined reference to `sqLowLevelMFence'
>> vm/vm.a(sqExternalSemaphores.o): In function `signalSemaphoreWithIndex':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:130:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:131:
>> undefined reference to `sqAtomicAddConst'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:147:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:148:
>> undefined reference to `sqCompareAndSwap'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:152:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:153:
>> undefined reference to `sqCompareAndSwap'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:135:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:136:
>> undefined reference to `sqCompareAndSwap'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:140:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqExternalSemaphores.c:141:
>> undefined reference to `sqCompareAndSwap'
>> vm/vm.a(sqTicker.o): In function `checkHighPriorityTickees':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:211:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:217:
>> undefined reference to `sqCompareAndSwapRes'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:227:
>> undefined reference to `sqLowLevelMFence'
>> vm/vm.a(sqTicker.o): In function `addHighPriorityTickee':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:185:
>> undefined reference to `sqLowLevelMFence'
>> vm/vm.a(sqTicker.o): In function `ioSynchronousCheckForEvents':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:128:
>> undefined reference to `sqLowLevelMFence'
>> vm/vm.a(sqTicker.o): In function `addHighPriorityTickee':
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:193:
>> undefined reference to `sqLowLevelMFence'
>> /home1/vawhigso/public_html/squeakelib/Cog/platforms/Cross/vm/sqTicker.c:193:
>> undefined reference to `sqLowLevelMFence'
>> collect2: ld returned 1 exit status
>> make: *** [squeak] Error 1
>>
>>
>> --------------------------------------------------
>> From: "Levente Uzonyi" <leves at elte.hu>
>> Sent: Thursday, July 15, 2010 3:38 PM
>> To: "Squeak Virtual Machine Development Discussion" <
>> vm-dev at lists.squeakfoundation.org>
>>
>> Subject: Re: [Vm-dev] Cog on linux
>>
>>
>>>  On Thu, 15 Jul 2010, Rob Withers wrote:
>>>
>>> (Pine is unable to quote your mail...)
>>>
>>> The question is: is your OS 32 or 64-bit? The CPU doesn't matter here. If
>>> your OS is 64-bit then you'll probably need the gcc-multilibs package (or
>>> equivalent for your platform) and as Eliot suggested the -m32 switch for
>>> compilation and linking. To run the resulting VM, you'll need the ia32-libs
>>> package (or equivalent for your platform), but you already have that if you
>>> can run the prebuilt SqueakVM.
>>>
>>>
>>> Levente
>>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100715/a61b6508/attachment-0001.htm


More information about the Vm-dev mailing list