compiling panda in opensolaris

I’ve been trying to compile panda on opensolaris with sun studio 12 and I get an error I can’t solve

   1.
      sunCC   -features=extensions -c -o Opt3-solaris/dtoolutil_dtoolutil_composite1.o -I. -I/export/home/ilcra/panda3d/panda3d/dtool -I../dtoolbase -I/usr/include/python2.4    -g -O2 -fPIC dtoolutil_composite1.cxx
   2.
      sunCC: Warning: Option -fPIC passed to ld, if ld is invoked, ignored otherwise
   3.
      "pandaFileStreamBuf.h", line 53: Warning: Identifier expected instead of "}".
   4.
      "../dtoolbase/deletedBufferChain.h", line 45: Warning: Identifier expected instead of "}".
   5.
      "filename.h", line 52: Warning: Identifier expected instead of "}".
   6.
      "filename.h", line 60: Warning: Identifier expected instead of "}".
   7.
      "/opt/studio/prod/include/CC/Cstd/./memory", line 490: Error: Using static_cast to convert from std::pair<const std::string, std::string>* to __rwstd::__rb_tree<std::string, std::pair<const std::string, std::string>, __rwstd::__select1st<std::pair<const std::string, std::string>, std::string>, std::less<std::string>, pallocator_single<std::pair<const std::string, std::string>>>::__rb_tree_node_buffer* not allowed.
   8.
      "/opt/studio/prod/include/CC/Cstd/rw/tree", line 167:     Where: While instantiating "std::allocator_interface<pallocator_single<std::pair<const std::string, std::string>>, __rwstd::__rb_tree<std::string, std::pair<const std::string, std::string>, __rwstd::__select1st<std::pair<const std::string, std::string>, std::string>, std::less<std::string>, pallocator_single<std::pair<const std::string, std::string>>>::__rb_tree_node_buffer>::allocate(unsigned, __rwstd::__rb_tree<std::string, std::pair<const std::string, std::string>, __rwstd::__select1st<std::pair<const std::string, std::string>, std::string>, std::less<std::string>, pallocator_single<std::pair<const std::string, std::string>>>::__rb_tree_node_buffer*)".
   9.
      "/opt/studio/prod/include/CC/Cstd/rw/tree", line 167:     Where: Instantiated from non-template code.
  10.
      1 Error(s) and 4 Warning(s) detected.
  11.
      *** Error code 1
  12.
      make: Fatal error: Command failed for target `Opt3-solaris/dtoolutil_dtoolutil_composite1.o'
  13.
      Current working directory /export/home/ilcra/panda3d/panda3d/dtool/src/dtoolutil
  14.
      *** Error code 1
  15.
      make: Fatal error: Command failed for target `dtoolutil'

I’m using ppremake and made a solaris target.
Any ideas?

The line in question is the closing brace of this syntax:

  enum NewlineMode {
    NM_native,
    NM_binary,
    NM_msdos,
    NM_unix,
    NM_mac,
  };

I’m guessing that Sun’s native C++ is being pedantically fussy about the trailing comma behind NM_mac. It’s true, this is technically not legal according to the formal C++ grammar, though it’s convenient to be able to put it there, and I’ve never met a compiler before that objected to its presence before (and I’ve worked with lots of compilers).

So, the short answer is, delete this last comma and try again. You will doubtless find lots of other commas to remove in the Panda source code. There will probably be other issues as well; there are always issues when compiling a body of code the size of Panda3D with a new compiler for the first time. I’ll be happy to accept a patch for all of the needed changes, of course.

You might also consider using g++ as a shortcut to getting something running. :slight_smile:

edit: whoops, I just realized that the comma objection is only a warning. The actual error is something deep within STL. That looks a lot more mysterious.

I think this problem is due to a slight nonconformity in the STL libraries. There have been lots of variations on the stl_allocator syntax over the years, and it’s only settled out quite recently; it doesn’t surprise me that this compiler might be using one of the earlier variations.

The easy workaround is to change:

// Modern versions of gcc do support the latest STL allocator
// definitions.
#define USE_STL_ALLOCATOR 1

to:

// The Sun compiler doesn't support the latest STL allocator
// definitions
#define USE_STL_ALLOCATOR

in your Config.Sun.pp file (or whatever you’ve called it).

David

I decided to compile it first with g++
I compiled dtool and panda but when running pview I get these errors:

   1.
      ilcra@opensolaris:~$ pview transport.egg
   2.
      Assertion failed: _parent != (NotifyCategory *)NULL || _fullname.empty() at line 48 of notifyCategory.cxx
   3.
      Assertion failed: _parent != (NotifyCategory *)NULL || _fullname.empty() at line 48 of notifyCategory.cxx
   4.
      Segmentation Fault (core dumped)

the output of truss(strace equivalent) is the following one:

pastebin.com/m70ff496e

Hmm, what version of g++ did you use? Does it compile other programs successfully?

David

it’s 3.4.3 (I know, quite old, there’s no newer version)

and it compiles some test programs
any idea or should I try with gcc 4.x?

Well, I don’t know. That’s a really weird error; it suggests that something is way not right deep in the low-level code. To me it means either a problem with the compiler or with its accompanying C++ libraries (like STL).

So, if it’s possible to try with g++ 4.x, I’d do so. Otherwise, you might actually be better off going back to the SunOS native compiler.

David