Hello all,
        While trying to build my user space application in yocto, the boost.m4
was looking packages in the host (i.e host contamination, thereby
resulting in configure error). This appears to be a problem in boost.m4
which ignores the sysroot option while searching for libraries. In the
libtool recipe of yocto I find that --with-sysroot option has been
renamed to --with-libtool-sysroot. 

To address this problem, I've written a patch for boost.m4 specifically
for yocto. I believe this will be helpful to others who are using boost
libraries. I guess, I have to send a separate patch to boost.m4
maintainer using '$with-sysroot' variable.

Regards
Joshua
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
diff --git a/boost.m4 b/boost.m4
index b1cb1b1..4f1a0d1 100644
--- a/boost.m4
+++ b/boost.m4
@@ -374,13 +374,27 @@ for boost_rtopt_ in $boost_rtopt '' -d; do
     case $boost_failed_libs in #(
       *@$boost_lib@*) continue;;
     esac
-    # If with_boost is empty, we'll search in /lib first, which is not quite
-    # right so instead we'll try to a location based on where the headers are.
-    boost_tmp_lib=$with_boost
-    test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
-    for boost_ldpath in "$boost_tmp_lib/lib" '' \
-             /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
-             "$with_boost" C:/Boost/lib /lib*
+    # If with_boost is empty, we'll search in /lib first, which is not
+    # quite right so instead we'll try to a location based on where
+    # the headers are.  If with_sysroot is specified then we prepend
+    # with_sysroot path to the boost_tmp_lib variable
+    if [[ -z ${with_libtool_sysroot+xxx} ]]; then
+       # with_sysroot variable not set at all
+      boost_tmp_lib=${with_boost}/lib
+      test x"$with_boost" = x && boost_tmp_lib="${boost_cv_inc_path%/include} \
+           /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
+           ${with_boost} C:/Boost/lib /lib*"
+    else
+      boost_tmp_lib="${with_libtool_sysroot}/${boost_cv_inc_path%/include} \
+                  ${with_libtool_sysroot}/opt/local/lib* \
+                  ${with_libtool_sysroot}/usr/local/lib* \
+                  ${with_libtool_sysroot}/lib* \
+                  ${with_libtool_sysroot}/usr/lib* \
+                  ${with_libtool_sysroot}/opt/lib* \
+                  ${with_libtool_sysroot}/Boost/lib ${with_boost}"
+    fi
+
+    for boost_ldpath in $boost_tmp_lib
     do
       test -e "$boost_ldpath" || continue
       boost_save_LDFLAGS=$LDFLAGS
@@ -1107,11 +1121,11 @@ boost_use_source=:
 test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
   _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
 AS_IF([_AC_DO_STDERR($ac_link) && {
-	 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
-	 test ! -s conftest.err
+        test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
+        test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_executable_p conftest$ac_exeext
+        test "$cross_compiling" = yes ||
+        $as_executable_p conftest$ac_exeext
 dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
        }],
       [$2],

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to