2017-11-29 15 views
0

Android 개발을 위해 protobuf 라이브러리를 얻으려고 ndk-build를 사용하려고 시도했지만 계속 걸림돌을 치고 있습니다. 다른 stackoverflow 스레드에서 내 Android.mk 파일을 가지고 있고 작동하지 않는 것 같습니다. 나는이 .mk에 익숙하지 않으며 내가하는 일을 전혀 모른다. ndk-build protobuf 용 타겟을 만들기위한 규칙 없음

나뿐만 아니라 주제에 이걸 발견 : 그들은 내가 내 자신의 파일을 통해 빗질 있도록 라인 중 하나가 마지막에 너무 많은 공간을 한 것으로 진술하고의 원인을 찾을 수 없습니다 스레드에서 Android NDK: No rule to make target

내 문제.

다음
make: *** No rule to make target `C:/Users/jkarr/Downloads/protobuf- 
master/jni/google/protobuf/arena.cc', needed by 
`C:/Users/jkarr/Downloads/protobuf-master/obj/local/armeabi- 
v7a/objs/protobuf/google/protobuf/arena.o'. Stop. 

내 Android.mk 파일 : 나는 메시지가

LOCAL_PATH := $(call my-dir) 
include $(CLEAR_VARS) 
c_includes := $(LOCAL_PATH) 
LOCAL_MODULE := libprotobuf 

LOCAL_SRC_FILES := \ 
google/protobuf/arena.cc \ 
google/protobuf/arenastring.cc \ 
google/protobuf/extension_set.cc \ 
google/protobuf/generated_message_util.cc \ 
google/protobuf/io/coded_stream.cc \ 
google/protobuf/io/zero_copy_stream.cc \ 
google/protobuf/io/zero_copy_stream_impl_lite.cc \ 
google/protobuf/message_lite.cc \ 
google/protobuf/repeated_field.cc \ 
google/protobuf/stubs/atomicops_internals_x86_gcc.cc \ 
google/protobuf/stubs/atomicops_internals_x86_msvc.cc \ 
google/protobuf/stubs/bytestream.cc \ 
google/protobuf/stubs/common.cc \ 
google/protobuf/stubs/int128.cc \ 
google/protobuf/stubs/once.cc \ 
google/protobuf/stubs/status.cc \ 
google/protobuf/stubs/statusor.cc \ 
google/protobuf/stubs/stringpiece.cc \ 
google/protobuf/stubs/stringprintf.cc \ 
google/protobuf/stubs/structurally_valid.cc \ 
google/protobuf/stubs/strutil.cc \ 
google/protobuf/stubs/time.cc \ 
google/protobuf/wire_format_lite.cc \ 
google/protobuf/any.cc \ 
google/protobuf/any.pb.cc \ 
google/protobuf/api.pb.cc \ 
google/protobuf/compiler/importer.cc \ 
google/protobuf/compiler/parser.cc \ 
google/protobuf/descriptor.cc \ 
google/protobuf/descriptor.pb.cc \ 
google/protobuf/descriptor_database.cc \ 
google/protobuf/duration.pb.cc \ 
google/protobuf/dynamic_message.cc \ 
google/protobuf/empty.pb.cc \ 
google/protobuf/extension_set_heavy.cc \ 
google/protobuf/field_mask.pb.cc \ 
google/protobuf/generated_message_reflection.cc \ 
google/protobuf/io/gzip_stream.cc \ 
google/protobuf/io/printer.cc \ 
google/protobuf/io/strtod.cc \ 
google/protobuf/io/tokenizer.cc \ 
google/protobuf/io/zero_copy_stream_impl.cc \ 
google/protobuf/map_field.cc \ 
google/protobuf/message.cc \ 
google/protobuf/reflection_ops.cc \ 
google/protobuf/service.cc \ 
google/protobuf/source_context.pb.cc \ 
google/protobuf/struct.pb.cc \ 
google/protobuf/stubs/mathlimits.cc \ 
google/protobuf/stubs/substitute.cc \ 
google/protobuf/text_format.cc \ 
google/protobuf/timestamp.pb.cc \ 
google/protobuf/type.pb.cc \ 
google/protobuf/unknown_field_set.cc \ 
google/protobuf/util/field_comparator.cc \ 
google/protobuf/util/field_mask_util.cc \ 
google/protobuf/util/internal/datapiece.cc \ 
google/protobuf/util/internal/default_value_objectwriter.cc \ 
google/protobuf/util/internal/error_listener.cc \ 
google/protobuf/util/internal/field_mask_utility.cc \ 
google/protobuf/util/internal/json_escaping.cc \ 
google/protobuf/util/internal/json_objectwriter.cc \ 
google/protobuf/util/internal/json_stream_parser.cc \ 
google/protobuf/util/internal/object_writer.cc \ 
google/protobuf/util/internal/proto_writer.cc \ 
google/protobuf/util/internal/protostream_objectsource.cc \ 
google/protobuf/util/internal/protostream_objectwriter.cc \ 
google/protobuf/util/internal/type_info.cc \ 
google/protobuf/util/internal/type_info_test_helper.cc \ 
google/protobuf/util/internal/utility.cc \ 
google/protobuf/util/json_util.cc \ 
google/protobuf/util/message_differencer.cc \ 
google/protobuf/util/time_util.cc \ 
google/protobuf/util/type_resolver_util.cc \ 
google/protobuf/wire_format.cc \ 
google/protobuf/wrappers.pb.cc \ 
google/protobuf/compiler/code_generator.cc \ 
google/protobuf/compiler/command_line_interface.cc \ 
google/protobuf/compiler/cpp/cpp_enum.cc \ 
google/protobuf/compiler/cpp/cpp_enum_field.cc \ 
google/protobuf/compiler/cpp/cpp_extension.cc \ 
google/protobuf/compiler/cpp/cpp_field.cc \ 
google/protobuf/compiler/cpp/cpp_file.cc \ 
google/protobuf/compiler/cpp/cpp_generator.cc \ 
google/protobuf/compiler/cpp/cpp_helpers.cc \ 
google/protobuf/compiler/cpp/cpp_map_field.cc \ 
google/protobuf/compiler/cpp/cpp_message.cc \ 
google/protobuf/compiler/cpp/cpp_message_field.cc \ 
google/protobuf/compiler/cpp/cpp_primitive_field.cc \ 
google/protobuf/compiler/cpp/cpp_service.cc \ 
google/protobuf/compiler/cpp/cpp_string_field.cc \ 
google/protobuf/compiler/plugin.cc \ 
google/protobuf/compiler/plugin.pb.cc \ 
google/protobuf/compiler/python/python_generator.cc \ 
google/protobuf/compiler/ruby/ruby_generator.cc \ 
google/protobuf/compiler/subprocess.cc \ 
google/protobuf/compiler/zip_writer.cc \ 


LOCAL_CFLAGS := -D GOOGLE_PROTOBUF_NO_RTTI=1 
LOCAL_CPPFLAGS := -std=c++11 
LOCAL_C_INCLUDES = $(LOCAL_PATH)/android 
LOCAL_C_INCLUDES += ${ANDROID_NDK}/sources/cxx-stl/gnu-  libstdc++/4.8/include 
LOCAL_LDLIBS += -lz 
LOCAL_EXPORT_LDLIBS += -lz 
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS) 
LOCAL_EXPORT_CPPFLAGS := $(LOCAL_CPPFLAGS) 
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) 


include $(BUILD_SHARED_LIBRARY) 

확실하지 당신도 내 응용 프로그램 파일이 필요하지만 여기 어쨌든 인 경우

APP_STL :=gnustl_shared # gnustl_static 
NDK_TOOLCHAIN_VERSION := 4.9 
APP_ABI := armeabi-v7a 
LIBCXX_FORCE_REBUILD := true 
APP_PLATFORM:=android-19 
NDK_DEBUG:=1 

편집 : 측면 질문으로 안드로이드.mk 내가 protobuf-lite 날 잡으려고 여기에 있나요?

답변

0

나는 그것이 왜 저에게 그 오류를주고 있는지를 알아 냈습니다. 잘못된 폴더를 찾고있었습니다. 고정 코드는 다음과 같습니다.

LOCAL_PATH := $(call my-dir)\src 

이제 완전히 다른 문제가 있습니다. 오류 메시지가 나타납니다 :

[armeabi-v7a] Compile++ thumb: protobuf <= common.cc 
C:/Users/jkarr/Downloads/protobuf- 
3.5.0/jni\src/google/protobuf/stubs/common.cc:52:2: error: #error "No 
suitable threading library available." 
#error "No suitable threading library available." 
^ 
make: *** [C:/Users/jkarr/Downloads/protobuf-3.5.0/obj/local/armeabi- 
v7a/objs/protobuf/google/protobuf/stubs/common.o] Error 1 

나는 어디서부터 시작해야할지 모른다.

0

이 게시물 https://stackoverflow.com/a/43729661/3845809을 따르고 있다고 가정하면 문제를 일으키는 몇 가지 사항이 있습니다. 가장 큰 문제점은이 포스트가 v3.2를 빌드하는 방법을 설명하고 v3.5를 빌드하려고하는 것입니다. v3.2를 사용하는 것이 좋으면 가장 쉬운 방법은 게시물의 2 단계 전에 protobuf에있는 3.2.x 지점을 체크 아웃하는 것입니다.

NDK 용 v3.5를 빌드하려면 Android.mk 파일에서 업데이트해야 할 몇 가지 사항이 있습니다. 업데이트 된 Android.mk는 다음과 같습니다.

LOCAL_PATH := $(call my-dir) 
include $(CLEAR_VARS) 
c_includes := $(LOCAL_PATH) 
LOCAL_MODULE := libprotobuf 

LOCAL_SRC_FILES := \ 
google/protobuf/arena.cc \ 
google/protobuf/arenastring.cc \ 
google/protobuf/extension_set.cc \ 
google/protobuf/generated_message_util.cc \ 
google/protobuf/io/coded_stream.cc \ 
google/protobuf/io/zero_copy_stream.cc \ 
google/protobuf/io/zero_copy_stream_impl_lite.cc \ 
google/protobuf/message_lite.cc \ 
google/protobuf/repeated_field.cc \ 
google/protobuf/stubs/atomicops_internals_x86_gcc.cc \ 
google/protobuf/stubs/atomicops_internals_x86_msvc.cc \ 
google/protobuf/stubs/bytestream.cc \ 
google/protobuf/stubs/common.cc \ 
google/protobuf/stubs/int128.cc \ 
google/protobuf/stubs/once.cc \ 
google/protobuf/stubs/status.cc \ 
google/protobuf/stubs/statusor.cc \ 
google/protobuf/stubs/stringpiece.cc \ 
google/protobuf/stubs/stringprintf.cc \ 
google/protobuf/stubs/structurally_valid.cc \ 
google/protobuf/stubs/strutil.cc \ 
google/protobuf/stubs/time.cc \ 
google/protobuf/wire_format_lite.cc \ 
google/protobuf/any.cc \ 
google/protobuf/any.pb.cc \ 
google/protobuf/api.pb.cc \ 
google/protobuf/compiler/importer.cc \ 
google/protobuf/compiler/parser.cc \ 
google/protobuf/descriptor.cc \ 
google/protobuf/descriptor.pb.cc \ 
google/protobuf/descriptor_database.cc \ 
google/protobuf/duration.pb.cc \ 
google/protobuf/dynamic_message.cc \ 
google/protobuf/empty.pb.cc \ 
google/protobuf/extension_set_heavy.cc \ 
google/protobuf/field_mask.pb.cc \ 
google/protobuf/generated_message_reflection.cc \ 
google/protobuf/io/gzip_stream.cc \ 
google/protobuf/io/printer.cc \ 
google/protobuf/io/strtod.cc \ 
google/protobuf/io/tokenizer.cc \ 
google/protobuf/io/zero_copy_stream_impl.cc \ 
google/protobuf/map_field.cc \ 
google/protobuf/message.cc \ 
google/protobuf/reflection_ops.cc \ 
google/protobuf/service.cc \ 
google/protobuf/source_context.pb.cc \ 
google/protobuf/struct.pb.cc \ 
google/protobuf/stubs/mathlimits.cc \ 
google/protobuf/stubs/substitute.cc \ 
google/protobuf/text_format.cc \ 
google/protobuf/timestamp.pb.cc \ 
google/protobuf/type.pb.cc \ 
google/protobuf/unknown_field_set.cc \ 
google/protobuf/util/field_comparator.cc \ 
google/protobuf/util/field_mask_util.cc \ 
google/protobuf/util/internal/datapiece.cc \ 
google/protobuf/util/internal/default_value_objectwriter.cc \ 
google/protobuf/util/internal/error_listener.cc \ 
google/protobuf/util/internal/field_mask_utility.cc \ 
google/protobuf/util/internal/json_escaping.cc \ 
google/protobuf/util/internal/json_objectwriter.cc \ 
google/protobuf/util/internal/json_stream_parser.cc \ 
google/protobuf/util/internal/object_writer.cc \ 
google/protobuf/util/internal/proto_writer.cc \ 
google/protobuf/util/internal/protostream_objectsource.cc \ 
google/protobuf/util/internal/protostream_objectwriter.cc \ 
google/protobuf/util/internal/type_info.cc \ 
google/protobuf/util/internal/type_info_test_helper.cc \ 
google/protobuf/util/internal/utility.cc \ 
google/protobuf/util/json_util.cc \ 
google/protobuf/util/message_differencer.cc \ 
google/protobuf/util/time_util.cc \ 
google/protobuf/util/type_resolver_util.cc \ 
google/protobuf/wire_format.cc \ 
google/protobuf/wrappers.pb.cc \ 
google/protobuf/compiler/code_generator.cc  \ 
google/protobuf/compiler/command_line_interface.cc  \ 
google/protobuf/compiler/cpp/cpp_enum.cc  \ 
google/protobuf/compiler/cpp/cpp_enum_field.cc  \ 
google/protobuf/compiler/cpp/cpp_extension.cc  \ 
google/protobuf/compiler/cpp/cpp_field.cc  \ 
google/protobuf/compiler/cpp/cpp_file.cc  \ 
google/protobuf/compiler/cpp/cpp_generator.cc  \ 
google/protobuf/compiler/cpp/cpp_helpers.cc  \ 
google/protobuf/compiler/cpp/cpp_map_field.cc  \ 
google/protobuf/compiler/cpp/cpp_padding_optimizer.cc  \ 
google/protobuf/compiler/cpp/cpp_message.cc  \ 
google/protobuf/compiler/cpp/cpp_message_field.cc  \ 
google/protobuf/compiler/cpp/cpp_primitive_field.cc  \ 
google/protobuf/compiler/cpp/cpp_service.cc  \ 
google/protobuf/compiler/cpp/cpp_string_field.cc  \ 
google/protobuf/compiler/plugin.cc  \ 
google/protobuf/compiler/plugin.pb.cc  \ 
google/protobuf/compiler/python/python_generator.cc  \ 
google/protobuf/compiler/ruby/ruby_generator.cc  \ 
google/protobuf/compiler/subprocess.cc  \ 
google/protobuf/compiler/zip_writer.cc  \ 


LOCAL_CFLAGS := -D GOOGLE_PROTOBUF_NO_RTTI=1 
LOCAL_CPPFLAGS := -std=c++11 -D HAVE_PTHREAD=1 -frtti 
LOCAL_C_INCLUDES = $(LOCAL_PATH)/android 
LOCAL_C_INCLUDES += ${ANDROID_NDK}/sources/cxx-stl/gnu-  libstdc++/4.8/include 
LOCAL_LDLIBS += -lz -llog 
LOCAL_EXPORT_LDLIBS += -lz 
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS) 
LOCAL_EXPORT_CPPFLAGS := $(LOCAL_CPPFLAGS) 
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) 


include $(BUILD_SHARED_LIBRARY)