2017-02-26 27 views
1

私はアンドロイドのためにsquid-3.5.24をビルドしようとしています。ビルドにはandroid-ndk-r10eを使用しています。 私の環境はここにあります。このオフに基づいて:完成https://gist.github.com/nddrylliog/4688209アンドロイドのためのスタンドアロンツールチェーンを使用してイカを構築するときの未定義の参照エラー

#!/bin/sh 

# I put all my dev stuff in here 
export DEV_PREFIX=$HOME/Documents 

# Don't forget to adjust this to your NDK path 
export ANDROID_NDK=$HOME/Android/android-ndk-r10e 

export CROSS_COMPILE=arm-linux-androideabi 

# I chose the gcc-4.7 toolchain - works fine for me! 
export ANDROID_PREFIX=$DEV_PREFIX/toolchain/arm-linux-androideabi-4.8 

# Apparently android-8 works fine, there are other versions, look them up 
export SYSROOT=${ANDROID_PREFIX}/sysroot 

export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE} 

# Non-exhaustive lists of compiler + binutils 
# Depending on what you compile, you might need more binutils than that 
export CPP=${CROSS_PATH}-cpp 
export AR=${CROSS_PATH}-ar 
export AS=${CROSS_PATH}-as 
export NM=${CROSS_PATH}-nm 
export CC=${CROSS_PATH}-gcc 
export CXX=${CROSS_PATH}-g++ 
export LD=${CROSS_PATH}-ld 
export RANLIB=${CROSS_PATH}-ranlib 

export PATH=$PATH:$ANDROID_PREFIX/bin 
export PATH=$PATH:${SYSROOT}/usr/lib 
# This is just an empty directory where I want the built objects to be installed 
export PREFIX=${SYSROOT} 

# Don't mix up .pc files from your host and build target 
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig 

# You can clone the full Android sources to get bionic if you want.. I didn't 
# want to so I just got linker.h from here: http://gitorious.org/0xdroid/bionic 
# Note that this was only required to build boehm-gc with dynamic linking support. 
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include" 
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib" 

./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} --prefix=${PREFIX} --cache-file=squid.cache "[email protected]" 

configureが正常に私はmakeを走りました。コンパイル時には、私はこのエラーを取得する:

/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:535: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:535: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
collect2: error: ld returned 1 exit status 
make[3]: *** [basic_smb_lm_auth] Error 1 
make[2]: *** [all-recursive] Error 1 
make[1]: *** [all-recursive] Error 1 
make: *** [all-recursive] Error 1 

私はすでにldに提供されたエラーは、リンカーはlibstdc++またはlibstdc++--v3を見つけることができないとしなければならないが、これらのライブラリはsysroot/usr/libに存在すると思います。

私はライブラリを直接-lstdc++--v3-lstdc++でリンクしようとしましたが、これはgccと構成が混乱しているようです。

現在、私の知恵の終わりで、誰かが正しい方向に私を向けることができますか?ここで

makeからの出力の残りの部分である:

UPDATE
Making all in compat 
make[1]: Nothing to be done for `all'. 
Making all in lib 
Making all in snmplib 
make[2]: Nothing to be done for `all'. 
Making all in rfcnb 
make[2]: Nothing to be done for `all'. 
Making all in smblib 
make[2]: Nothing to be done for `all'. 
Making all in ntlmauth 
make[2]: Nothing to be done for `all'. 
make[2]: Nothing to be done for `all-am'. 
Making all in libltdl 
/Library/Developer/CommandLineTools/usr/bin/make all-am 
make[2]: Nothing to be done for `all-am'. 
Making all in scripts 
make[1]: Nothing to be done for `all'. 
Making all in icons 
make[1]: Nothing to be done for `all'. 
Making all in errors 
make[1]: Nothing to be done for `all'. 
Making all in doc 
Making all in manuals 
make[2]: Nothing to be done for `all'. 
Making all in release-notes 
make[2]: Nothing to be done for `all'. 
make[2]: Nothing to be done for `all-am'. 
Making all in helpers 
Making all in basic_auth 
Making all in DB 
make[3]: Nothing to be done for `all'. 
Making all in MSNT-multi-domain 
make[3]: Nothing to be done for `all'. 
Making all in NCSA 
make[3]: Nothing to be done for `all'. 
Making all in POP3 
make[3]: Nothing to be done for `all'. 
Making all in RADIUS 
make[3]: Nothing to be done for `all'. 
Making all in SMB 
make[3]: Nothing to be done for `all'. 
Making all in SMB_LM 
/bin/sh ../../../libtool --tag=CXX --mode=link /Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-g++ -g -O2 -std=c++11 -L/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/sysroot/usr/lib -L/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/lib -o basic_smb_lm_auth msntauth.o valid.o ../../../lib/smblib/libsmblib.la ../../../lib/rfcnb/librfcnb.la ../../../lib/libmiscencoding.la ../../../compat/libcompat-squid.la -lm 
libtool: link: /Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-g++ -g -O2 -std=c++11 -o basic_smb_lm_auth msntauth.o valid.o -L/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/sysroot/usr/lib -L/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/lib ../../../lib/smblib/.libs/libsmblib.a ../../../lib/rfcnb/.libs/librfcnb.a ../../../lib/.libs/libmiscencoding.a ../../../compat/.libs/libcompat-squid.a -lm 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:535: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:535: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:565: error: undefined reference to 'std::ostream::put(char)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:587: error: undefined reference to 'std::ostream::flush()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_ios.h:49: error: undefined reference to 'std::__throw_bad_cast()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_ios.h:49: error: undefined reference to 'std::cerr' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_ios.h:152: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' 
msntauth.o(.ARM.extab.text._ZNSt6vectorI16domaincontrollerSaIS0_EED2Ev+0x0): error: undefined reference to '__gxx_personality_v0' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' 
msntauth.cc:56: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)' 
msntauth.cc:56: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/vector.tcc:419: error: undefined reference to '__cxa_begin_catch' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/vector.tcc:426: error: undefined reference to '__cxa_rethrow' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/vector.tcc:419: error: undefined reference to '__cxa_end_catch' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/vector.tcc:419: error: undefined reference to '__cxa_end_cleanup' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ext/new_allocator.h:124: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' 
msntauth.o(.ARM.extab.text._ZNSt6vectorI16domaincontrollerSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_+0x0): error: undefined reference to '__gxx_personality_v0' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:2208: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned int, unsigned int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:583: error: undefined reference to 'std::string::swap(std::string&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:2208: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned int, unsigned int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:583: error: undefined reference to 'std::string::swap(std::string&)' 
msntauth.cc:56: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)' 
msntauth.cc:56: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)' 
msntauth.cc:97: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' 
msntauth.cc:98: error: undefined reference to 'std::string::find(char, unsigned int) const' 
msntauth.cc:99: error: undefined reference to 'std::string::find(char, unsigned int) const' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:535: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:2758: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/locale_facets.h:869: error: undefined reference to 'std::ctype<char>::_M_widen_init() const' 
msntauth.cc:107: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' 
msntauth.cc:108: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:113: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:324: error: undefined reference to 'std::__throw_out_of_range(char const*)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to '__cxa_end_cleanup' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_ios.h:49: error: undefined reference to 'std::__throw_bad_cast()' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::string::_Rep::_M_dispose(std::allocator<char> const&)' 
msntauth.cc:115: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/ostream:113: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/bits/basic_string.h:539: error: undefined reference to 'std::cerr' 
/Users/ozojiegerald/Documents/toolchain/arm-linux-androideabi-4.8/include/c++/4.8/iostream:74: error: undefined reference to 'std::ios_base::Init::Init()' 
msntauth.cc:61: error: undefined reference to 'std::ios_base::Init::~Init()' 
msntauth.o(.ARM.extab.text.startup+0x0): error: undefined reference to '__gxx_personality_v0' 
collect2: error: ld returned 1 exit status 
make[3]: *** [basic_smb_lm_auth] Error 1 
make[2]: *** [all-recursive] Error 1 
make[1]: *** [all-recursive] Error 1 
make: *** [all-recursive] Error 1 

android-ndk-r13bに私のNDKを更新し、エラーがあなたがstandalone toolchainを使用してみてください

答えて

1

を持続しました。 NDKビルドシステムでNDKを使用するために特に存在します。彼らはあなたのために必要なすべての旗をどのように渡すかを考え出す作業を行います。 clang++を呼び出すだけです。

NDKも更新する必要があります。 r10は現在3歳です。スタンドアロンのツールチェーンは、かなり最近まではうまくいきませんでした(r12、r13にアップグレードすることもできます)。

+0

返信いただきありがとうございます。私は自分の 'ndk'を' android-ndk-r13b'に更新しましたが、私はまだ同じエラーになります – lordzouga

+0

申し訳ありませんが、私はあなたの質問を誤解しました。自分でビルドしようとするのではなく、すでにスタンドアロンのツールチェーンを使っていたと思います。追加情報を含めるように私の答えを広げました。 –

+0

問題は、 'ndk'を更新して別のツールチェーンを作った後、' -lgnustl_shared'をリンカフラグに追加する必要があることでした。それがこの特定の問題を解決しました。関数が宣言されていないという別のエラーがありましたが、それはまったく別の問題です。助けてくれてありがとう。 – lordzouga

関連する問題