Suspicious typing in Cog VM

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

Suspicious typing in Cog VM

Aleksej Saushev-2
 
  Hello!

Types are inconsistent along the source, does Cog VM work on LP64 platforms?

I need this to make it build on NetBSD/i386:

--- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig 2010-12-07 17:40:51.000000000 +0000
+++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
@@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
   return snd->snd_AvailableSpace();
 }
 
-int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
+sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
   return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
 }
 
-int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
 {
   return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
 }
@@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
   return snd->snd_GetRecordingSampleRate();
 }
 
-int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
+sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
 }
@@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
 
 void snd_Volume(double *left, double *right) { snd->snd_Volume(left, right); }
 void snd_SetVolume(double left, double right) { snd->snd_SetVolume(left, right); }
-int  snd_SetRecordLevel(int level) { return snd->snd_SetRecordLevel(level); }
+void snd_SetRecordLevel(sqInt level) { return snd->snd_SetRecordLevel(level); }
 int  snd_GetSwitch(int id, int captureFlag, int channel) { return snd->snd_GetSwitch(id, captureFlag, channel); }
 int  snd_SetSwitch(int id, int captureFlag, int parameter) { return snd->snd_SetSwitch(id, captureFlag, parameter); }
 int  snd_SetDevice(int id, char *name) { return snd->snd_SetDevice(id, name); }
--- src/vm/gcc3x-cointerp.c.orig 2010-12-07 18:00:09.000000000 +0000
+++ src/vm/gcc3x-cointerp.c
@@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
 sqInt rawHeaderOf(sqInt methodPointer);
 void rawHeaderOfput(sqInt methodOop, void *cogMethod);
 sqInt readableFormat(sqInt imageVersion);
-sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
+sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
 sqInt remap(sqInt oop);
 static sqInt removeFirstLinkOfList(sqInt aList);
 EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
@@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
  */
 
 sqInt
-readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
+readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
 DECL_MAYBE_SQ_GLOBAL_STRUCT
     sqInt anObject;
     sqInt aValue;



--
HE CE3OH...
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

David T. Lewis
 
On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
>  
>   Hello!
>
> Types are inconsistent along the source, does Cog VM work on LP64 platforms?

The README file at the root of the Cog distribution says this:

 The Cogit currently supports only x86 and the floating-point
 primitives and parts of the platform support code depend on SSE2.
 I hope members of the community will attempt to port it, e.g. to
 ARM, PowerPC and x86-64.

So no, you should not expect it to work on x86-64. But it should
work if you compile it in 32-bit mode on your x86-64 platform
(i.e. with "-m32" in the CFLAGS and LDFLAGS).

However, I have to admit that I have not yet been able to get
this working on my own 64-bit SuSE Linux box, due to issues
with libtool on my system. I've been assuming that this is a
problem with my Linux system, but I cannot say for sure.

Dave


>
> I need this to make it build on NetBSD/i386:
>
> --- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig 2010-12-07 17:40:51.000000000 +0000
> +++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
> @@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
>    return snd->snd_AvailableSpace();
>  }
>  
> -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
> +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
>  {
>    return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
>  }
>  
> -int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
> +sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
>  {
>    return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
>  }
> @@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
>    return snd->snd_GetRecordingSampleRate();
>  }
>  
> -int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
> +sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
>  {
>    return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
>  }
> @@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
>  
>  void snd_Volume(double *left, double *right) { snd->snd_Volume(left, right); }
>  void snd_SetVolume(double left, double right) { snd->snd_SetVolume(left, right); }
> -int  snd_SetRecordLevel(int level) { return snd->snd_SetRecordLevel(level); }
> +void snd_SetRecordLevel(sqInt level) { return snd->snd_SetRecordLevel(level); }
>  int  snd_GetSwitch(int id, int captureFlag, int channel) { return snd->snd_GetSwitch(id, captureFlag, channel); }
>  int  snd_SetSwitch(int id, int captureFlag, int parameter) { return snd->snd_SetSwitch(id, captureFlag, parameter); }
>  int  snd_SetDevice(int id, char *name) { return snd->snd_SetDevice(id, name); }
> --- src/vm/gcc3x-cointerp.c.orig 2010-12-07 18:00:09.000000000 +0000
> +++ src/vm/gcc3x-cointerp.c
> @@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
>  sqInt rawHeaderOf(sqInt methodPointer);
>  void rawHeaderOfput(sqInt methodOop, void *cogMethod);
>  sqInt readableFormat(sqInt imageVersion);
> -sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
> +sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
>  sqInt remap(sqInt oop);
>  static sqInt removeFirstLinkOfList(sqInt aList);
>  EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
> @@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
>   */
>  
>  sqInt
> -readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
> +readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>  DECL_MAYBE_SQ_GLOBAL_STRUCT
>      sqInt anObject;
>      sqInt aValue;
>
>
>
> --
> HE CE3OH...
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Levente Uzonyi-2
 
On Wed, 8 Dec 2010, David T. Lewis wrote:

>
> On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
>>
>>   Hello!
>>
>> Types are inconsistent along the source, does Cog VM work on LP64 platforms?
>
> The README file at the root of the Cog distribution says this:
>
> The Cogit currently supports only x86 and the floating-point
> primitives and parts of the platform support code depend on SSE2.
> I hope members of the community will attempt to port it, e.g. to
> ARM, PowerPC and x86-64.
>
> So no, you should not expect it to work on x86-64. But it should
> work if you compile it in 32-bit mode on your x86-64 platform
> (i.e. with "-m32" in the CFLAGS and LDFLAGS).
>
> However, I have to admit that I have not yet been able to get
> this working on my own 64-bit SuSE Linux box, due to issues
> with libtool on my system. I've been assuming that this is a
> problem with my Linux system, but I cannot say for sure.

IIRC this is a problem on all 64-bit linux platforms. The trick is to add
-m32 to CC instead of CFLAGS (CC="gcc -m32").


Levente

>
> Dave
>
>
>>
>> I need this to make it build on NetBSD/i386:
>>
>> --- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig 2010-12-07 17:40:51.000000000 +0000
>> +++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
>> @@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
>>    return snd->snd_AvailableSpace();
>>  }
>>
>> -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
>> +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
>>  {
>>    return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
>>  }
>>
>> -int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
>> +sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
>>  {
>>    return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
>>  }
>> @@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
>>    return snd->snd_GetRecordingSampleRate();
>>  }
>>
>> -int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
>> +sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
>>  {
>>    return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
>>  }
>> @@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
>>
>>  void snd_Volume(double *left, double *right) { snd->snd_Volume(left, right); }
>>  void snd_SetVolume(double left, double right) { snd->snd_SetVolume(left, right); }
>> -int  snd_SetRecordLevel(int level) { return snd->snd_SetRecordLevel(level); }
>> +void snd_SetRecordLevel(sqInt level) { return snd->snd_SetRecordLevel(level); }
>>  int  snd_GetSwitch(int id, int captureFlag, int channel) { return snd->snd_GetSwitch(id, captureFlag, channel); }
>>  int  snd_SetSwitch(int id, int captureFlag, int parameter) { return snd->snd_SetSwitch(id, captureFlag, parameter); }
>>  int  snd_SetDevice(int id, char *name) { return snd->snd_SetDevice(id, name); }
>> --- src/vm/gcc3x-cointerp.c.orig 2010-12-07 18:00:09.000000000 +0000
>> +++ src/vm/gcc3x-cointerp.c
>> @@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
>>  sqInt rawHeaderOf(sqInt methodPointer);
>>  void rawHeaderOfput(sqInt methodOop, void *cogMethod);
>>  sqInt readableFormat(sqInt imageVersion);
>> -sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
>> +sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
>>  sqInt remap(sqInt oop);
>>  static sqInt removeFirstLinkOfList(sqInt aList);
>>  EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
>> @@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
>>   */
>>
>>  sqInt
>> -readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>> +readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>>  DECL_MAYBE_SQ_GLOBAL_STRUCT
>>      sqInt anObject;
>>      sqInt aValue;
>>
>>
>>
>> --
>> HE CE3OH...
>
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

David T. Lewis
 
On Wed, Dec 08, 2010 at 01:57:45PM +0100, Levente Uzonyi wrote:

>
> On Wed, 8 Dec 2010, David T. Lewis wrote:
>
> >
> >On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
> >>
> >>  Hello!
> >>
> >>Types are inconsistent along the source, does Cog VM work on LP64
> >>platforms?
> >
> >The README file at the root of the Cog distribution says this:
> >
> >The Cogit currently supports only x86 and the floating-point
> >primitives and parts of the platform support code depend on SSE2.
> >I hope members of the community will attempt to port it, e.g. to
> >ARM, PowerPC and x86-64.
> >
> >So no, you should not expect it to work on x86-64. But it should
> >work if you compile it in 32-bit mode on your x86-64 platform
> >(i.e. with "-m32" in the CFLAGS and LDFLAGS).
> >
> >However, I have to admit that I have not yet been able to get
> >this working on my own 64-bit SuSE Linux box, due to issues
> >with libtool on my system. I've been assuming that this is a
> >problem with my Linux system, but I cannot say for sure.
>
> IIRC this is a problem on all 64-bit linux platforms. The trick is to add
> -m32 to CC instead of CFLAGS (CC="gcc -m32").


Levente,

Thank you! The CC="gcc -m32" trick is exactly what I was looking for,
and I can now get a successful build.

Aleksej,

You should be able to do the same thing on FreeBSD, although the
specifics of compiling 32-bit programs on 64-bit might be different.

FWIW, the configure command that I used is:

  ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
  -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
  -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Frank Shearar
 
On 2010/12/08 13:14, David T. Lewis wrote:

>
> On Wed, Dec 08, 2010 at 01:57:45PM +0100, Levente Uzonyi wrote:
>>
>> On Wed, 8 Dec 2010, David T. Lewis wrote:
>>
>>>
>>> On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
>>>>
>>>>   Hello!
>>>>
>>>> Types are inconsistent along the source, does Cog VM work on LP64
>>>> platforms?
>>>
>>> The README file at the root of the Cog distribution says this:
>>>
>>> The Cogit currently supports only x86 and the floating-point
>>> primitives and parts of the platform support code depend on SSE2.
>>> I hope members of the community will attempt to port it, e.g. to
>>> ARM, PowerPC and x86-64.
>>>
>>> So no, you should not expect it to work on x86-64. But it should
>>> work if you compile it in 32-bit mode on your x86-64 platform
>>> (i.e. with "-m32" in the CFLAGS and LDFLAGS).
>>>
>>> However, I have to admit that I have not yet been able to get
>>> this working on my own 64-bit SuSE Linux box, due to issues
>>> with libtool on my system. I've been assuming that this is a
>>> problem with my Linux system, but I cannot say for sure.
>>
>> IIRC this is a problem on all 64-bit linux platforms. The trick is to add
>> -m32 to CC instead of CFLAGS (CC="gcc -m32").
>
>
> Levente,
>
> Thank you! The CC="gcc -m32" trick is exactly what I was looking for,
> and I can now get a successful build.
>
> Aleksej,
>
> You should be able to do the same thing on FreeBSD, although the
> specifics of compiling 32-bit programs on 64-bit might be different.
>
> FWIW, the configure command that I used is:
>
>    ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
>    -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
>    -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread

I'm getting (on FreeBSD 7.3, gcc 4.2.1) configure failing with "C
compiler cannot create executables", and config.log talking of "exit 77".

frank
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Levente Uzonyi-2
 
On Wed, 8 Dec 2010, Frank Shearar wrote:

>
> On 2010/12/08 13:14, David T. Lewis wrote:
>>
>> On Wed, Dec 08, 2010 at 01:57:45PM +0100, Levente Uzonyi wrote:
>>>
>>> On Wed, 8 Dec 2010, David T. Lewis wrote:
>>>
>>>>
>>>> On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
>>>>>
>>>>>   Hello!
>>>>>
>>>>> Types are inconsistent along the source, does Cog VM work on LP64
>>>>> platforms?
>>>>
>>>> The README file at the root of the Cog distribution says this:
>>>>
>>>> The Cogit currently supports only x86 and the floating-point
>>>> primitives and parts of the platform support code depend on SSE2.
>>>> I hope members of the community will attempt to port it, e.g. to
>>>> ARM, PowerPC and x86-64.
>>>>
>>>> So no, you should not expect it to work on x86-64. But it should
>>>> work if you compile it in 32-bit mode on your x86-64 platform
>>>> (i.e. with "-m32" in the CFLAGS and LDFLAGS).
>>>>
>>>> However, I have to admit that I have not yet been able to get
>>>> this working on my own 64-bit SuSE Linux box, due to issues
>>>> with libtool on my system. I've been assuming that this is a
>>>> problem with my Linux system, but I cannot say for sure.
>>>
>>> IIRC this is a problem on all 64-bit linux platforms. The trick is to add
>>> -m32 to CC instead of CFLAGS (CC="gcc -m32").
>>
>>
>> Levente,
>>
>> Thank you! The CC="gcc -m32" trick is exactly what I was looking for,
>> and I can now get a successful build.
>>
>> Aleksej,
>>
>> You should be able to do the same thing on FreeBSD, although the
>> specifics of compiling 32-bit programs on 64-bit might be different.
>>
>> FWIW, the configure command that I used is:
>>
>>    ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
>>    -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
>>    -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
>
> I'm getting (on FreeBSD 7.3, gcc 4.2.1) configure failing with "C compiler
> cannot create executables", and config.log talking of "exit 77".

You have to make sure that your gcc supports the compilation of 32-bit
binaries. On debian this is achieved by loading the gcc-multilib package.


Levente

>
> frank
>
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Eliot Miranda-2
In reply to this post by Aleksej Saushev-2
 


On Wed, Dec 8, 2010 at 12:30 AM, Aleksej Saushev <[hidden email]> wrote:

 Hello!

Types are inconsistent along the source, does Cog VM work on LP64 platforms?

Absolutely not.  It /must/ be built using a 32-bit model.  I have made no attempt to get it to compile clean under a 64-bit model.
 

I need this to make it build on NetBSD/i386:

--- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig       2010-12-07 17:40:51.000000000 +0000
+++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
@@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
  return snd->snd_AvailableSpace();
 }

-int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
+sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
  return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
 }

-int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
 {
  return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
 }
@@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
  return snd->snd_GetRecordingSampleRate();
 }

-int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
+sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
  return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
 }
@@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu

 void snd_Volume(double *left, double *right)                   {        snd->snd_Volume(left, right); }
 void snd_SetVolume(double left, double right)                  {        snd->snd_SetVolume(left, right); }
-int  snd_SetRecordLevel(int level)                             { return snd->snd_SetRecordLevel(level); }
+void snd_SetRecordLevel(sqInt level)                           { return snd->snd_SetRecordLevel(level); }
 int  snd_GetSwitch(int id, int captureFlag, int channel)       { return snd->snd_GetSwitch(id, captureFlag, channel); }
 int  snd_SetSwitch(int id, int captureFlag, int parameter)     { return snd->snd_SetSwitch(id, captureFlag, parameter); }
 int  snd_SetDevice(int id, char *name)                         { return snd->snd_SetDevice(id, name); }
--- src/vm/gcc3x-cointerp.c.orig        2010-12-07 18:00:09.000000000 +0000
+++ src/vm/gcc3x-cointerp.c
@@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
 sqInt rawHeaderOf(sqInt methodPointer);
 void rawHeaderOfput(sqInt methodOop, void *cogMethod);
 sqInt readableFormat(sqInt imageVersion);
-sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
+sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
 sqInt remap(sqInt oop);
 static sqInt removeFirstLinkOfList(sqInt aList);
 EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
@@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
 */

 sqInt
-readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
+readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
 DECL_MAYBE_SQ_GLOBAL_STRUCT
    sqInt anObject;
    sqInt aValue;



--
HE CE3OH...

Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Eliot Miranda-2
In reply to this post by Aleksej Saushev-2
 


On Wed, Dec 8, 2010 at 12:30 AM, Aleksej Saushev <[hidden email]> wrote:

 Hello!

Types are inconsistent along the source, does Cog VM work on LP64 platforms?

Please read unixbuild/HowToBuild:

3d. If you're building the VM on a 64-bit OS, you'll need a compiler which can
compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
You'll also have to add the -m32 switch to all gcc & g++ invocations.  The
easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
script:
     ../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0" LIBS=-lpthread
To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
provided by the ia32-libs package.


According to Paul DeBruicker  the following packages need to be installed to
compile in 32-bt mode on 64-bit ubuntu.  YMMV.

lib32asound2-dev
libgl1-mesa-dev
libglu1-mesa-dev
build-essential
ia32-libs
gcc-multilib
g++multilib
 

I need this to make it build on NetBSD/i386:

--- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig       2010-12-07 17:40:51.000000000 +0000
+++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
@@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
  return snd->snd_AvailableSpace();
 }

-int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
+sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
  return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
 }

-int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
 {
  return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
 }
@@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
  return snd->snd_GetRecordingSampleRate();
 }

-int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
+sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
  return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
 }
@@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu

 void snd_Volume(double *left, double *right)                   {        snd->snd_Volume(left, right); }
 void snd_SetVolume(double left, double right)                  {        snd->snd_SetVolume(left, right); }
-int  snd_SetRecordLevel(int level)                             { return snd->snd_SetRecordLevel(level); }
+void snd_SetRecordLevel(sqInt level)                           { return snd->snd_SetRecordLevel(level); }
 int  snd_GetSwitch(int id, int captureFlag, int channel)       { return snd->snd_GetSwitch(id, captureFlag, channel); }
 int  snd_SetSwitch(int id, int captureFlag, int parameter)     { return snd->snd_SetSwitch(id, captureFlag, parameter); }
 int  snd_SetDevice(int id, char *name)                         { return snd->snd_SetDevice(id, name); }
--- src/vm/gcc3x-cointerp.c.orig        2010-12-07 18:00:09.000000000 +0000
+++ src/vm/gcc3x-cointerp.c
@@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
 sqInt rawHeaderOf(sqInt methodPointer);
 void rawHeaderOfput(sqInt methodOop, void *cogMethod);
 sqInt readableFormat(sqInt imageVersion);
-sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
+sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
 sqInt remap(sqInt oop);
 static sqInt removeFirstLinkOfList(sqInt aList);
 EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
@@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
 */

 sqInt
-readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
+readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
 DECL_MAYBE_SQ_GLOBAL_STRUCT
    sqInt anObject;
    sqInt aValue;



--
HE CE3OH...

Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Aleksej Saushev-2

Eliot Miranda <[hidden email]> writes:

>  On Wed, Dec 8, 2010 at 12:30 AM, Aleksej Saushev <[hidden email]> wrote:
>
>      Hello!
>    
>     Types are inconsistent along the source, does Cog VM work on LP64 platforms?
>
> Please read unixbuild/HowToBuild:
>
> 3d. If you're building the VM on a 64-bit OS, you'll need a compiler which can
> compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
> provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
> You'll also have to add the -m32 switch to all gcc & g++ invocations.  The
> easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
> script:
>      ../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG
> -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0" LIBS=-lpthread
> To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
> provided by the ia32-libs package.
>
> According to Paul DeBruicker  the following packages need to be installed to
> compile in 32-bt mode on 64-bit ubuntu.  YMMV.

Perhaps I'm not clear enough. These changes are not an attempt to fix 64-bit build,
it is an attempt to fix _32-bit_ build. Functions don't match their prototypes,
and my builds (on NetBSD/i386) end with this kind of diagnostics:

/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:103: error: conflicting types for 'snd_InsertSamplesFromLeadTime'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:9: error: previous declaration of 'snd_InsertSamplesFromLeadTime' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:108: error: conflicting types for 'snd_PlaySamplesFromAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:10: error: previous declaration of 'snd_PlaySamplesFromAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:145: error: conflicting types for 'snd_RecordSamplesIntoAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:20: error: previous declaration of 'snd_RecordSamplesIntoAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:153: error: conflicting types for 'snd_SetRecordLevel'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:16: error: previous declaration of 'snd_SetRecordLevel' was here

That is, without these changes the build doesn't even finish (resultant
binary crashes on any image I tried: Pharo 1.0, Pharo 1.1.1, but that's
another half of the story). My point is that something is going wrong,
since the code lacks internal consistency (and I don't know what to
assign further crashes to). Since you know the code much better than me,
could you take a look?

>     I need this to make it build on NetBSD/i386:
>    
>     --- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig       2010-12-07 17:40:51.000000000 +0000
>     +++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
>     @@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
>       return snd->snd_AvailableSpace();
>      }
>    
>     -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
>     +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
>      {
>       return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
>      }
>    
>     -int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
>     +sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
>      {
>       return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
>      }
>     @@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
>       return snd->snd_GetRecordingSampleRate();
>      }
>    
>     -int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
>     +sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
>      {
>       return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
>      }
>     @@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
>    
>      void snd_Volume(double *left, double *right)                   {        snd->snd_Volume(left, right); }
>      void snd_SetVolume(double left, double right)                  {        snd->snd_SetVolume(left, right); }
>     -int  snd_SetRecordLevel(int level)                             { return snd->snd_SetRecordLevel(level); }
>     +void snd_SetRecordLevel(sqInt level)                           { return snd->snd_SetRecordLevel(level); }
>      int  snd_GetSwitch(int id, int captureFlag, int channel)       { return snd->snd_GetSwitch(id, captureFlag, channel); }
>      int  snd_SetSwitch(int id, int captureFlag, int parameter)     { return snd->snd_SetSwitch(id, captureFlag, parameter); }
>      int  snd_SetDevice(int id, char *name)                         { return snd->snd_SetDevice(id, name); }
>     --- src/vm/gcc3x-cointerp.c.orig        2010-12-07 18:00:09.000000000 +0000
>     +++ src/vm/gcc3x-cointerp.c
>     @@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
>      sqInt rawHeaderOf(sqInt methodPointer);
>      void rawHeaderOfput(sqInt methodOop, void *cogMethod);
>      sqInt readableFormat(sqInt imageVersion);
>     -sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
>     +sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
>      sqInt remap(sqInt oop);
>      static sqInt removeFirstLinkOfList(sqInt aList);
>      EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
>     @@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
>      */
>    
>      sqInt
>     -readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>     +readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>      DECL_MAYBE_SQ_GLOBAL_STRUCT
>         sqInt anObject;
>         sqInt aValue;


--
HE CE3OH...
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Eliot Miranda-2
 


2010/12/8 Aleksej Saushev <[hidden email]>

Eliot Miranda <[hidden email]> writes:

>  On Wed, Dec 8, 2010 at 12:30 AM, Aleksej Saushev <[hidden email]> wrote:
>
>      Hello!
>
>     Types are inconsistent along the source, does Cog VM work on LP64 platforms?
>
> Please read unixbuild/HowToBuild:
>
> 3d. If you're building the VM on a 64-bit OS, you'll need a compiler which can
> compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
> provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
> You'll also have to add the -m32 switch to all gcc & g++ invocations.  The
> easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
> script:
>      ../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG
> -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0" LIBS=-lpthread
> To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
> provided by the ia32-libs package.
>
> According to Paul DeBruicker  the following packages need to be installed to
> compile in 32-bt mode on 64-bit ubuntu.  YMMV.

Perhaps I'm not clear enough. These changes are not an attempt to fix 64-bit build,
it is an attempt to fix _32-bit_ build. Functions don't match their prototypes,
and my builds (on NetBSD/i386) end with this kind of diagnostics:

/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:103: error: conflicting types for 'snd_InsertSamplesFromLeadTime'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:9: error: previous declaration of 'snd_InsertSamplesFromLeadTime' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:108: error: conflicting types for 'snd_PlaySamplesFromAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:10: error: previous declaration of 'snd_PlaySamplesFromAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:145: error: conflicting types for 'snd_RecordSamplesIntoAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:20: error: previous declaration of 'snd_RecordSamplesIntoAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:153: error: conflicting types for 'snd_SetRecordLevel'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:16: error: previous declaration of 'snd_SetRecordLevel' was here

That's a different issue.  John McIntosh made some changes to these prototypes for the iPhone platform.  I haven't had time to fix the Carbon platform build that these changes broke. Apologies.


That is, without these changes the build doesn't even finish (resultant
binary crashes on any image I tried: Pharo 1.0, Pharo 1.1.1, but that's
another half of the story). My point is that something is going wrong,
since the code lacks internal consistency (and I don't know what to
assign further crashes to). Since you know the code much better than me,
could you take a look?

>     I need this to make it build on NetBSD/i386:
>
>     --- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig       2010-12-07 17:40:51.000000000 +0000
>     +++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
>     @@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
>       return snd->snd_AvailableSpace();
>      }
>
>     -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
>     +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
>      {
>       return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
>      }
>
>     -int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
>     +sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
>      {
>       return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
>      }
>     @@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
>       return snd->snd_GetRecordingSampleRate();
>      }
>
>     -int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
>     +sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
>      {
>       return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
>      }
>     @@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
>
>      void snd_Volume(double *left, double *right)                   {        snd->snd_Volume(left, right); }
>      void snd_SetVolume(double left, double right)                  {        snd->snd_SetVolume(left, right); }
>     -int  snd_SetRecordLevel(int level)                             { return snd->snd_SetRecordLevel(level); }
>     +void snd_SetRecordLevel(sqInt level)                           { return snd->snd_SetRecordLevel(level); }
>      int  snd_GetSwitch(int id, int captureFlag, int channel)       { return snd->snd_GetSwitch(id, captureFlag, channel); }
>      int  snd_SetSwitch(int id, int captureFlag, int parameter)     { return snd->snd_SetSwitch(id, captureFlag, parameter); }
>      int  snd_SetDevice(int id, char *name)                         { return snd->snd_SetDevice(id, name); }
>     --- src/vm/gcc3x-cointerp.c.orig        2010-12-07 18:00:09.000000000 +0000
>     +++ src/vm/gcc3x-cointerp.c
>     @@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
>      sqInt rawHeaderOf(sqInt methodPointer);
>      void rawHeaderOfput(sqInt methodOop, void *cogMethod);
>      sqInt readableFormat(sqInt imageVersion);
>     -sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
>     +sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
>      sqInt remap(sqInt oop);
>      static sqInt removeFirstLinkOfList(sqInt aList);
>      EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
>     @@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
>      */
>
>      sqInt
>     -readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>     +readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>      DECL_MAYBE_SQ_GLOBAL_STRUCT
>         sqInt anObject;
>         sqInt aValue;


--
HE CE3OH...

Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Pierce Ng-2
In reply to this post by Frank Shearar
 
On Wed, Dec 08, 2010 at 02:32:35PM +0000, Frank Shearar wrote:
> >FWIW, the configure command that I used is:
> >
> >   ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
> >   -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
> >   -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
>
> I'm getting (on FreeBSD 7.3, gcc 4.2.1) configure failing with "C
> compiler cannot create executables", and config.log talking of "exit 77".

On FreeBSD you need to install the 32 bit libraries, which will go into
/usr/lib32. Then set CC="gcc -m32 -B/usr/lib32". However, it still doesn't
compile cleanly on 7.3 amd64: I get errors like these (that don't occur
when compiling on a 7.3 x86):

- pageMask undeclared (sqUnixMemory.c)
- PROT_READ undeclared (ditto)
- etc.

The other day I posted on how to compile Cog on 32bit FreeBSD. I left out
the parts about fixing type mismatches (int in .h and sqInt in .c, etc.)
because these need to be done on Linux and OSX (via unixbuild) as well, so
it didn't occur to me to mention them. Once you fix these, you should be
able to get Cog running on FreeBSD 7.3 x86.

HTH.


Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Pierce Ng-2
In reply to this post by Aleksej Saushev-2
 
On Wed, Dec 08, 2010 at 09:01:17PM +0300, Aleksej Saushev wrote:
> >     -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
> >     +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
> >     ?{
> >     ? return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
> >     ?}

Just try changing them - if the .h says sqInt, but .c says int, then change
the .c to match, ditto for int and void*.

I believe these can be fixed through VMMaker as well.

Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Frank Shearar
In reply to this post by Pierce Ng-2
 
On 2010/12/09 01:42, Pierce Ng wrote:

>
> On Wed, Dec 08, 2010 at 02:32:35PM +0000, Frank Shearar wrote:
>>> FWIW, the configure command that I used is:
>>>
>>>    ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
>>>    -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
>>>    -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
>>
>> I'm getting (on FreeBSD 7.3, gcc 4.2.1) configure failing with "C
>> compiler cannot create executables", and config.log talking of "exit 77".
>
> On FreeBSD you need to install the 32 bit libraries, which will go into
> /usr/lib32. Then set CC="gcc -m32 -B/usr/lib32". However, it still doesn't
> compile cleanly on 7.3 amd64: I get errors like these (that don't occur
> when compiling on a 7.3 x86):

Ah! -B/usr/lib32 did the trick!

>
> - pageMask undeclared (sqUnixMemory.c)
> - PROT_READ undeclared (ditto)
> - etc.
>
> The other day I posted on how to compile Cog on 32bit FreeBSD. I left out
> the parts about fixing type mismatches (int in .h and sqInt in .c, etc.)
> because these need to be done on Linux and OSX (via unixbuild) as well, so
> it didn't occur to me to mention them. Once you fix these, you should be
> able to get Cog running on FreeBSD 7.3 x86.
>
> HTH.

"etc" will include things like "conflicting types for
'readImageFromFileHeapSizeStartingAt'", yes?

So yes, right now I can configure, but can't compile.

I'll fiddle some more in the meanwhile. Thanks!

frank
Reply | Threaded
Open this post in threaded view
|

Re: Suspicious typing in Cog VM

Levente Uzonyi-2
 
On Thu, 9 Dec 2010, Frank Shearar wrote:

>
> On 2010/12/09 01:42, Pierce Ng wrote:
>>
>> On Wed, Dec 08, 2010 at 02:32:35PM +0000, Frank Shearar wrote:
>>>> FWIW, the configure command that I used is:
>>>>
>>>>    ../platforms/unix/config/configure CC="gcc -m32" CFLAGS="-g -O2 \
>>>>    -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 \
>>>>    -DCOGMTVM=0 -DDEBUGVM=0" LIBS=-lpthread
>>>
>>> I'm getting (on FreeBSD 7.3, gcc 4.2.1) configure failing with "C
>>> compiler cannot create executables", and config.log talking of "exit 77".
>>
>> On FreeBSD you need to install the 32 bit libraries, which will go into
>> /usr/lib32. Then set CC="gcc -m32 -B/usr/lib32". However, it still doesn't
>> compile cleanly on 7.3 amd64: I get errors like these (that don't occur
>> when compiling on a 7.3 x86):
>
> Ah! -B/usr/lib32 did the trick!
>
>>
>> - pageMask undeclared (sqUnixMemory.c)
>> - PROT_READ undeclared (ditto)
>> - etc.
>>
>> The other day I posted on how to compile Cog on 32bit FreeBSD. I left out
>> the parts about fixing type mismatches (int in .h and sqInt in .c, etc.)
>> because these need to be done on Linux and OSX (via unixbuild) as well, so
>> it didn't occur to me to mention them. Once you fix these, you should be
>> able to get Cog running on FreeBSD 7.3 x86.
>>
>> HTH.
>
> "etc" will include things like "conflicting types for
> 'readImageFromFileHeapSizeStartingAt'", yes?
>
> So yes, right now I can configure, but can't compile.

Generate the sources from VMMaker-oscog-Igor.Stasenko.38 which should fix
this issue.


Levente

>
> I'll fiddle some more in the meanwhile. Thanks!
>
> frank
>