Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Attempt to build Pixie on HP-UX (PA-RISC 2.0)

Help
2008-04-25
2013-04-25
  • Hey Pixians, I am currently attempting to build Pixie on a C3750 workstation; at this point version 2.3.3 does not complete as it returns the following:

    g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I.. -O0 -ffast-math -fno-strict-aliasing -fomit-frame-pointer -pipe -MT attributes.lo -MD -MP -MF .deps/attributes.Tpo -c attributes.cpp  -fPIC -DPIC -o .libs/attributes.o
    attributes.cpp: In static member function 'static EShadingModel CAttributes::findShadingModel(const char*)':
    attributes.cpp:517: warning: deprecated conversion from string constant to 'char*'
    attributes.cpp: In static member function 'static char CAttributes::findHitMode(const char*)':
    attributes.cpp:570: warning: deprecated conversion from string constant to 'char*'
    attributes.cpp: In static member function 'static const char* CAttributes::findHitMode(char)':
    attributes.cpp:584: warning: deprecated conversion from string constant to 'char*'
    {standard input}: Assembler messages:
    {standard input}:128: Error: Unknown opcode: `lwarx'
    {standard input}:129: Error: junk at end of line, first unrecognized character is `%'
    {standard input}:130: Error: junk at end of line, first unrecognized character is `%'
    {standard input}:131: Error: junk at end of line, first unrecognized character is `-'
    {standard input}:152: Error: Unknown opcode: `lwarx'
    {standard input}:153: Error: symbol `add' is already defined
    {standard input}:153: Error: junk at end of line, first unrecognized character is `%'
    {standard input}:154: Error: symbol `stwcx.' is already defined
    {standard input}:154: Error: junk at end of line, first unrecognized character is `%'
    {standard input}:155: Error: symbol `bne' is already defined
    {standard input}:155: Error: junk at end of line, first unrecognized character is `-'
    make[4]: *** [attributes.lo] Error 1
    make[4]: Leaving directory `/tmp/Pixie/src/ri'
    make[3]: *** [all] Error 2
    make[3]: Leaving directory `/tmp/Pixie/src/ri'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/tmp/Pixie/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/tmp/Pixie'
    make: *** [all] Error 2

    I tried the 2.2.2 release and it gave me similar results to when I was trying to build it for IRIX 6.5.22/GCC 3.4.0 a couple years back (something about alloca.h). After fixing that, it builds and installs but when invoking rndr for a test .rib I get:

    tetra.rib (14): Unable to find out device "file"

    I've already set PIXIEHOME, PATH and LD_LIBRARY_PATH but I'm still getting no dice.

    gcc version is 4.2.3 on hppa2.0w-hp-hpux11.23 (linker is HP-UX's ld; which has been patched) and binutils is at 2.18. Feel free to ask about any other programs/libraries/etc.

    My programming skills haven't changed since attemping to build it on IRIX but I'll help out in any way possible to get this running on HP-UX.

    - Simon.

     
    • I meant 2.2.3

       
    • Aasimon
      Aasimon
      2008-04-25

      The problem is in ri/atomic.h. It contains atomic operations (InterLock in MS speak) and the #if processing was a little out.
      What you are seeing is the PowerPC asm code being compiled in.
      Did you get the code from the main SVN trunk or a branch? The main trunk should have been fixed.
      There are fallback/generic routines for CPUs that are not already supported. But if you can add the #ifelse and routines for your CPU that would be greate (post the diff files to render_man).

       
    • Aasimon
      Aasimon
      2008-04-25

      An additional note: If you are using GNU to compile with you might be able to use the __sync_add_and_fetch() built-ins. I do not know how compatible they are across different platforms so they might not work but might save you some time if they do.

       
    • I downloaded the 2.2.3 release. I have not looked into SVN but will look into it some time. By the way, that release built and installed correctly on my IBM RS/6000 7043-43P Model 140 (openSUSE 10.0).

      - Simon.

       
      • Aasimon
        Aasimon
        2008-04-25

        Do not quote me on this but the RS/6000 uses a Power series CPU which looks to be PowerPC derived.
        Your HP-UX is a PA-Risc CPU which is a very different beast which is why it did not work.
        If you replace the contents of your src/ri/atomic.h file with the following it should work (But not optimally). This is from the SVN trunk.

        //////////////////////////////////////////////////////////////////////
        //
        //                             Pixie
        //
        // Copyright © 1999 - 2003, Okan Arikan
        //
        // Contact: okan@cs.utexas.edu
        //
        //    This library is free software; you can redistribute it and/or
        //    modify it under the terms of the GNU Lesser General Public
        //    License as published by the Free Software Foundation; either
        //    version 2.1 of the License, or (at your option) any later version.
        //
        //    This library is distributed in the hope that it will be useful,
        //    but WITHOUT ANY WARRANTY; without even the implied warranty of
        //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        //    Lesser General Public License for more details.
        //
        //    You should have received a copy of the GNU Lesser General Public
        //    License along with this library; if not, write to the Free Software
        //    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
        //
        ///////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////
        //
        //  File                :    atomic.h
        //  Classes                :    -
        //  Description            :    This file contains the atomic increment and decrement
        //                            to ensure consistency in multi-threaded environments
        //                            without kernel synchronization.
        //
        //                            The Windoze and Apple implementations are pretty standard
        //                            but this file gets pretty messy for other platforms.
        //
        ////////////////////////////////////////////////////////////////////////
        #ifndef ATOMIC_H
        #define ATOMIC_H

        ////////////////////////////////////////////////////////////////////////
        // Atomic increment/decrement functions

        ///////////////////////////////////////////////////////////////
        // Windoze
        #if defined(_WINDOWS)

        // Include the mighty (crappy) windoze header
        #ifndef WIN32_LEAN_AND_MEAN
        #define    WIN32_LEAN_AND_MEAN
        #endif
        #include <windows.h>

        // Ugly workaround the stuping LONG definition
        // This is one of the reasons why Windoze is written by monkeys
        inline int atomicIncrement(volatile int *pointer) {
            return InterlockedIncrement((volatile LONG *) pointer);
        }

        inline int    atomicDecrement(volatile int *pointer) {
            return InterlockedDecrement((volatile LONG *) pointer);
        }

        ///////////////////////////////////////////////////////////////
        // Apple
        #elif defined(__APPLE__) || defined(__APPLE_CC__)

        // Include the OSX header
        #include <libkern/OSAtomic.h>

        inline int atomicIncrement(int32_t *ptr) {
            return OSAtomicIncrement32Barrier(ptr);
        }

        inline int atomicDecrement(int32_t *ptr) {
            return OSAtomicDecrement32Barrier(ptr);
        }

        ///////////////////////////////////////////////////////////////
        // GCC (i386 or x86_64)
        #elif (defined(__i386__) && defined(__GNUC__) || defined(__x86_64__)  && defined(__GNUC__))

        inline int atomicIncrement(volatile int *ptr) {
            unsigned char ret;
            asm volatile("lock\n"
                         "incl %0\n"
                         "setne %1"
                         : "=m" (*ptr), "=qm" (ret)
                         : "m" (*ptr)
                         : "memory");
            return ret;
        }

        inline int atomicDecrement(volatile int *ptr) {
            unsigned char ret;
            asm volatile("lock\n"
                         "decl %0\n"
                         "setne %1"
                         : "=m" (*ptr), "=qm" (ret)
                         : "m" (*ptr)
                         : "memory");
            return ret;
        }

        ///////////////////////////////////////////////////////////////
        // GCC (MIPS)
        #elif defined(__GNUC__) && defined( __PPC__)

        inline int atomicIncrement(volatile int *ptr) {
            register int ret;
            register int one = 1;
            asm volatile("lwarx  %0, 0, %2\n"
                         "add    %0, %3, %0\n"
                         "stwcx. %0, 0, %2\n"
                         "bne-   $-12\n"
                         : "=&r" (ret), "=m" (*ptr)
                         : "r" (ptr), "r" (one)
                         : "cc", "memory");
            return ret;
        }

        inline int atomicDecrement(volatile int *ptr) {
            register int ret;
            register int one = -1;
            asm volatile("lwarx  %0, 0, %2\n"
                         "add    %0, %3, %0\n"
                         "stwcx. %0, 0, %2\n"
                         "bne-   $-12\n"
                         : "=&r" (ret), "=m" (*ptr)
                         : "r" (ptr), "r" (one)
                         : "cc", "memory");
            return ret;
        }

        ///////////////////////////////////////////////////////////////
        // Generic
        #else

        #define    ATOMIC_UNSUPPORTED
        #warning Atomic Instructions are not supported on this platform, defaulting to generic implementation

        // Have a cross platform solution here
        inline int atomicIncrement(volatile int *ptr) {
            int    value;
            osLock(CRenderer::atomicMutex);
            value    =    ++(*ptr);
            osUnlock(CRenderer::atomicMutex);
            return value;
        }

        inline int atomicDecrement(volatile int *ptr) {
            int    value;
            osLock(CRenderer::atomicMutex);
            value    =    --(*ptr);
            osUnlock(CRenderer::atomicMutex);
            return value;
        }

        #endif

        #endif

         
    • Yeah, the RS/6000 has a 332MHz PowerPC 604r. OK, we're getting somewhere; I've done what you've said and here's what's happening now:

      make[3]: Entering directory `/tmp/Pixie/src/precomp'
      if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I..    -O0 -ffast-math -fno-strict-aliasing -fomit-frame-pointer -pipe -MT precomp.o -MD -MP -MF ".deps/precomp.Tpo" -c -o precomp.o precomp.cpp; \         then mv -f ".deps/precomp.Tpo" ".deps/precomp.Po"; else rm -f ".deps/precomp.Tpo"; exit 1; fi
      In file included from ../ri/refCounter.h:35,
                       from ../ri/xform.h:36,
                       from ../ri/options.h:38,
                       from ../ri/renderer.h:37,
                       from precomp.cpp:38:
      ../ri/atomic.h:144:2: warning: #warning Atomic Instructions are not supported on this platform, defaulting to generic implementation
      In file included from ../ri/refCounter.h:35,
                       from ../ri/xform.h:36,
                       from ../ri/options.h:38,
                       from ../ri/renderer.h:37,
                       from precomp.cpp:38:
      ../ri/atomic.h: In function 'int atomicIncrement(volatile int*)':
      ../ri/atomic.h:149: error: 'CRenderer' has not been declared
      ../ri/atomic.h:151: error: 'CRenderer' has not been declared
      ../ri/atomic.h: In function 'int atomicDecrement(volatile int*)':
      ../ri/atomic.h:157: error: 'CRenderer' has not been declared
      ../ri/atomic.h:159: error: 'CRenderer' has not been declared

      I'm pretty sure I have copied the above to /src/ri/atomic.h, though it's through PuTTY (Windows), if that matters. I run the C3750 through SSH.

      -Simon.

       
      • Aasimon
        Aasimon
        2008-04-25

        Ok, that is a #if/code bug.

        Two things to try:
        1) Add the missing atomic asm your self.
        2) Add the following into the atomic.h code just before the last #else. I have not tried this code and I do not know if these routines are supported on your system.

        #elif defined( __GNUC__)

        inline atomicIncrement( volatile int *ptr) {
            int ret = __sync_add_and_fetch( ptr, 1);
            return ret;
        }

        inline int atomicDecrement(volatile int *ptr) {
            int ret = __sync_add_and_fetch( ptr, -1);
            return ret;
        }

         
    • Here we go, just adding the above returns this:

      error: ISO C++ forbids declaration of 'atomicIncrement' with no type

      I'm going to at least try to add the atomic asm code. I'm not too sure how the atomic asm is for HPPA/PA-RISC but as least I know it's defined as (__hppa__) in gcc, I tested adding an #elif defined (__GNUC__) && defined( __hppa__) with duplicated code from the ppc section; it gave me the same errors as before (assembler not understanding ppc instructions).

      I'm looking for the equivalent instructions and somehow put it together (e.g. lwarx/stwcx=ldw/stw). I'll be doing some research into each instruction set in the meantime to have some idea on how it should work. Hey, you gotta learn something new!

      - Simon.