Results 1 to 4 of 4

Thread: No such file or directory...?

  1. #1
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default No such file or directory...?

    Because of bugs, I was forced to download, fix and compile a shared library. Trying to run an application from the Creator, I am now getting an error:
    Qt Code:
    1. /home/radek/Desktop/C++/project/repdf-debug/repdf-qt: error while loading shared libraries: libpodofo.so.0.9.1: cannot open shared object file: No such file or directory
    To copy to clipboard, switch view to plain text mode 
    But the library exists for sure. In /home/radek/podofo/lib are sitting libpodofo.so (a link) and libpodofo.so.0.9.1 side by side. My *.pro file now contains:
    Qt Code:
    1. LIBS += /home/radek/podofo/lib/libpodofo.so
    To copy to clipboard, switch view to plain text mode 
    I have checked (using Krusader) that there are no hidden blanks around the name, that the link is a valid link, that the library looks like a shared library, that the access rights both of the link and the library are the same as usual access rights from /usr/lib and that I am the owner both of the link and of the library. I also tried to reference the library directly:
    Qt Code:
    1. LIBS += /home/radek/podofo/lib/libpodofo.so.0.9.1
    To copy to clipboard, switch view to plain text mode 
    Nothing helps. No such file or directory. What is happening?

    -----------------------------------

    Never mind, problem solved. It's a matter of libpath, the directory specified in LIBS seems to be irrelevant at runtime. So I created "mylib" folder in /home/radek, a /etc/ld.so.d/mine.conf file containing /home/radek/mylib, copied libpodofo.so files there, updated the profile file. It works now.
    Last edited by Radek; 2nd January 2014 at 18:39.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: No such file or directory...?

    You could also just add /home/radek/podofo/lib to the LD_LIBRARY_PATH environment variable in the Qt Creator project settings. You generally would need to create this variable but it may already exist. It is a colon ( separated list of extra directories to search for dynamic libraries at run time.

  3. #3
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: No such file or directory...?

    It is better to have a library specified per project and not modifying the libpath globally by /etc/ld.so.conf.d but I haven't found any way of setting LD_LIBRARY_PATH locally for a project. There is no entry in Tools -> Options -> Environment, there is no "Build options", no "Run Options" in Debian Creator. There is an unintuitive way still:

    (1) Right click the project header in the project tree
    (2) Select "Add Library"
    (3) Select "External Library", "Next"
    (4) Enter the library name including the full path (use "Browse" for it)
    (5) Enter include path for library headers (use "Browse" for it or clear the line. This field can be empty)
    (6) Finish

    You get several ugly lines in the *.pro file. You can cleanse them. The key point: the declaration of the library seems not to be:
    Qt Code:
    1. LIBS += /home/radek/podofo/lib/libpodofo.so
    To copy to clipboard, switch view to plain text mode 
    but it must be:
    Qt Code:
    1. LIBS += -L/home/radek/podofo/lib/ -lpodofo
    To copy to clipboard, switch view to plain text mode 

    At least, this works after removing the mine.conf from /etc/ld.so.conf.d and deleting the contents of /home/radek/mylib . I will see whether it will work tomorrow, after restarting Debian

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: No such file or directory...?

    In Qt Creator open your project. Click the Projects tool in the left bar. The run environment (and build) environment, including adjusting the PATH and LD_LIBRARY_PATH, for this project can be set here.

    The options under Tools menu Option are not project specific.

Similar Threads

  1. Replies: 2
    Last Post: 25th July 2013, 06:17
  2. Replies: 1
    Last Post: 23rd May 2011, 04:53
  3. Replies: 1
    Last Post: 8th November 2010, 03:24
  4. Replies: 4
    Last Post: 9th May 2010, 16:18
  5. Replies: 2
    Last Post: 9th March 2010, 05:21

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
  •  
Qt is a trademark of The Qt Company.