Search code examples
linuxredhatrpm

Is there a way to tell rpm manager "don't seek XXX.so, because it is included in this rpm."?


I built a RPM, which contains some executables made by me and some .so provided by 3rd SDKs

If I manually do the copy work, like make install DESTDIR=/, then all ld dependence is fine.

[shaozr@centos1 lib]$ cd /opt/tymonitor/SDKs/Hik64/lib
[shaozr@centos1 lib]$ ll
total 18444
drwxr-xr-x. 2 root root    4096 Jul 23 14:31 HCNetSDKCom
-rwxr-xr-x. 1 root root  343864 Jul 23 14:31 HikAdapter        <== This is my exe, all other binaries come from 3rd SDK
-rw-r--r--. 1 root root   29192 Jul 23 14:31 libAudioRender.so
-rw-r--r--. 1 root root 2484814 Jul 23 14:31 libcrypto.so
-rw-r--r--. 1 root root 2484814 Jul 23 14:31 libcrypto.so.1.0.0
-rw-r--r--. 1 root root 2252728 Jul 23 14:31 libHCCore.so
-rw-r--r--. 1 root root  541128 Jul 23 14:31 libhcnetsdk.so
-rw-r--r--. 1 root root  400144 Jul 23 14:31 libhpr.so
-rw-r--r--. 1 root root 2024584 Jul 23 14:31 libNPQos.so
-rw-r--r--. 1 root root 1956138 Jul 23 14:31 libopenal.so.1
-rw-r--r--. 1 root root 4705408 Jul 23 14:31 libPlayCtrl.so
-rw-r--r--. 1 root root  495218 Jul 23 14:31 libssl.so
-rw-r--r--. 1 root root 1032864 Jul 23 14:31 libSuperRender.so
-rw-r--r--. 1 root root  103941 Jul 23 14:31 libz.so

and let's check ld dependency:

[shaozr@centos1 lib]$ ldd ./HikAdapter
    linux-vdso.so.1 =>  (0x00007ffef3e8c000)
    libhcnetsdk.so => /opt/tymonitor/SDKs/Hik64/lib/libhcnetsdk.so (0x00007f8dfe762000)
    libhpr.so => /opt/tymonitor/SDKs/Hik64/lib/libhpr.so (0x00007f8dfdd58000)
    libHCCore.so => /opt/tymonitor/SDKs/Hik64/lib/libHCCore.so (0x00007f8dfd744000)
    libevent-2.0.so.5 => /lib64/libevent-2.0.so.5 (0x00007f8dfd4fc000)
    libevent_pthreads-2.0.so.5 => /lib64/libevent_pthreads-2.0.so.5 (0x00007f8dfd2f9000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f8dfcff2000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f8dfccf0000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8dfcada000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8dfc8be000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f8dfc4f0000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f8dfc2e8000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f8dfc0e4000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f8dfbedf000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8dfe6c6000)

because I embedded rpath in the exe.

readelf -d HikAdapter |grep rpath
 0x000000000000000f (RPATH)              Library rpath: [/opt/tymonitor/SDKs/Hik64/lib:./:./HCNetSDKCom]

The problems is that when I install my rpm, it seems that rpm manager doesn't know I already carried the depency so, and it tries to seek what package can provide them, obviously it failed.

#yum install tymonitor-0.0.1-1.el7.x86_64.rpm
...  
Examining tymonitor-0.0.1-1.el7.x86_64.rpm: tymonitor-0.0.1-1.el7.x86_64
Marking tymonitor-0.0.1-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package tymonitor.x86_64 0:0.0.1-1.el7 will be installed
--> Processing Dependency: libHCCore.so()(64bit) for package: tymonitor-0.0.1-1.el7.x86_64
--> Processing Dependency: libhcnetsdk.so()(64bit) for package: tymonitor-0.0.1-1.el7.x86_64
--> Processing Dependency: libhpr.so()(64bit) for package: tymonitor-0.0.1-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: tymonitor-0.0.1-1.el7.x86_64 (/tymonitor-0.0.1-1.el7.x86_64)
           Requires: libHCCore.so()(64bit)
Error: Package: tymonitor-0.0.1-1.el7.x86_64 (/tymonitor-0.0.1-1.el7.x86_64)
           Requires: libhpr.so()(64bit)
Error: Package: tymonitor-0.0.1-1.el7.x86_64 (/tymonitor-0.0.1-1.el7.x86_64)
           Requires: libhcnetsdk.so()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Is there a way to tell rpm manager "don't seek XXX.so, because it is included in this rpm." ?


Solution

  • As a workaround, you can turn off RPM's automatic dependency processing with

    AutoReqProv: no
    

    There may be a better solution though.

    RPM has two scripts find-provides and find-requires, in /usr/lib/rpm or similar, that it uses to work out the shared library dependencies of all your bundles executables. It looks like what you've done has confused one or both of these. I guess the best answer would be to correct these lists, perhaps using Provides: or %files, but I don't know how to do that. (It looks like Fedora's solution is to modify the list of files that find_provides and find_requires process.)