Great, I'm glad that worked--that was just a guess, but I happen to have a pull request that will fully qualify types like std::map and std::pair, instead of relying on "using" statements in common.h: https://github.com/google/protobuf/pull/4209 So once I get that pull request merged, the problem should disappear without you having to make that local modification.
On Thu, Jan 25, 2018 at 9:59 PM, <[email protected]> wrote: > Yes it went away after I modified with map to std::map. Thanks Adam. > Is this the best way or just a workaround? > > br > Haisheng > > On Friday, January 26, 2018 at 7:42:01 AM UTC+8, Adam Cozzette wrote: >> >> Does the error go away if you replace map with std::map? >> >> On Mon, Jan 22, 2018 at 9:20 PM, <[email protected]> wrote: >> >>> Hi, >>> >>> I've read this topic which helped me a lot: >>> https://groups.google.com/forum/#!searchin/protobuf/arm%7Cso >>> rt:date/protobuf/BbYvBRqQyUQ/XHrCGz2cBQAJ >>> >>> >>> Previously, I tried to build 3.5.0, then I meet the js_embed error. >>> According to the suggestion given by the above topic, I tried some older >>> version, like 3.1.0 and 3.0.2, but both failed at the same error: >>> >>> *error: reference to 'map' is ambiguous* >>> >>> Could anyone help? >>> Thanks. >>> Haisheng >>> >>> *Some information:* >>> xxxx@xxxx-ubuntu:protobuf-3.0.2$ protoc --version >>> libprotoc 3.5.1 >>> xxxx@xxxx-ubuntu:protobuf-3.0.2$ gcc -E -xc++ - -v >>> Using built-in specs. >>> COLLECT_GCC=gcc >>> Target: x86_64-linux-gnu >>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu >>> 5.4.0-6ubuntu1~16.04.4' >>> --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs >>> --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ >>> --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id >>> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix >>> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu >>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes >>> --with-default-libstdcxx-abi=new --enable-gnu-unique-object >>> --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib >>> --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo >>> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre >>> --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 >>> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 >>> --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar >>> --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 >>> --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib >>> --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu >>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu >>> Thread model: posix >>> gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) >>> COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64' >>> /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch >>> x86_64-linux-gnu -D_GNU_SOURCE - -mtune=generic -march=x86-64 >>> -fstack-protector-strong -Wformat -Wformat-security >>> ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5" >>> ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" >>> ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu >>> /5/../../../../x86_64-linux-gnu/include" >>> #include "..." search starts here: >>> #include <...> search starts here: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/sysroot/usr/include >>> /usr/include/c++/5 >>> /usr/include/x86_64-linux-gnu/c++/5 >>> /usr/include/c++/5/backward >>> /usr/lib/gcc/x86_64-linux-gnu/5/include >>> /usr/local/include >>> /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed >>> /usr/include/x86_64-linux-gnu >>> /usr/include >>> End of search list. >>> >>> *>>>>>>>>>> bash script code goes here >>>>>>>>>>* >>> # I've already build toolchain for arm architecture. >>> >>> export NDK=/home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armea >>> bi-android-toolchain/ >>> export SYSROOT=$NDK/sysroot/ >>> >>> export TOOLCHAIN=$NDK/ >>> TOOL=arm-linux-androideabi >>> export PATH=$PATH:$TOOLCHAIN/bin:$TOOLCHAIN/${TOOL}/bin >>> export CC="$TOOLCHAIN/bin/arm-linux-androideabi-gcc --sysroot $SYSROOT" >>> export CXX="$TOOLCHAIN/bin/arm-linux-androideabi-g++ --sysroot $SYSROOT" >>> export CXXSTL=$NDK/include/c++/4.9.x >>> >>> >>> pushd protobuf-3.0.2 >>> >>> mkdir build >>> TOOLCHAIN_INC=$TOOLCHAIN/include/c++/4.9.x >>> TOOLCHAIN_LIB=$TOOLCHAIN/lib/gcc/${TOOL}/4.9.x >>> SYSROOT_INC=${SYSROOT}/usr/include >>> SYSROOT_LIB=${SYSROOT}/usr/lib >>> >>> ./configure --prefix=$(pwd)/build \ >>> --host=arm-linux-androideabi \ >>> --with-sysroot=$SYSROOT \ >>> --enable-static \ >>> --disable-shared \ >>> --enable-cross-compile \ >>> --with-protoc=protoc LIBS="-lgcc" \ >>> CFLAGS="-march=armv7-a" \ >>> CXXFLAGS="-march=armv7-a -I${TOOLCHAIN_INC} -I${SYSROOT_INC} >>> -L${TOOLCHAIN_LIB} -L${SYSROOT_LIB}" >>> >>> export C_INCLUDE_PATH=${TOOLCHAIN_INC}:${SYSROOT_INC} >>> export CPLUS_INCLUDE_PATH=${TOOLCHAIN_INC}:${SYSROOT_INC} >>> >>> make clean >>> make >>> >>> >>> *>>>>>>>>>> bash script code stops here >>>>>>>>>>* >>> >>> I also tried the ./configure shared by the above topic. >>> But neither way works. >>> >>> >>> >>> *>>>>>>>>>> error message goes here >>>>>>>>>>* >>> libtool: compile: /home/xxxx/Android/Sdk/ndk-bun >>> dle/sources/protobuf/armeabi-android-toolchain/bin/arm-linux-androideabi-g++ >>> -DHAVE_CONFIG_H -I. -I.. -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall >>> -Wno-sign-compare -O2 -g -DNDEBUG -MT google/protobuf/compiler/importer.lo >>> -MD -MP -MF google/protobuf/compiler/.deps/importer.Tpo -c >>> google/protobuf/compiler/importer.cc -fPIC -DPIC -o >>> google/protobuf/compiler/.libs/importer.o >>> In file included from ./google/protobuf/compiler/importer.h:45:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/descriptor_database.h:181:5: error: reference to >>> 'map' is ambiguous >>> map<string, Value> by_name_; >>> ^ >>> In file included from /home/xxxx/Android/Sdk/ndk-bun >>> dle/sources/protobuf/armeabi-android-toolchain/include/c++/ >>> 4.9.x/set:389:0, >>> from ./google/protobuf/compiler/importer.h:42, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/__tree:1490:77: note: candidates >>> are: template<class, class, class, class> class std::__ndk1::map >>> template <class, class, class, class> friend class >>> _LIBCPP_TEMPLATE_VIS map; >>> >>> ^ >>> In file included from ./google/protobuf/descriptor_database.h:40:0, >>> from ./google/protobuf/compiler/importer.h:45, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/map:609:11: note: >>> template<class _Key, class _Tp, class _Compare, class _Allocator> class >>> std::__ndk1::map >>> class map; >>> ^ >>> In file included from ./google/protobuf/compiler/importer.h:45:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/descriptor_database.h:181:5: error: 'map' does not >>> name a type >>> map<string, Value> by_name_; >>> ^ >>> ./google/protobuf/descriptor_database.h:182:5: error: reference to >>> 'map' is ambiguous >>> map<string, Value> by_symbol_; >>> ^ >>> In file included from /home/xxxx/Android/Sdk/ndk-bun >>> dle/sources/protobuf/armeabi-android-toolchain/include/c++/ >>> 4.9.x/set:389:0, >>> from ./google/protobuf/compiler/importer.h:42, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/__tree:1490:77: note: candidates >>> are: template<class, class, class, class> class std::__ndk1::map >>> template <class, class, class, class> friend class >>> _LIBCPP_TEMPLATE_VIS map; >>> >>> ^ >>> In file included from ./google/protobuf/descriptor_database.h:40:0, >>> from ./google/protobuf/compiler/importer.h:45, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/map:609:11: note: >>> template<class _Key, class _Tp, class _Compare, class _Allocator> class >>> std::__ndk1::map >>> class map; >>> ^ >>> In file included from ./google/protobuf/compiler/importer.h:45:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/descriptor_database.h:182:5: error: 'map' does not >>> name a type >>> map<string, Value> by_symbol_; >>> ^ >>> ./google/protobuf/descriptor_database.h:183:5: error: reference to >>> 'map' is ambiguous >>> map<pair<string, int>, Value> by_extension_; >>> ^ >>> In file included from /home/xxxx/Android/Sdk/ndk-bun >>> dle/sources/protobuf/armeabi-android-toolchain/include/c++/ >>> 4.9.x/set:389:0, >>> from ./google/protobuf/compiler/importer.h:42, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/__tree:1490:77: note: candidates >>> are: template<class, class, class, class> class std::__ndk1::map >>> template <class, class, class, class> friend class >>> _LIBCPP_TEMPLATE_VIS map; >>> >>> ^ >>> In file included from ./google/protobuf/descriptor_database.h:40:0, >>> from ./google/protobuf/compiler/importer.h:45, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/map:609:11: note: >>> template<class _Key, class _Tp, class _Compare, class _Allocator> class >>> std::__ndk1::map >>> class map; >>> ^ >>> In file included from ./google/protobuf/compiler/importer.h:45:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/descriptor_database.h:183:5: error: 'map' does not >>> name a type >>> map<pair<string, int>, Value> by_extension_; >>> ^ >>> ./google/protobuf/descriptor_database.h:238:14: error: expected >>> nested-name-specifier before 'map' >>> typename map<string, Value>::iterator FindLastLessOrEqual( >>> ^ >>> ./google/protobuf/descriptor_database.h:238:14: error: expected ';' at >>> end of member declaration >>> ./google/protobuf/descriptor_database.h:238:17: error: expected >>> unqualified-id before '<' token >>> typename map<string, Value>::iterator FindLastLessOrEqual( >>> ^ >>> In file included from ./google/protobuf/compiler/importer.h:46:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/compiler/parser.h:559:11: error: reference to 'map' >>> is ambiguous >>> typedef map< >>> ^ >>> In file included from /home/xxxx/Android/Sdk/ndk-bun >>> dle/sources/protobuf/armeabi-android-toolchain/include/c++/ >>> 4.9.x/set:389:0, >>> from ./google/protobuf/compiler/importer.h:42, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/__tree:1490:77: note: candidates >>> are: template<class, class, class, class> class std::__ndk1::map >>> template <class, class, class, class> friend class >>> _LIBCPP_TEMPLATE_VIS map; >>> >>> ^ >>> In file included from ./google/protobuf/descriptor_database.h:40:0, >>> from ./google/protobuf/compiler/importer.h:45, >>> from google/protobuf/compiler/importer.cc:51: >>> /home/xxxx/Android/Sdk/ndk-bundle/sources/protobuf/armeabi- >>> android-toolchain/include/c++/4.9.x/map:609:11: note: >>> template<class _Key, class _Tp, class _Compare, class _Allocator> class >>> std::__ndk1::map >>> class map; >>> ^ >>> In file included from ./google/protobuf/compiler/importer.h:46:0, >>> from google/protobuf/compiler/importer.cc:51: >>> ./google/protobuf/compiler/parser.h:559:11: error: 'map' does not name >>> a type >>> typedef map< >>> ^ >>> ./google/protobuf/compiler/parser.h:562:3: error: 'LocationMap' does >>> not name a type >>> LocationMap location_map_; >>> ^ >>> Makefile:3868: recipe for target 'google/protobuf/compiler/importer.lo' >>> failed >>> make[3]: *** [google/protobuf/compiler/importer.lo] Error 1 >>> make[3]: Leaving directory '/home/xxxx/Android/Sdk/ndk-bu >>> ndle/sources/protobuf/protobuf-3.0.2/src' >>> Makefile:1973: recipe for target 'all' failed >>> make[2]: *** [all] Error 2 >>> make[2]: Leaving directory '/home/xxxx/Android/Sdk/ndk-bu >>> ndle/sources/protobuf/protobuf-3.0.2/src' >>> Makefile:1249: recipe for target 'all-recursive' failed >>> make[1]: *** [all-recursive] Error 1 >>> make[1]: Leaving directory '/home/xxxx/Android/Sdk/ndk-bu >>> ndle/sources/protobuf/protobuf-3.0.2' >>> Makefile:1155: recipe for target 'all' failed >>> make: *** [all] Error 2 >>> >>> >>> *>>>>>>>>>> error message stops here >>>>>>>>>>* >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Protocol Buffers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/protobuf. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
