[ 
https://issues.apache.org/jira/browse/THRIFT-2127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13921212#comment-13921212
 ] 

JF Gauvin edited comment on THRIFT-2127 at 3/6/14 6:15 PM:
-----------------------------------------------------------

Thanks for your comments. It's now compiling, but only when I'm not using 
libevent and zlib (checking version fail). Notice that I uninstalled Boost, 
libevent and zlib (dev) on the build machine to make sure it's using the 
libraries for my target...

I've attached the patch. But, I'm not sure if removing AC_FUNC_MALLOC and 
AC_FUNC_REALLOC in configure.ac is the best thing to do.

{code}
diff -rupN thrift-0.9.1.orig/aclocal/ax_boost_base.m4 
thrift-0.9.1/aclocal/ax_boost_base.m4
--- thrift-0.9.1.orig/aclocal/ax_boost_base.m4  2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_boost_base.m4       2014-03-05 08:48:10.198227434 
-0500
@@ -72,7 +72,7 @@ if test "x$want_boost" = "xyes"; then
                BOOST_CPPFLAGS="-I$ac_boost_path/include"
                BOOST_ROOT_PATH="$ac_boost_path"
        else
-               for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+               for ac_boost_path_tmp in $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/local ; do
                        if test -d "$ac_boost_path_tmp/include/boost" && test 
-r "$ac_boost_path_tmp/include/boost"; then
                                BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
                                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
@@ -129,7 +129,7 @@ if test "x$want_boost" = "xyes"; then
                                done
                        fi
                else
-                       for ac_boost_path in /usr /usr/local /opt /opt/local ; 
do
+                       for ac_boost_path in $lt_sysroot/usr 
$lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
                                if test -d "$ac_boost_path" && test -r 
"$ac_boost_path"; then
                                        for i in `ls -d 
$ac_boost_path/include/boost-* 2>/dev/null`; do
                                                _version_tmp=`echo $i | sed 
"s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
diff -rupN thrift-0.9.1.orig/aclocal/ax_lib_event.m4 
thrift-0.9.1/aclocal/ax_lib_event.m4
--- thrift-0.9.1.orig/aclocal/ax_lib_event.m4   2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_lib_event.m4        2014-03-05 08:48:10.198227434 
-0500
@@ -75,7 +75,7 @@ AC_DEFUN([AX_LIB_EVENT_DO_CHECK],
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling,
           dnl but then the version cannot be checked.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <sys/types.h>
           #include <event.h>
           ]], [[
@@ -165,7 +165,7 @@ AC_DEFUN([AX_LIB_EVENT],
             if test -n "$ax_libevent_path"; then
               AX_LIB_EVENT_DO_CHECK
             else
-              for ax_libevent_path in "" /usr /usr/local /opt /opt/local 
/opt/libevent "$LIBEVENT_ROOT" ; do
+              for ax_libevent_path in "" $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/local $lt_sysroot/opt/libevent "$LIBEVENT_ROOT" 
; do
                 AX_LIB_EVENT_DO_CHECK
                 if test "$success" = "yes"; then
                   break;
diff -rupN thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4 
thrift-0.9.1/aclocal/ax_lib_zlib.m4
--- thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4    2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_lib_zlib.m4 2014-03-05 08:48:10.198227434 -0500
@@ -73,7 +73,7 @@ AC_DEFUN([AX_LIB_ZLIB_DO_CHECK],
           #   (defined in the library).
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <zlib.h>
           #if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
           #else
@@ -145,7 +145,7 @@ AC_DEFUN([AX_LIB_ZLIB],
             if test -n "$ax_zlib_path"; then
               AX_LIB_ZLIB_DO_CHECK
             else
-              for ax_zlib_path in "" /usr /usr/local /opt /opt/zlib 
"$ZLIB_ROOT" ; do
+              for ax_zlib_path in "" $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/zlib "$ZLIB_ROOT" ; do
                 AX_LIB_ZLIB_DO_CHECK
                 if test "$success" = "yes"; then
                   break;
diff -rupN thrift-0.9.1.orig/configure.ac thrift-0.9.1/configure.ac
--- thrift-0.9.1.orig/configure.ac      2013-08-18 11:28:23.000000000 -0400
+++ thrift-0.9.1/configure.ac   2014-03-05 08:48:10.242260764 -0500
@@ -214,7 +214,6 @@ AX_THRIFT_LIB(php_extension, [PHP_EXTENS
 if test "$with_php_extension" = "yes"; then
   AC_PATH_PROG([PHP_CONFIG], [php-config])
   if test -n "$PHP_CONFIG" ; then
-    AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
     have_php_extension="yes"
   fi
 fi
@@ -350,13 +349,26 @@ AM_CONDITIONAL(HAVE_DEIMOS_OPENSSL, [tes
 AM_CONDITIONAL(WITH_D_SSL_TESTS, [test "$with_d_ssl_tests" = "yes"])
 AC_SUBST(DMD_OPENSSL_FLAGS)
 
-
+AC_ARG_ENABLE([tests],
+  AS_HELP_STRING([--enable-tests], [build tests [default=yes]]),
+  [], enable_tests=yes
+)
 have_tests=yes
-if test "$with_tests" = "no"; then
+if test "$enable_tests" = "no"; then
   have_tests="no"
 fi
 AM_CONDITIONAL(WITH_TESTS, [test "$have_tests" = "yes"])
 
+AC_ARG_ENABLE([tutorial],
+  AS_HELP_STRING([--enable-tutorial], [build tutorial [default=yes]]),
+  [], enable_tutorial=yes
+)
+have_tutorial=yes
+if test "$enable_tutorial" = "no"; then
+  have_tutorial="no"
+fi
+AM_CONDITIONAL(WITH_TUTORIAL, [test "$have_tutorial" = "yes"])
+
 AM_CONDITIONAL(MINGW, false)
 case "${host_os}" in
 *mingw*)
@@ -454,9 +466,9 @@ AC_CHECK_DECL([AI_ADDRCONFIG], [],
 
 AC_FUNC_ALLOCA
 AC_FUNC_FORK
-AC_FUNC_MALLOC
+dnl AC_FUNC_MALLOC
 AC_FUNC_MEMCMP
-AC_FUNC_REALLOC
+dnl AC_FUNC_REALLOC
 AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_STAT
 AC_FUNC_STRERROR_R
diff -rupN thrift-0.9.1.orig/Makefile.am thrift-0.9.1/Makefile.am
--- thrift-0.9.1.orig/Makefile.am       2013-08-15 20:14:48.000000000 -0400
+++ thrift-0.9.1/Makefile.am    2014-03-05 08:48:10.242260764 -0500
@@ -19,13 +19,15 @@
 
 ACLOCAL_AMFLAGS = -I ./aclocal
 
-SUBDIRS = compiler/cpp lib tutorial
+SUBDIRS = compiler/cpp lib
 
 if WITH_TESTS
 SUBDIRS += test
 endif
 
+if WITH_TUTORIAL
 SUBDIRS += tutorial
+endif
 
 dist-hook:
        find $(distdir) -type f \( -iname ".DS_Store" -or -iname "._*" -or 
-iname ".gitignore" \) | xargs rm -rf
{code}


was (Author: jfgauvin):
Thanks for your comments. It's now compiling, but only when I'm not using 
libevent and zlib (checking version fail). Notice that I uninstalled Boost, 
libevent and zlib (dev). 

I've attached the patch. But, I'm not sure if removing AC_FUNC_MALLOC and 
AC_FUNC_REALLOC in configure.ac is the best thing to do.

{code}
diff -rupN thrift-0.9.1.orig/aclocal/ax_boost_base.m4 
thrift-0.9.1/aclocal/ax_boost_base.m4
--- thrift-0.9.1.orig/aclocal/ax_boost_base.m4  2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_boost_base.m4       2014-03-05 08:48:10.198227434 
-0500
@@ -72,7 +72,7 @@ if test "x$want_boost" = "xyes"; then
                BOOST_CPPFLAGS="-I$ac_boost_path/include"
                BOOST_ROOT_PATH="$ac_boost_path"
        else
-               for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+               for ac_boost_path_tmp in $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/local ; do
                        if test -d "$ac_boost_path_tmp/include/boost" && test 
-r "$ac_boost_path_tmp/include/boost"; then
                                BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
                                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
@@ -129,7 +129,7 @@ if test "x$want_boost" = "xyes"; then
                                done
                        fi
                else
-                       for ac_boost_path in /usr /usr/local /opt /opt/local ; 
do
+                       for ac_boost_path in $lt_sysroot/usr 
$lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
                                if test -d "$ac_boost_path" && test -r 
"$ac_boost_path"; then
                                        for i in `ls -d 
$ac_boost_path/include/boost-* 2>/dev/null`; do
                                                _version_tmp=`echo $i | sed 
"s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
diff -rupN thrift-0.9.1.orig/aclocal/ax_lib_event.m4 
thrift-0.9.1/aclocal/ax_lib_event.m4
--- thrift-0.9.1.orig/aclocal/ax_lib_event.m4   2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_lib_event.m4        2014-03-05 08:48:10.198227434 
-0500
@@ -75,7 +75,7 @@ AC_DEFUN([AX_LIB_EVENT_DO_CHECK],
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling,
           dnl but then the version cannot be checked.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <sys/types.h>
           #include <event.h>
           ]], [[
@@ -165,7 +165,7 @@ AC_DEFUN([AX_LIB_EVENT],
             if test -n "$ax_libevent_path"; then
               AX_LIB_EVENT_DO_CHECK
             else
-              for ax_libevent_path in "" /usr /usr/local /opt /opt/local 
/opt/libevent "$LIBEVENT_ROOT" ; do
+              for ax_libevent_path in "" $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/local $lt_sysroot/opt/libevent "$LIBEVENT_ROOT" 
; do
                 AX_LIB_EVENT_DO_CHECK
                 if test "$success" = "yes"; then
                   break;
diff -rupN thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4 
thrift-0.9.1/aclocal/ax_lib_zlib.m4
--- thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4    2013-08-15 10:04:29.000000000 
-0400
+++ thrift-0.9.1/aclocal/ax_lib_zlib.m4 2014-03-05 08:48:10.198227434 -0500
@@ -73,7 +73,7 @@ AC_DEFUN([AX_LIB_ZLIB_DO_CHECK],
           #   (defined in the library).
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <zlib.h>
           #if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
           #else
@@ -145,7 +145,7 @@ AC_DEFUN([AX_LIB_ZLIB],
             if test -n "$ax_zlib_path"; then
               AX_LIB_ZLIB_DO_CHECK
             else
-              for ax_zlib_path in "" /usr /usr/local /opt /opt/zlib 
"$ZLIB_ROOT" ; do
+              for ax_zlib_path in "" $lt_sysroot/usr $lt_sysroot/usr/local 
$lt_sysroot/opt $lt_sysroot/opt/zlib "$ZLIB_ROOT" ; do
                 AX_LIB_ZLIB_DO_CHECK
                 if test "$success" = "yes"; then
                   break;
diff -rupN thrift-0.9.1.orig/configure.ac thrift-0.9.1/configure.ac
--- thrift-0.9.1.orig/configure.ac      2013-08-18 11:28:23.000000000 -0400
+++ thrift-0.9.1/configure.ac   2014-03-05 08:48:10.242260764 -0500
@@ -214,7 +214,6 @@ AX_THRIFT_LIB(php_extension, [PHP_EXTENS
 if test "$with_php_extension" = "yes"; then
   AC_PATH_PROG([PHP_CONFIG], [php-config])
   if test -n "$PHP_CONFIG" ; then
-    AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
     have_php_extension="yes"
   fi
 fi
@@ -350,13 +349,26 @@ AM_CONDITIONAL(HAVE_DEIMOS_OPENSSL, [tes
 AM_CONDITIONAL(WITH_D_SSL_TESTS, [test "$with_d_ssl_tests" = "yes"])
 AC_SUBST(DMD_OPENSSL_FLAGS)
 
-
+AC_ARG_ENABLE([tests],
+  AS_HELP_STRING([--enable-tests], [build tests [default=yes]]),
+  [], enable_tests=yes
+)
 have_tests=yes
-if test "$with_tests" = "no"; then
+if test "$enable_tests" = "no"; then
   have_tests="no"
 fi
 AM_CONDITIONAL(WITH_TESTS, [test "$have_tests" = "yes"])
 
+AC_ARG_ENABLE([tutorial],
+  AS_HELP_STRING([--enable-tutorial], [build tutorial [default=yes]]),
+  [], enable_tutorial=yes
+)
+have_tutorial=yes
+if test "$enable_tutorial" = "no"; then
+  have_tutorial="no"
+fi
+AM_CONDITIONAL(WITH_TUTORIAL, [test "$have_tutorial" = "yes"])
+
 AM_CONDITIONAL(MINGW, false)
 case "${host_os}" in
 *mingw*)
@@ -454,9 +466,9 @@ AC_CHECK_DECL([AI_ADDRCONFIG], [],
 
 AC_FUNC_ALLOCA
 AC_FUNC_FORK
-AC_FUNC_MALLOC
+dnl AC_FUNC_MALLOC
 AC_FUNC_MEMCMP
-AC_FUNC_REALLOC
+dnl AC_FUNC_REALLOC
 AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_STAT
 AC_FUNC_STRERROR_R
diff -rupN thrift-0.9.1.orig/Makefile.am thrift-0.9.1/Makefile.am
--- thrift-0.9.1.orig/Makefile.am       2013-08-15 20:14:48.000000000 -0400
+++ thrift-0.9.1/Makefile.am    2014-03-05 08:48:10.242260764 -0500
@@ -19,13 +19,15 @@
 
 ACLOCAL_AMFLAGS = -I ./aclocal
 
-SUBDIRS = compiler/cpp lib tutorial
+SUBDIRS = compiler/cpp lib
 
 if WITH_TESTS
 SUBDIRS += test
 endif
 
+if WITH_TUTORIAL
 SUBDIRS += tutorial
+endif
 
 dist-hook:
        find $(distdir) -type f \( -iname ".DS_Store" -or -iname "._*" -or 
-iname ".gitignore" \) | xargs rm -rf
{code}

> Autoconf scripting does not properly account for cross-compile
> --------------------------------------------------------------
>
>                 Key: THRIFT-2127
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2127
>             Project: Thrift
>          Issue Type: Bug
>          Components: Build Process
>    Affects Versions: 0.9
>         Environment: Ubuntu 12.04 running OpenEmbedded Dylan
>            Reporter: Frank Earl
>            Assignee: Jake Farrell
>         Attachments: fix_autoconf_crosscompile_leaks.patch
>
>
> Trying to get Thrift to Cross-compile within OpenEmbedded to get an ARM based 
> build combined with a full-on SDK for our embedded target.  So far, I'm 
> getting this:
> configure:16347: checking for boostlib >= 1.40.0
> configure:16401: arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork 
> -mfloat-abi=softfp -mfpu=neon 
> --sysroot=/home/fearl/git/dc_image_build/poky/build/tmp/sysroots/beaglebone 
> -c -O2 -pipe -g -feliminate-unused-debug-types -fpermissive 
> -fvisibility-inlines-hidden  -I/usr/include conftest.cpp >&5
> cc1plus: warning: include location "/usr/include" is unsafe for 
> cross-compilation [-Wpoison-system-directories]
> configure:16401: $? = 0
> This means it's grabbing from outside the sysroot- which can present bad 
> results on the cross-compile pass.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to