rockowitz / ddcui

Graphical user interface for ddcutil - control monitor settings
http://www.ddcutil.com
GNU General Public License v2.0
147 stars 2 forks source link

libddcutil.so.2 not found #19

Open gsedej opened 4 years ago

gsedej commented 4 years ago

Hello,

the ddcui from github worked for me few weeks ago, but i updated from git, recompiled and get error

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

the ddcutil is also recent from github

the ddcutil is in system via sudo make install

locate libddcutil.so.2
/home/gasper/git/ddcutil/src/.libs/libddcutil.so.2
/home/gasper/git/ddcutil/src/.libs/libddcutil.so.2.0.0
/usr/local/lib/libddcutil.so.2
/usr/local/lib/libddcutil.so.2.0.0

qmake also looks fine (or does it?)

qmake
Project MESSAGE: not setting APPLY_CANCEL_FLAG
Project MESSAGE: PKG_OK: TRUE
Project MESSAGE: GLIB_LIBS        = -lglib-2.0
Project MESSAGE: PKGCONFIG_LIBS   = -L/usr/local/lib -lddcutil
Project MESSAGE: PKGCONFIG_CFLAGS = -I/usr/local/include
Project MESSAGE: GLIB_CFLAGS      = /usr/include/glib-2.0 /usr/lib/x86_64-linux-gnu/glib-2.0/include
Project MESSAGE: CONFIG           = lex yacc debug exceptions depend_includepath testcase_targets import_plugins import_qpa_plugin file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc c++11 no_lflags_merge link_pkgconfig
Project MESSAGE: PKGCONFIG        =
Project MESSAGE: LIBS             = -lglib-2.0 -L/usr/local/lib -lddcutil
Project MESSAGE: INCLUDEPATH      = src -I/usr/local/include /usr/include/glib-2.0 /usr/lib/x86_64-linux-gnu/glib-2.0/include
Project MESSAGE: INCLUDE          =

but it does not get linked

ldd ./ddcui | grep "not found"
    libddcutil.so.2 => not found

using Ubuntu 18.04

EDIT: when building with cmake, the local binary works, but not the installed one

sudo make install -j 12
[  1%] Automatic MOC, UIC and RCC for target ddcui
[  1%] Built target ddcui_autogen
[100%] Built target ddcui
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/ddcui
-- Set runtime path of "/usr/local/bin/ddcui" to ""

installed does copy to user/local/bin

ldd ddcui | grep ddcutil
    libddcutil.so.2 => /usr/local/lib/libddcutil.so.2 (0x00007f5d7698e000)
ldd /usr/local/bin/ddcui | grep ddcutil
    libddcutil.so.2 => not found

but ldd is wrong

works for now by manually copying binnary sudo cp ddcui /usr/local/bin/ddcui

rockowitz commented 4 years ago

First, your report caused me to check the shared library page on the ddcutil web site.  It's http://www.ddcutil.com/shared_lib_config/. The "Shared Library Configuration"  hyperlink to it on page http://http://www.ddcutil.com/building_ddcui/ was incorrect, so you probably did not see the page.  The link has been fixed.

I myself am using Ubuntu 19.04 right now., and find the shared library installed in /usr/local/lib.

When you installed ddcutil and ddcui a few weeks ago, did you install from git or use one of the prebuilt packages? If installed from a package, libddcutil.so.2 would be installed in the normal location under /usr/lib, not in /usr/local/lib.  That could explain why things worked previously but not now.

Both cmake and qmake use pkg-config to obtain the location  of libddctuil.so.2, along with the ddcutil include files, when building ddcui. At execution time, on the other hand, the runtime linker finds the shared library using the cache file /etc/ld.so.cache built previously by ldconfig. These two mechanisms are independent.

When run normally, ldconfig builds the shared library cache by examining the libraries it finds in the directories  specified in /etc/ld.so.conf and /etc/ld.so.conf.d.  As part of "make install", "ldconfig -n /usr/local/lib"  is executed, which specifically creates cache entries only for shared libraries in that directory.

So if ldconfig is executed normally after "make install", and /usr/local/lib is not in the normal library search path,  the cache entry for libddcutil.so will disappear.

Which leads to 2 questions:

Is libddcutil in the output of "ldconfig -p"?

Is /usr/local/lib in the ldconfig search path specified in file /etc/ld.so/conf or directory  /etc/ld.so.conf.d?

Also, are there any error message relating to linking in the "make install" output?

On 3/5/20 7:36 AM, gsedej wrote:

Hello,

the ddcui from github worked for me few weeks ago, but i updated from git, recompiled and get error

|./ddcui ./ddcui: error while loading shared libraries: libddcutil.so.2: cannot open shared object file: No such file or directory |

the ddcutil is also recent from github

the ddcutil is in system via |sudo make install|

|locate libddcutil.so.2 /home/gasper/git/ddcutil/src/.libs/libddcutil.so.2 /home/gasper/git/ddcutil/src/.libs/libddcutil.so.2.0.0 /usr/local/lib/libddcutil.so.2 /usr/local/lib/libddcutil.so.2.0.0 |

qmake also looks fine (or does it?)

|qmake Project MESSAGE: not setting APPLY_CANCEL_FLAG Project MESSAGE: PKG_OK: TRUE Project MESSAGE: GLIB_LIBS = -lglib-2.0 Project MESSAGE: PKGCONFIG_LIBS = -L/usr/local/lib -lddcutil Project MESSAGE: PKGCONFIG_CFLAGS = -I/usr/local/include Project MESSAGE: GLIB_CFLAGS = /usr/include/glib-2.0 /usr/lib/x86_64-linux-gnu/glib-2.0/include Project MESSAGE: CONFIG = lex yacc debug exceptions depend_includepath testcase_targets import_plugins import_qpa_plugin file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc c++11 no_lflags_merge link_pkgconfig Project MESSAGE: PKGCONFIG = Project MESSAGE: LIBS = -lglib-2.0 -L/usr/local/lib -lddcutil Project MESSAGE: INCLUDEPATH = src -I/usr/local/include /usr/include/glib-2.0 /usr/lib/x86_64-linux-gnu/glib-2.0/include Project MESSAGE: INCLUDE = |

but it does not get linked

|ldd ./ddcui | grep "not found" libddcutil.so.2 => not found |

using Ubuntu 18.04

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rockowitz/ddcui/issues/19?email_source=notifications&email_token=ADMGY3SEJ2OKAT4CX3LGFD3RF6MFNA5CNFSM4LCI6QK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ISYO2RA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMGY3WODPH6L7W5BK5FPULRF6MFNANCNFSM4LCI6QKQ.

gsedej commented 4 years ago

Firstly thank you for reply and extensive explanation.

Yes the link was broken, but I think that I was using actually git version of ddcutil few weeks ago, since apt package was not installed. but i might be wrong, was trying many things...

The ˙sudo ldconfig˙ solved the issue.

It works for both qmake and cmake.

Maybe ldcofig could be mention in installation page.

also qmake does not generate "install" option, while cmake does. This is expected. Also would it be possible to use ddcui/ddcutil without sudo?

.

the answers (before ldconfig!):

$ ldconfig -p | grep ddc
    libddcutil.so.1 (libc6,x86-64) => /usr/local/lib/libddcutil.so.1
    libddcutil.so (libc6,x86-64) => /usr/local/lib/libddcutil.so

so it looks like libddcutil.so.2 is missing but it actually is here: /usr/local/lib/libddcutil.so.2

$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

$ cat /etc/ld.so.conf.d/libc.conf | grep local
/usr/local/lib

so the local is in the libc.conf

i don't remember seeing any error in neither qmake nor cmake

. EDIT: "Shared Library Configuration" link is still broken here: https://github.com/rockowitz/ddcui/blob/master/BUILDING.md