Menu

Code does not compile because of xmlStrPrintf error

Anonymous
2016-06-14
2016-11-19
  • Bradley S. Meyer

    Thanks for the question. The problem is that libxml2 version 2.9.4 introduced a new format code for the xmlStrPrintf command, which wn_matrix and libnucnet use in NucNet Tools. This makes old versions of these codes fail to compile for libxml2 versions 2.9.4 or greater. To check your libxml2 version, type

    xml2-config --version

    I have fixed that for wn_matrix 0.17 and libnucnet 0.27. Be sure to update your NucNet Tools and clean your previous downloads. You can type, for example,

    cd nucnet-tools-code
    svn up
    cd examples/network
    make clean_all
    make all_network

    Or, more simply, you can type

    cd nucnet-tools-code/examples/network
    ./examples_make

    Let me know if that doesn't work. Best wishes.

     
    • Bradley S. Meyer

      Here is the original posed question, which seems to have gotten lost:

      When I compile NucNet Tools, I get the following error:

         /opt/local/include/libxml2/libxml/xmlstring.h:98:17: note: candidate function
          not viable: no known conversion from 'const xmlChar *' (aka
        'const unsigned char *') to 'const char *' for 3rd argument
              xmlStrPrintf             (xmlChar *buf,
      

      How do I fix that? Thanks.

       
      • Bradley S. Meyer

        As a further follow up, despite the update, there may still be confilicts depending on how your libxml got patched. If you get xmlStrPrintf errors, you should be able to do the following (in bash):

        cd nucnet-tools-code/examples/network/

        export WN_XML_CHAR=xmlChar

        make clean

        make run_entropy

        The environment variable WN_XML_CHAR sets the format string. The possible values are char and xmlChar, and the code usually chooses between them correctly depending on the version of libxml it detects. Sometimes, however, there's a mismatch and you have to set by hand as above. If the above doesn't work, try

        export WN_XML_CHAR=char

        make clean

        make run_entropy

        If one of these works, you can set WN_XML_CHAR in your .bashrc file.

         
    • Anonymous

      Anonymous - 2017-02-02

      Hi Brad

      I checked that we have xml2-config 2.7.6 vesion.

      So I followed the commands you gave me. When I run: make all_network, it gives the following error

      tar xz -C ../../vendor -f ../../vendor/wn_matrix.tar.gz
      g++ -Werror -Wall -Wpointer-arith -Wwrite-strings -fshort-enums -fno-common -g -O0 -fopenmp -Wno-deprecated -DHYDRO_EXP_EXPANSION xml2-config --cflags gsl-config --cflags -I../../vendor/libnucnet/0.29/src -I../../vendor/wn_matrix/0.18/src -I../../vendor/libstatmech/0.10/src -I../../vendor/libnuceq/0.7/src -I../.. -I ../../vendor/wn_sparse_solve/0.6/src -c ../../vendor/wn_matrix/0.18/src/WnMatrix.c -o ../../obj/WnMatrix.o
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘int WnMatrixassignElement(WnMatrix, size_t, size_t, double)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:130: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:130: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:131: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:131: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char*, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘int WnMatrix
      updateElement(WnMatrix, size_t, size_t, double)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:244: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:244: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:245: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:245: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘int WnMatrixremoveElement(WnMatrix, size_t, size_t)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:282: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:282: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:283: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:283: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char*, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘double WnMatrix
      getElement(WnMatrix
      , size_t, size_t)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:322: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:322: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:323: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:323: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘WnMatrixLine* WnMatrixgetRow(WnMatrix, size_t)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1044: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1044: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘WnMatrixLine* WnMatrixgetColumn(WnMatrix
      , size_t)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1108: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1108: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘xmlDoc WnMatrixCoomakeXmlDocument(WnMatrixCoo, const WnChar)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1903: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1903: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1920: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1920: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1937: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:1937: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘xmlDoc* WnMatrix
      CsrmakeXmlDocument(WnMatrixCsr
      , const WnChar)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2095: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2095: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2140: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2140: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2157: error: invalid conversion from ‘const WnChar
      ’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2157: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar
      , int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘xmlDoc
      WnMatrixYalemakeXmlDocument(WnMatrixYale, const WnChar)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2320: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2320: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2337: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2337: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c: In function ‘xmlDoc* WnMatrix
      make_gsl_vector_xml_document(gsl_vector, const WnChar)’:
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2899: error: invalid conversion from ‘const WnChar’ to ‘const char
      ../../vendor/wn_matrix/0.18/src/WnMatrix.c:2899: error: initializing argument 3 of ‘int xmlStrPrintf(xmlChar, int, const char, ...)’
      make: *** [../../obj/WnMatrix.o] Error 1

       
      • Bradley S. Meyer

        Did you try

        export WN_XML_CHAR=xmlChar
        make clean
        make run_entropy

        Let me know. Best wishes.

         

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.