Results 1 to 5 of 5

Thread: Problem with NCReport : can't link shared library !

  1. #1
    Join Date
    May 2009
    Posts
    28
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Red face Problem with NCReport : can't link shared library !

    hello everyone
    i am using Qt4.4.0 on Ubuntu Hardy.
    i want to make some report to print from my application so i get the NCReport (NCReport_2.1.1_Linux_bin_Qt4.4.1.tar.gz) from http://nocisoft.com/?id=down&lang=en .

    i made a small report with NCReportDesigner & everything is good !
    but when i try to run it from my application i get the error :

    error while loading shared libraries: libncreport.so.2: cannot open shared object file: No such file or directory

    i followed the documentation so in my .pro i added :

    INCLUDEPATH = NCReport2/include

    win32 {
    LIBS += NCReport2/lib/ncreport2.lib
    }
    unix {
    LIBS += -lncreport -L NCReport2/lib -L/usr/local/bin
    target.path = /usr/local/bin
    }


    include contains the header files
    and lib contains libraries

    in lib folder i have :

    libncreportdesigner.so -> libncreportdesigner.so.2.1.1
    libncreportdesigner.so.2 -> libncreportdesigner.so.2.1.1
    libncreportdesigner.so.2.1 -> libncreportdesigner.so.2.1.1
    libncreportdesigner.so.2.1.1
    libncreport.so -> libncreport.so.2.1.1
    libncreport.so.2 -> libncreport.so.2.1.1
    libncreport.so.2.1 -> libncreport.so.2.1.1
    libncreport.so.2.1.1


    i tried to change the name libncreport.so.2.1.1 to libncreport.so.2 as the error say and i put it in /usr/lib , the error disappear but the report doesn't run , so i think changing name was not a good idea

    code genarating report :
    Qt Code:
    1. NCReport *report = new NCReport();
    2. report->reset();
    3. report->setReportFile("reports/report1.xml"); // report file
    4. report->addItemModel(model,"model1");
    5. report->runReportToPrinter();
    To copy to clipboard, switch view to plain text mode 

    anyone can help please ??
    or if anyone has NCReport sources(.cpp) , so we don't need libraries ...

    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,365
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with NCReport : can't link shared library !

    Your code is fine. The library can't be found when the dynamic linker is asked to resolve all the missing symbols when you execute the application. Compilation has nothing to do with it - the linker there was able to find the library because you pointed it to it using the "-L" option. Now you have to point it to the linker during runtime. Either place the library in a directory where the linker looks for it (like /usr/lib) or set the LD_LIBRARY_PATH environment variable to the directory containing the library.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    QAmazigh (5th June 2009)

  4. #3
    Join Date
    May 2009
    Posts
    28
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with NCReport : can't link shared library !

    thanks for informations wysota
    i copied all the contents of lib directory to /usr/lib and it's working pefect
    i loved this ncreport , it's better than Crystal !

    but i want to make application portable , so i need to put libraries in my application folder :/

    "set the LD_LIBRARY_PATH environment variable to the directory containing the library. "
    how ?? what to add in .pro ??

    thanks !

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,365
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with NCReport : can't link shared library !

    Adding anything to the pro file will not help. The "problem" is not related to compilation, I already told you that. Please google for LD_LIBRARY_PATH.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    May 2009
    Posts
    28
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with NCReport : can't link shared library !

    ah oké , thanks
    i read an article about this variable , i can add my directory to LD_LIBRARY_PATH.

Similar Threads

  1. so shared library problem
    By mtrpoland in forum Newbie
    Replies: 3
    Last Post: 13th August 2007, 22:51
  2. shared library problem
    By nhatkhang in forum KDE Forum
    Replies: 9
    Last Post: 28th November 2006, 05:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.