You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Robert J. Gebis (JIRA)" <ji...@apache.org> on 2014/08/04 23:30:15 UTC

[jira] [Commented] (THRIFT-2127) Autoconf scripting does not properly account for cross-compile

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

Robert J. Gebis commented on THRIFT-2127:
-----------------------------------------

I am using todays git clone. Trying to build it on Mac using 

./configure CPPFLAGS='-static' CFLAGS='-static' LDFLAGS='-static' --host=arm-linux-musleabihf --disable-shared --enable-zlib=yes --enable-openssl=yes --enable-libevent=yes --enable-boost=yes -with-zlib=/opt/cross/zlib --with-openssl=/opt/cross/openssl --with-libevent=/opt/cross/libevent --with-boost=/opt/cross/boost --with-cpp --with-python --with-java --without-qt4 --without-csharp --without-erlang --without-perl --without-php --without-php_extension --without-ruby --without-haskell --without-go --without-d --prefix=/opt/cross/thrift-0.9.2

After applying above ax_lib_zlib.m4 and ax_lib_event.m4 I was able to run ./bootstrap and above ./configure

checking for BN_init in -lcrypto... no
configure: error: "Error: libcrypto required."

config.log shows that there is no -L path passed to ld to find it

To fixed it for now I added -I/opt/cross/openssl/include and -L/opt/cross/openssl/lib to CPPFLAGS, CFLAGS and LDFLAGS

This moved me little further and got another error when checking for checking for SSL_ctrl in -lssl
Looking in config.log it looks like linker is complaining about missing -lz since I am building with zlib

I added missing -lz to configure.ac 

AC_CHECK_LIB(crypto,
    BN_init,
    [AC_CHECK_LIB(ssl,
        SSL_ctrl,
        [LIBS="-lssl -lcrypto $LIBS"],
        [AC_MSG_ERROR(["Error: libssl required"])],
        -lcrypto -lz $LIBS
    )],
    [AC_MSG_ERROR(["Error: libcrypto required."])]
)
fi

Looks like $LIBS should include -lz when zlib enabled

Now with all above changes I was able to finally run configure. Here is full parameter list

./configure CPPFLAGS='-static -I/opt/cross/openssl/include -I/opt/cross/zlib/include -I/opt/cross/libevent/include' CFLAGS='-static -I/opt/cross/openssl/include -I/opt/cross/zlib/include -I/opt/cross/libevent/include' LDFLAGS='-static -L/opt/cross/openssl/lib -L/opt/cross/zlib/lib -L/opt/cross/libevent/lib' --host=arm-linux-musleabihf --disable-shared --enable-zlib=yes --enable-openssl=yes --enable-libevent=yes --enable-boost=yes -with-zlib=/opt/cross/zlib --with-openssl=/opt/cross/openssl --with-libevent=/opt/cross/libevent --with-boost=/opt/cross/boost --with-cpp --with-python --with-java --without-qt4 --without-csharp --without-erlang --without-perl --without-php --without-php_extension --without-ruby --without-haskell --without-go --without-d --prefix=/opt/cross/thrift-0.9.2

Now when running make

I get following errors. Looking into it now

make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in compiler/cpp
\
	 \
	/bin/sh ../../ylwrap `test -f 'src/thrifty.yy' || echo './'`src/thrifty.yy y.tab.c thrifty.cc y.tab.h `echo thrifty.cc | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output thrifty.output -- bison -y -d
updating thrifty.hh
/Library/Developer/CommandLineTools/usr/bin/make  all-am
/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift  -I./src -static -I/opt/cross/openssl/include -I/opt/cross/zlib/include -I/opt/cross/libevent/include -Wall -Wno-sign-compare -Wno-unused -std=c++11 -MT libparse_a-thrifty.o -MD -MP -MF .deps/libparse_a-thrifty.Tpo -c -o libparse_a-thrifty.o `test -f 'thrifty.cc' || echo './'`thrifty.cc
mv -f .deps/libparse_a-thrifty.Tpo .deps/libparse_a-thrifty.Po
\
	 \
	/bin/sh ../../ylwrap `test -f 'src/thriftl.ll' || echo './'`src/thriftl.ll lex.yy.c thriftl.cc -- flex
/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift  -I./src -static -I/opt/cross/openssl/include -I/opt/cross/zlib/include -I/opt/cross/libevent/include -Wall -Wno-sign-compare -Wno-unused -std=c++11 -MT libparse_a-thriftl.o -MD -MP -MF .deps/libparse_a-thriftl.Tpo -c -o libparse_a-thriftl.o `test -f 'thriftl.cc' || echo './'`thriftl.cc
thriftl.cc: In function 'void* yyalloc(yy_size_t)':
thriftl.cc:3800:31: error: 'rpl_malloc' was not declared in this scope
  return (void *) malloc( size );
                               ^
thriftl.cc: In function 'void* yyrealloc(void*, yy_size_t)':
thriftl.cc:3812:46: error: 'rpl_realloc' was not declared in this scope
  return (void *) realloc( (char *) ptr, size );
                                              ^
thriftl.cc: In function 'void* yyalloc(yy_size_t)':
thriftl.cc:3801:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
thriftl.cc: In function 'void* yyrealloc(void*, yy_size_t)':
thriftl.cc:3813:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[3]: *** [libparse_a-thriftl.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


> 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)