1

I am making a dabian binary package for local use. dpkg-buildpackage -rfakeroot is failed due to below error.

find /home/dwft78/project/CoreScanner/cscore-1.0/lib -name "libcs*" -type f -exec cp -f {} /home/dwft78/project/CoreScanner/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
find /home/dwft78/project/CoreScanner/cscore-1.0/lib -name "libcs*" -type l -exec cp -Rf {} /home/dwft78/project/CoreScanner/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
make[1]: Leaving directory `/home/dwft78/project/CoreScanner/cscore-1.0'
   dh_install
   dh_installdocs
   dh_installchangelogs
   dh_installexamples
   dh_installman
   dh_installcatalogs
   dh_installcron
   dh_installdebconf
   dh_installemacsen
   dh_installifupdown
   dh_installinfo
   dh_pysupport
dh_pysupport: This program is deprecated, you should use dh_python2 instead. Migration guide: http://deb.li/dhs2p
   dh_installinit
   dh_installmenu
   dh_installmime
   dh_installmodules
   dh_installlogcheck
   dh_installlogrotate
   dh_installpam
   dh_installppp
   dh_installudev
   dh_installwm
   dh_installxfonts
   dh_installgsettings
   dh_bugfiles
   dh_ucf
   dh_lintian
   dh_gconf
   dh_icons
   dh_perl
   dh_usrlocal
   dh_link
   dh_compress
   dh_fixperms
   dh_strip
   dh_makeshlibs
   dh_shlibdeps
dpkg-shlibdeps: warning: debian/cscore/opt/motorola-scanner/bin/libcs-common.so.1.0.0 contains an unresolvable reference to symbol g_CoreScannerLoggingContext: it's probably a plugin.
dpkg-shlibdeps: warning: 1 similar warning has been skipped (use -v to see it).
dpkg-shlibdeps: error: couldn't find library libcs-comm.so.1.0.0 needed by debian/cscore/opt/motorola-scanner/bin/libcscl-snapi.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-client.so.1.0.0 needed by debian/cscore/opt/motorola-scanner/bin/libcs-jni.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: warning: debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-common.so.1.0.0 contains an unresolvable reference to symbol g_CoreScannerLoggingContext: it's probably a plugin.
dpkg-shlibdeps: warning: 1 similar warning has been skipped (use -v to see it).
dpkg-shlibdeps: error: couldn't find library libcs-comm.so.1.0.0 needed by debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcscl-snapi.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-common.so.1.0.0 needed by debian/cscore/opt/motorola-scanner/bin/libcs-comm.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-common.so.1.0.0 needed by debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-comm.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-common.so.1.0.0 needed by debian/cscore/opt/motorola-scanner/bin/libcs-client.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-common.so.1.0.0 needed by debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-client.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: couldn't find library libcs-client.so.1.0.0 needed by debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-jni.so.1.0.0 (ELF format: 'elf64-x86-64'; RPATH: '').
dpkg-shlibdeps: error: Cannot continue due to the errors listed above.
Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
dh_shlibdeps: dpkg-shlibdeps -Tdebian/cscore.substvars debian/cscore/debian/cscore/opt/motorola-scanner/bin/cscore debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcscl-snapi.so.1.0.0 debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-client.so.1.0.0 debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-common.so.1.0.0 debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-jni.so.1.0.0 debian/cscore/debian/cscore/opt/motorola-scanner/bin/libcs-comm.so.1.0.0 debian/cscore/opt/motorola-scanner/bin/cscore debian/cscore/opt/motorola-scanner/bin/libcscl-snapi.so.1.0.0 debian/cscore/opt/motorola-scanner/bin/libcs-client.so.1.0.0 debian/cscore/opt/motorola-scanner/bin/libcs-common.so.1.0.0 debian/cscore/opt/motorola-scanner/bin/libcs-jni.so.1.0.0 debian/cscore/opt/motorola-scanner/bin/libcs-comm.so.1.0.0 returned exit code 2
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

all these libraries are generating to "/home/dwft78/project/CoreScanner/cscore-1.0/lib/Linux/x86_64"

Contents of debian/rules is

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_COMPAT=5

%:
        dh $@

As the error message indicates "To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH" how can I load those inside debian/rules file ? or otherwise is this occurred due to an another reason ?

Dig The Code
  • 658
  • 2
  • 15
  • 32

2 Answers2

6

Something like that could just do the trick:

#!/usr/bin/make -f

export DH_COMPAT=5 # though I don't know what for...

%:
    dh $@

override_dh_shlibdeps:
    dh_shlibdeps -l$(shell pwd)/lib/Linux/$(DEB_BUILD_GNU_CPU)

Edit

I just remembered there was an option to dh_shlibdeps which even got attention regarding problems with setting LD_LIBRARY_PATH in cross-builds, so this should be the option of choice. Disclaimer: I didn't test it. (I'm curious if it works out, though.) See the dh_shlibdeps manual page.

jhr
  • 190
  • 1
  • 6
  • while this could "just do the trick", it's really asking for trouble: the full path given here will *only* work as long as the package is built by the given user (*dwft78*) **and** they do not change their filesystem layout **and** the `cscore` is locked to version 1.0; these are way to many constraints. using `$(shell pwd)` instead should give you better results – umläute Jun 03 '14 at 07:47
  • I assumed that something this obvious occurs to people that are building debian packages. But yeah, you can use that. And yet, it leaves out the architecture which is part of the path - and thus also build-dependent, just as your solution leaves out that detail. – jhr Jun 03 '14 at 07:56
  • No problem, and - as a bonus ;) - I also added the arch variable. – jhr Jun 03 '14 at 08:05
  • @umläute You're still using the wrong variable for the architecture in your solution. It's DEB_BUILD_GNU_CPU, not DEB_BUILD_ARCH what you're looking for. – jhr Jun 03 '14 at 08:11
  • as mentioned in my answer, the correct value for the architucture depends on the build-system of the package; most likely, it is totally unrelated to any `DEB_`-variable (though you are right, `DEB_BUILD_ARCH` evaluates to "amd64" which is wrong) – umläute Jun 03 '14 at 10:51
1

how about just exporting LD_LIBRARY_PATH in debian/rules?

 #!/usr/bin/make -f

 export LD_LIBRARY_PATH=$(shell pwd)/lib/Linux/$(DEB_BUILD_GNU_CPU)

 %:
      dh $@

note

i'm using $(DEB_BUILD_GNU_CPU) here to calculate the value of x86_64. this might give the correct result (it will return i386 on 32bit systems), but is most likely not what the build-system of your package uses to determine the architecture specific part of the path, and thus might fail.

another option (and again a wild guess) would be to use $(shell uname -m) (which will return i686 on most modern 32bit systems, and x86_64 on 64bit systems).

in order to find out what you really should use here, you might want to inspect the build-system of your package.

sidenote

you probably should not set the DH_COMPAT level in debian/rules but instead use the debian/compat file:

$ echo 5 > debian/compat
umläute
  • 28,885
  • 9
  • 68
  • 122
  • I got `ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. dh_testdir -O--buildsystem=cmake` – Necktwi Nov 26 '16 at 10:39