Re: Compiling PowerLoom C++

Thomas Russ <[email protected]> Sun, 14 Feb 2010 14:09:47 +0000
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Feb 14, 2010, at 1:17 PM, Cameron Ross wrote:

> Hi Thomas,
>
> Yes.  This is an error that is halting compilation.  What are the
> options to fix?  Will I have to modify the code manually?

I'd like to see what Hans has to say about this, but that may need to  =

wait until the workweek starts.

Some options that come to mind:

   (1)  You could try editing the Makefile to add -fpermissive to the  =

compiler switches.  That would involve just changing the value of the  =

CFLAGS variable at the top of the file.
   (2)  Do you absolutely need to use GCC version 4.4?  I know that it  =

works with version 4.0.
   (3)  The translation of the code could be modified.  This requires  =

having some version of PowerLoom/Stella that runs, such as the Java or  =

Lisp version.
      (3a)  The simplest way to do this would be to change the Stella  =

optimization settings used to translate the system to the development  =

settings.  That will disable this optimization (along with some others  =

as well).  This will be temporary until we create a permanent  =

solution.  You can do this by re-translating the systems with the  =

":development-settings? true" switch set.  For example, this could be  =

done with something like
           %  stella -e '(make-system "stella" :cpp :development- =

settings? true)'
           %  stella -e '(make-system "logic" :cpp :development- =

settings? true)'
      (3b)  A more complicated method would be to modify the  =

translator code to disable the translation.  This may be what we end  =

up doing in order to support GCC 4.4, since it doesn't seem to like  =

our current "optimized" translation for the null test.  This takes  =

place in the function cpp-translate-DEFINED?-method-call in the file  =

sources/stella/cpp-translate.ste around line 2431.


> Thanks,
> Cameron
>
> Sent from my iPhone
>
> On Feb 14, 2010, at 5:47 AM, Thomas Russ <[email protected]> wrote:
>
>>
>> On Feb 14, 2010, at 4:40 AM, Cameron Ross wrote:
>>
>>> Hello,
>>>
>>> I'm trying the compile the C++ version of PowerLoom version
>>> 3.2.52.  Running make from .../native/cpp/stella gives copious
>>> errors similar to: hierarchy.cc:97: error: cast from =91stella::Obje
>>> ct*=92 to =91stella::boolean=92 loses precision.  This error refers
>>> to what seems to be a recurring theme throughout PowerLoom's C++ c
>>> odebase.  Just wondering why the boolean cast is required.  Also,
>>> wondering why its not compiling for me, when clearly this idiom mu
>>> st have worked with gcc at some point.  I'm running 64bit Ubuntu L
>>> inux 9.10 with g++ version 4.4.1.  Note that the code associated w
>>> ith this specific error is:
>>>
>>>   if (!((boolean)(self))) {
>>>         stream << "!NULL!";
>>>   }
>>
>>
>> Looking at this a bit more closely, what it turns out to be is an
>> "optimization" in the generated C++ code to implement at  test for a
>> null object.  Now, I'm not completely sure of all of the background,
>> but I suspect that at one point there was a C compiler that
>> complained about using a non-boolean in a boolean test, so a cast is
>> used.  (Or it could be that the cast is just created because of the
>> casting used in Stella to generate the optimization.
>>
>> Is this error actually stopping the generation of code, or is this
>> more of a warning rather than a hard error?  I don't happen to have
>> gcc 4.4 installed.  All I have is 4.0 and 4.2 right now.  G++ 4.0
>> certainly doesn't complain about that construct at all.
>>
>>
>>
>>