Skip to contentSkip to conversation

sysroot and boost.m4 library search path problem

PATCH Joshua Immanuel 2 participants 5 messages Feb 8, 2012 – Feb 9, 2012

lore
Share & tools
lore
#0 lore raw

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

Signature · 3 lines
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
boost.m4 +25 -11
index b1cb1b1..4f1a0d1 100644
@@ -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],
#1 lore raw

Hello all,

Quoted 4 lines · Joshua Immanuel

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.

Forgot to mention, the issue already has been reported for boost.m4 at
https://github.com/tsuna/boost.m4/issues/26
I have added my patch (not yocto specific one) there too.

Regards
Joshua

Signature · 3 lines
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
#2 lore raw

Joshua,

Did you consider taking this patch and adding it to the proper recipe?

-M

Quoted 24 lines · Joshua Immanuel

Hello all,

Quoted 4 lines · Joshua Immanuel

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.

Forgot to mention, the issue already has been reported for boost.m4 at
https://github.com/tsuna/boost.m4/issues/26
I have added my patch (not yocto specific one) there too.

Regards
Joshua
--
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#3 lore raw

Hello McClintock,

Quoted 1 line · On Wed, 2012-02-08 at 15:44 +0000, McClintock Matthew-B29882 wrote:

Did you consider taking this patch and adding it to the proper recipe?

The patch is basically for boost.m4. We have the boost package in 'meta' layer. But, boost.m4 is not a part of boost library, it is maintained separately. As the boost doesn't support pkgconfig, boost.m4 comes to the rescue for finding installed boost libraries.

So, this doesn't fit into any existing recipe. Whichever (autotools build system based) application uses boost library will obviously use boost.m4 and this patch is for them.

Regards
Joshua

Signature · 3 lines
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
#4 lore raw
Quoted 5 lines · Joshua Immanuel

Hello McClintock,

Quoted 1 line · On Wed, 2012-02-08 at 15:44 +0000, McClintock Matthew-B29882 wrote:

Did you consider taking this patch and adding it to the proper recipe?

Quoted 8 lines

The patch is basically for boost.m4. We have the boost package in 'meta' layer. But, boost.m4 is not a part of boost library, it is maintained separately. As the boost doesn't support pkgconfig, boost.m4 comes to the rescue for finding installed boost libraries.

So, this doesn't fit into any existing recipe. Whichever (autotools build system based) application uses boost library will obviously use boost.m4 and this patch is for them.

Do we need to add a recipe for boost.m4 and then apply your patch on top?

-M