[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sbuild crosscompiler not searching /usr/include/arm-linux-gnueabihf



+++ nice sw123 [2015-09-17 09:59 +0200]:
> On Wed, Sep 16, 2015 at 11:10 PM, Johannes Schauer wrote
> On Thu, Sep 17, 2015 at 1:05 AM, Wookey wrote
> 
> Thanks you both for the insightful replies!
> 
> 
> Anyway I've got it working now (package mosquitto crosscompiled to armhf)!
> 
> 
> On Thu, Sep 17, 2015 at 1:05 AM, Wookey wrote
> > However as you've already found this fails to search /usr/include/arm-linux-gnueabihf for openssl/opensslconf.h
> >
> 
> The FIX for this is:
> 
> Change ~/.sbuildrc to have:
> 
> $build_environment = {
>                        'CC' => 'arm-linux-gnueabihf-gcc',
>                        'CXX' => 'arm-linux-gnueabihf-g++'
> };

Aha. Yes, so that not the right fix. That's the 'use a bigger hammer' option.

The point here is that the package should be building with
<triplet>-gcc not 'cc'. Overriding it completely in sbuild works, but
you don't want to do that for everything - it is wrong for native
builds, wrong for other arches and wrong for builds that do some
native stuff and some foreign stuff.
 
The right fix is to fix it in the rules file:
diff -Nru mosquitto-1.4.3/debian/rules mosquitto-1.4.3/debian/rules
--- mosquitto-1.4.3/debian/rules        2015-08-19 10:31:01.000000000 +0100
+++ mosquitto-1.4.3/debian/rules        2015-09-17 16:17:42.000000000 +0100
@@ -5,8 +5,10 @@
 
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+include /usr/share/dpkg/architecture.mk
+
 %:
-       dh $@
+       CC=${DEB_HOST_GNU_TYPE}-gcc CXX=${DEB_HOST_GNU_TYPE}-g++ dh $@

In this case (because the package already has a $CROSS_COMPILE
variable in its makefile) one could instead use the more compact but less generic:
+       CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- dh $@

There is some advice on such packaging fixes at:
https://wiki.debian.org/CrossBuildPackagingGuidelines

> > But I now get an error at the end:
> > dpkg-shlibdeps: error: couldn't find library libstdc++.so.6 needed by
> > debian/libmosquittopp1/usr/lib/arm-linux-gnueabihf/libmosquittopp.so.1
> > (ELF format: 'elf32-littlearm'; RPATH: '')
> > dpkg-shlibdeps: error: cannot continue due to the error above
> > Note: libraries are not searched in other binary packages that do not
> > have any shlibs or symbols file.
> >
> 
> The (hacky) fix for this is:
> 
> Add the following to
> mosquitto-1.4.3/debian/rules
> 
> override_dh_shlibdeps:
>         LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$(LD_LIBRARY_PATH)
> dh_shlibdeps

> Any way for scripting this? My other attemps at getting this working
> all failed. My attempts were...

Yes, This would be generic:
override_dh_shlibdeps:
         LD_LIBRARY_PATH=/usr/${DEB_HOST_MULTIARCH}/lib:$(LD_LIBRARY_PATH)
 dh_shlibdeps

(Needs the above 'include /usr/share/dpkg/architecture.mk' to set the
variables, or an explicit call to dpkg-architecture)

dh_shlibdeps should get this right when those variables are set so
maybe this is not actually needed. (I can't check because I'm not
getting that far - I'm getting a different whinge about linker not
built with sysroot support)
 
Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/


Reply to: