Results 1 to 6 of 6

Thread: DOM SVN install - library problem

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    3

    DOM SVN install - library problem

    Hi.

    I am using Ubuntu Linux, and have installed the collada DOM libraries from SVN as per the instructions here:

    http://www.collada.org/mediawiki/index. ... Setting_up

    The make and install process appeared to work fine, however i am having problems with missing libraries. Here is a simple program i was using to test with:

    Code :
    #include <stdio.h>
    #include <dae.h>
    #include <dom/domCOLLADA.h>
     
    int main(int argc, char **argv)
    {
      printf("Testing\n");
     
      DAE *collada_dom;
      collada_dom = new DAE();
     
      //delete collada_dom;
     
    }

    I run G++ to compile it as per the guide:
    g++ -Wall -I/usr/include/collada test.cpp -lcollada_dae -lcollada_dom -lcollada_dae -lcollada_STLDatabase -lcollada_stdErrPlugin -lcollada_LIBXMLPlugin -lxml2 -o test

    I am getting the following linker error:
    /usr/bin/ld: cannot find -lcollada_STLDatabase

    upon removing -lcollada_STLDatabase from the command, it complains about -lcollada_stdErrPlugin and then -lcollada_LIBXMLPlugin.

    Removing all three of those allows it to compile, but when i add
    daeInt error = collada_dom->load("file:///home/kellyj2/Desktop/collada/cube.dae");

    i get:
    ./test: symbol lookup error: ./test: undefined symbol: xmlTextReaderGetParserLineNumber


    So i am stumped. I cannot find any mention of or how to install these plugins on the forum or the internet.

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Code :
    Removing all three of those allows it to compile
    Yes, those libraries no longer exist as of the latest code in svn. I need to update the wiki.

    For the other error, do you have the libxml2-dev package installed?

    Steve

  3. #3
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    I thought it might be this too, I had libxml but it was not installed in the usual location
    So I have now done an apt-get-install libxml2-dev, and tested like so:
    My program currently:

    Code :
    #include <stdio.h>
    #include <libxml/parser.h>
    #include <dae.h>
    #include <dom/domCOLLADA.h>
    #include <dom/domProfile_COMMON.h>
    int main(int argc, char **argv)
    {
      printf("Testing\n");
     
      xmlDoc  *doc          = NULL;
      xmlNode *root_element = NULL;
      doc = xmlReadFile("/home/kellyj2/Desktop/collada/cube.dae", NULL, 0);
      root_element = xmlDocGetRootElement(doc);
      printf("LibXML says root element name is: %s\n", root_element->name);
     
      DAE *collada_dom;
      printf("Initialize collada_dom:\n");
      collada_dom = new DAE();
      printf("Loading document\n");
      daeInt error = collada_dom->load("/home/kellyj2/Desktop/collada/cube.dae");
      printf("The error number is %d", error);
      delete collada_dom;
     
      xmlFreeDoc(doc);
      xmlCleanupParser();
    }

    the libxml2 stuff seems to work fine, the output is:
    Code :
    ~/Desktop/collada>./test
    Testing
    LibXML says root element name is: COLLADA
    Initialize collada_dom:
    Loading document
    ./test: symbol lookup error: ./test: undefined symbol: xmlTextReaderGetParserLineNumber
    zsh: exit 127   ./test

    Still the same error.

    If i use an invalid file name, it will instead fail with error -100.

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    It sounds like you're compiling with one version of libxml, but linking to a different (older) version.

    Try running "ldd programName" on your exe and see what libxml you're linking to. Mine says this: "libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb7768000)". Yours should say something similar.

    The latest code in svn comes with a unit test library that you can build for Linux. Try running "make -k -C domPath/test/build/linux" (replace domPath with the path to the DOM on your machine of course), and that'll generate a program at "domPath/bin/linux_1.4_debug/domTest", which you can run like this: "domTest -all". It should print "All tests passed" when it's done. If that fails there's a bigger problem somewhere, but if it works then you have a working DOM client app you can use as a reference. You can run ldd on it to see what's different between the unit test program and your client app.

    Steve

  5. #5
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    Thanks again.

    Indeed you are right, i did a whereis on libxml2 and it pointed to the wrong copy. thanks for all your help with this. As you could probably guess, I have not been using Linux for too long.
    Code :
    ~/Desktop/collada>./test
    Testing
    LibXML says root element name is: COLLADA
    Initialize collada_dom:
    Loading document
    The error number is 0

    i re-ordered my LD_LIBRARY_PATH to put /usr/lib first. It even made some other minor problems i was having go away.

  6. #6
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Heh no prob. I just started using Linux as my primary development platform earlier this year. Working with C++ in particular is very different under Linux than it is under Windows with Visual Studio; the build architectures are totally different. Anyway if you stick with it I think you'll find it's nicer, as long as you're willing to invest the time into properly setting up a development environment and customizing it for your needs (I mostly use emacs).

    Anyway good luck with it and let me know if you have any other problems.

    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •