Announcement

Collapse
No announcement yet.

problem opening vrmesh file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem opening vrmesh file

    Hi there,

    I'm trying to open up vrmesh file (to run a basic inspection) but for some reason i'm getting a segmentation fault on the ->init() line.

    #include <iostream>
    #include "mesh_file.h"
    using namespace std;

    int main(){

    VUtils::MeshFile *mfile;
    const char* nnn= "/tmp/cube.vrmesh";
    mfile->init(nnn);

    }
    Any idea what's wrong there?
    According to the mesh_file.h init() initializes the file returning true/false so I believe this is the right method to call...

    Thank you,
    kuba

  • #2
    You have to create an instance of the MeshFile object by calling VUtils::newDefaultMeshFile and VUtils::deleteDefaultMeshFile to destroy it later.
    At the moment you're trying to use an uninitialized object.
    V-Ray developer

    Comment


    • #3
      Thanks, I'm one step further but run into another problem:

      ../vray/lib/linux_x64/gcc-4.4/libmeshes_s.a(mesh_file.obj): In function `VUtils::MeshInterface::save(char*)':
      mesh_file.cpp.text._ZN6VUtils13MeshInterface4saveEPc+0x1d): undefined reference to `PFileStream::PFileStream()'
      mesh_file.cpp.text._ZN6VUtils13MeshInterface4saveEPc+0x2a): undefined reference to `PFileStream::Create(char const*, int)'
      mesh_file.cpp.text._ZN6VUtils13MeshInterface4saveEPc+0x43): undefined reference to `PFileStream::Close()'
      mesh_file.cpp.text._ZN6VUtils13MeshInterface4saveEPc+0x54): undefined reference to `PFileStream::~PFileStream()'
      mesh_file.cpp.text._ZN6VUtils13MeshInterface4saveEPc+0x7b): undefined reference to `PFileStream::~PFileStream()'
      ../vray/lib/linux_x64/gcc-4.4/libmeshes_s.a(mesh_file.obj): In function `VUtils::Table<Alembic::AbcGeom::v5::ITypedGeomPar am<Alembic::Abc::v5::C4fTPTraits>, 100>::~Table()':

      This seems to be like an alembic library problem. I'm not sure if I'm linking against all the required libraries. Can you please point me what are the bare minimum libs to get started? I'm using g++ with the following:
      -lpthread -lrt -lc -fPIC -lrayserver_s -lputils_s -lmeshes_s -lvutils_s -ldl -lz

      Do I need to also link against the -lvray even if I want to open vrmesh?

      Update:
      adding -shared -lvray gets rid of the errors but now I'm getting again the seg fault when program starts.
      -lpthread -lrt -lc -fPIC -lrayserver_s -lputils_s -lmeshes_s -lvutils_s -ldl -lz -shared -lvray

      This is a problematic line: mfile=VUtils::newDefaultMeshFile();

      I noticed there is also an -lalembic_s library, adding it still getting a crash.

      Thank you

      Comment


      • #4
        Ok, looks like I put to much there. First of all -shared is not needed since I'm not creating shared library. Secondly removing -lmeshes_s solves the alembics errors. And the last I was missing -lcgauth so the final flags look as follow:
        -lcgauth -lpthread -lrt -lc -fPIC -lrayserver_s -lputils_s -lvutils_s -ldl -lz -lvray

        I wonder what is the purpose of lmeshes_s and if linking with it should I also include -lalembic_s? I did it at some point but the errors did go away. Perhaps I need to link with alembic libraries which I need to build myself in a first place?

        Thanks,
        kuba

        Comment


        • #5
          If you just want to open .vrmesh files, it is not needed to link against libvray.so (which will also remove the dependency on libcgauth.so); if you remove it however, you will need to add back meshes_s and alembic_s. Do *not* use your own Alembic library as this will most likely fail - you will need matching versions of Boost and HDF5, plus we've made some modifications to the Alembic library.

          meshes_s is in fact the library that includes the implementation of the .vrmesh methods. If you use it, you must also link against alembic_s since we use the same API to process Alembic files too.

          Best regards,
          Vlado
          I only act like I know everything, Rogers.

          Comment


          • #6
            Hey Vlado,
            Thanks for the hints, this info is indispensable for new comers as me.
            I did a quick test with both options - one worked, other didn't. I think I will stick for now with including -lcgauth -lvray.
            Just for the records the other throws some PFileStream related errors which looks I must have missed something except libalembic_s and libmeshes_s.

            Cheers,
            kuba

            Comment


            • #7
              Originally posted by JAKUB_ROTH View Post
              Just for the records the other throws some PFileStream related errors which looks I must have missed something except libalembic_s and libmeshes_s.
              The missing one would be putils_s, however the order of the libraries is important on Linux, so you might need to shuffle them around or use the -Wl,-( and -Wl,-) to make the linker cycle through the libs until all symbols are resolved.

              Best regards,
              Vlado
              I only act like I know everything, Rogers.

              Comment


              • #8
                I didn't know about -Wl flag, took me a while to figure out the syntax with g++ - attaching them for references. Please note the -lmeshes_s is intentionaly placed after -lalembic_s. Btw. It turned out I had to also include libvutils_s.

                -lpthread -lrt -lc -fPIC -ldl -lz -Wl,--start-group -lalembic_s -lputils_s -lvutils_s -lmeshes_s -Wl,--end-group


                kuba

                Comment


                • #9
                  There you go

                  Best regards,
                  Vlado
                  I only act like I know everything, Rogers.

                  Comment


                  • #10
                    The proper order should be meshes_s putils_s vutils_s alembic_s if you're not using start-group and end-group. If you're using it then it matters less.
                    V-Ray developer

                    Comment

                    Working...
                    X