我正在尝试使用https://github.com/shadowsocks/shadowsocks-android
为了运行它,我遵循所有的指示
已安装:

JDK 1.8
Go 1.11+
Android SDK
Android NDK r16+

为了设置路径,我在系统的.profile文件中这样做:
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

export GOROOT=/home/optimumanddev2/Downloads/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

export ANDROID_HOME=/home/optimumanddev2/Android/Sdk
export PATH=${PATH}:~/Android/Sdk/tools:~/Android/Sdk/platform-tools
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle

在那之后,我从github下载了最新的代码并试图构建它,但是它给出了以下错误:
External Native Build Issues=======================>
Build command failed.
Error while executing process /home/optimumanddev2/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/*
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdbserver
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdb.setup
mkdir -p /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/jni-helper
echo [armeabi-v7a] "Compile++ thumb": "jni-helper <= jni-helper.cpp"
/home/optimumanddev2/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -MMD -MP -MF
/home/optimumanddev2/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar crsD  /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcpufeatures.a /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cpufeatures/cpu-features.o
make: *** No rule to make target `/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/libancillary/fd_recv.c', needed by `/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/ancillary/libancillary/fd_recv.o'.  Stop.
Build command failed.

请帮忙,我认为路径设置过程可能是错误的。
这是我的Application.mk文件:
APP_ABI                 := armeabi-v7a arm64-v8a x86
APP_PLATFORM            := android-21
APP_STL                 := c++_static
NDK_TOOLCHAIN_VERSION   := clang

这里是Android.mk文件:
LOCAL_PATH := $(call my-dir)
ROOT_PATH := $(LOCAL_PATH)

BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk

########################################################
## libsodium
########################################################

include $(CLEAR_VARS)

SODIUM_SOURCE := \
    crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
    crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
    crypto_core/curve25519/ref10/curve25519_ref10.c \
    crypto_core/hchacha20/core_hchacha20.c \
    crypto_core/salsa/ref/core_salsa_ref.c \
    crypto_generichash/blake2b/ref/blake2b-compress-ref.c \
    crypto_generichash/blake2b/ref/blake2b-ref.c \
    crypto_generichash/blake2b/ref/generichash_blake2b.c \
    crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \
    crypto_onetimeauth/poly1305/donna/poly1305_donna.c \
    crypto_pwhash/crypto_pwhash.c \
    crypto_pwhash/argon2/argon2-core.c \
    crypto_pwhash/argon2/argon2.c \
    crypto_pwhash/argon2/argon2-encoding.c \
    crypto_pwhash/argon2/argon2-fill-block-ref.c \
    crypto_pwhash/argon2/blake2b-long.c \
    crypto_pwhash/argon2/pwhash_argon2i.c \
    crypto_scalarmult/curve25519/scalarmult_curve25519.c \
    crypto_scalarmult/curve25519/ref10/x25519_ref10.c \
    crypto_stream/chacha20/stream_chacha20.c \
    crypto_stream/chacha20/ref/chacha20_ref.c \
    crypto_stream/salsa20/stream_salsa20.c \
    crypto_stream/salsa20/ref/salsa20_ref.c \
    crypto_verify/sodium/verify.c \
    randombytes/randombytes.c \
    randombytes/sysrandom/randombytes_sysrandom.c \
    sodium/core.c \
    sodium/runtime.c \
    sodium/utils.c \
    sodium/version.c

LOCAL_MODULE := sodium
LOCAL_CFLAGS += -I$(LOCAL_PATH)/libsodium/src/libsodium/include \
                -I$(LOCAL_PATH)/include \
                -I$(LOCAL_PATH)/include/sodium \
                -I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
                -DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" \
                -DPACKAGE_VERSION=\"1.0.15\" -DPACKAGE_STRING=\"libsodium-1.0.15\" \
                -DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" \
                -DPACKAGE_URL=\"https://github.com/jedisct1/libsodium\" \
                -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.15\" \
                -DHAVE_PTHREAD=1                  \
                -DSTDC_HEADERS=1                  \
                -DHAVE_SYS_TYPES_H=1              \
                -DHAVE_SYS_STAT_H=1               \
                -DHAVE_STDLIB_H=1                 \
                -DHAVE_STRING_H=1                 \
                -DHAVE_MEMORY_H=1                 \
                -DHAVE_STRINGS_H=1                \
                -DHAVE_INTTYPES_H=1               \
                -DHAVE_STDINT_H=1                 \
                -DHAVE_UNISTD_H=1                 \
                -D__EXTENSIONS__=1                \
                -D_ALL_SOURCE=1                   \
                -D_GNU_SOURCE=1                   \
                -D_POSIX_PTHREAD_SEMANTICS=1      \
                -D_TANDEM_SOURCE=1                \
                -DHAVE_DLFCN_H=1                  \
                -DLT_OBJDIR=\".libs/\"            \
                -DHAVE_SYS_MMAN_H=1               \
                -DNATIVE_LITTLE_ENDIAN=1          \
                -DASM_HIDE_SYMBOL=.hidden         \
                -DHAVE_WEAK_SYMBOLS=1             \
                -DHAVE_ATOMIC_OPS=1               \
                -DHAVE_ARC4RANDOM=1               \
                -DHAVE_ARC4RANDOM_BUF=1           \
                -DHAVE_MMAP=1                     \
                -DHAVE_MLOCK=1                    \
                -DHAVE_MADVISE=1                  \
                -DHAVE_MPROTECT=1                 \
                -DHAVE_NANOSLEEP=1                \
                -DHAVE_POSIX_MEMALIGN=1           \
                -DHAVE_GETPID=1                   \
                -DCONFIGURED=1

LOCAL_SRC_FILES := $(addprefix libsodium/src/libsodium/,$(SODIUM_SOURCE))

include $(BUILD_STATIC_LIBRARY)

########################################################
## libevent
########################################################

include $(CLEAR_VARS)

LIBEVENT_SOURCES := \
    buffer.c bufferevent.c event.c \
    bufferevent_sock.c bufferevent_ratelim.c \
    evthread.c log.c evutil.c evutil_time.c evmap.c epoll.c poll.c signal.c select.c

LOCAL_MODULE := event
LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES))
LOCAL_CFLAGS := -I$(LOCAL_PATH)/libevent \
    -I$(LOCAL_PATH)/libevent/include \

include $(BUILD_STATIC_LIBRARY)

########################################################
## libancillary
########################################################

include $(CLEAR_VARS)

ANCILLARY_SOURCE := fd_recv.c fd_send.c

LOCAL_MODULE := libancillary
LOCAL_CFLAGS += -I$(LOCAL_PATH)/libancillary

LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))

include $(BUILD_STATIC_LIBRARY)

########################################################
## libbloom
########################################################

include $(CLEAR_VARS)

BLOOM_SOURCE := bloom.c murmur2/MurmurHash2.c

LOCAL_MODULE := libbloom
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
                -I$(LOCAL_PATH)/shadowsocks-libev/libbloom/murmur2

LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libbloom/, $(BLOOM_SOURCE))

include $(BUILD_STATIC_LIBRARY)

########################################################
## libipset
########################################################

include $(CLEAR_VARS)

bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
                  bdd/reachable.c bdd/read.c bdd/write.c
map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
                  map/storage.c
set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
                  set/iterator.c set/storage.c

IPSET_SOURCE := general.c $(bdd_src) $(map_src) $(set_src)

LOCAL_MODULE := libipset
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
                -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include

LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libipset/src/libipset/,$(IPSET_SOURCE))

include $(BUILD_STATIC_LIBRARY)

########################################################
## libcork
########################################################

include $(CLEAR_VARS)

cli_src := cli/commands.c
core_src := core/allocator.c core/error.c core/gc.c \
            core/hash.c core/ip-address.c core/mempool.c \
            core/timestamp.c core/u128.c
ds_src := ds/array.c ds/bitset.c ds/buffer.c ds/dllist.c \
          ds/file-stream.c ds/hash-table.c ds/managed-buffer.c \
          ds/ring-buffer.c ds/slice.c
posix_src := posix/directory-walker.c posix/env.c posix/exec.c \
             posix/files.c posix/process.c posix/subprocess.c
pthreads_src := pthreads/thread.c

CORK_SOURCE := $(cli_src) $(core_src) $(ds_src) $(posix_src) $(pthreads_src)

LOCAL_MODULE := libcork
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
                -DCORK_API=CORK_LOCAL

LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libcork/src/libcork/,$(CORK_SOURCE))

include $(BUILD_STATIC_LIBRARY)

########################################################
## libev
########################################################

include $(CLEAR_VARS)

LOCAL_MODULE := libev
LOCAL_CFLAGS += -DNDEBUG -DHAVE_CONFIG_H \
                -I$(LOCAL_PATH)/include/libev
LOCAL_SRC_FILES := \
    libev/ev.c \
    libev/event.c

include $(BUILD_STATIC_LIBRARY)

########################################################
## redsocks
########################################################

include $(CLEAR_VARS)

REDSOCKS_SOURCES := base.c http-connect.c \
    log.c md5.c socks5.c \
    base64.c http-auth.c http-relay.c main.c \
    parser.c redsocks.c socks4.c utils.c

LOCAL_STATIC_LIBRARIES := libevent

LOCAL_MODULE := redsocks
LOCAL_SRC_FILES := $(addprefix redsocks/, $(REDSOCKS_SOURCES))
LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \
    -I$(LOCAL_PATH)/redsocks \
    -I$(LOCAL_PATH)/libevent/include \
    -I$(LOCAL_PATH)/libevent

include $(BUILD_SHARED_EXECUTABLE)

########################################################
## shadowsocks-libev local
########################################################

include $(CLEAR_VARS)

SHADOWSOCKS_SOURCES := local.c \
    cache.c udprelay.c utils.c netutils.c json.c jconf.c \
    acl.c http.c tls.c rule.c \
    crypto.c aead.c stream.c base64.c \
    plugin.c ppbloom.c \
    android.c

LOCAL_MODULE    := ss-local
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS    := -Wall -fno-strict-aliasing -DMODULE_LOCAL \
                    -DUSE_CRYPTO_MBEDTLS -DHAVE_CONFIG_H \
                    -DCONNECT_IN_PROGRESS=EINPROGRESS \
                    -I$(LOCAL_PATH)/include/shadowsocks-libev \
                    -I$(LOCAL_PATH)/include \
                    -I$(LOCAL_PATH)/libancillary \
                    -I$(LOCAL_PATH)/mbedtls/include  \
                    -I$(LOCAL_PATH)/pcre \
                    -I$(LOCAL_PATH)/libsodium/src/libsodium/include \
                    -I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
                    -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
                    -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
                    -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
                    -I$(LOCAL_PATH)/libev

LOCAL_STATIC_LIBRARIES := libev libmbedtls libipset libcork libbloom \
    libsodium libancillary libpcre

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_EXECUTABLE)

########################################################
## shadowsocks-libev tunnel
########################################################

include $(CLEAR_VARS)

SHADOWSOCKS_SOURCES := tunnel.c \
    cache.c udprelay.c utils.c netutils.c json.c jconf.c \
    crypto.c aead.c stream.c base64.c \
    plugin.c ppbloom.c \
    android.c

LOCAL_MODULE    := ss-tunnel
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS    := -Wall -fno-strict-aliasing -DMODULE_TUNNEL \
                    -DUSE_CRYPTO_MBEDTLS -DHAVE_CONFIG_H -DSSTUNNEL_JNI \
                    -DCONNECT_IN_PROGRESS=EINPROGRESS \
                    -I$(LOCAL_PATH)/libancillary \
                    -I$(LOCAL_PATH)/include \
                    -I$(LOCAL_PATH)/libsodium/src/libsodium/include \
                    -I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
                    -I$(LOCAL_PATH)/mbedtls/include \
                    -I$(LOCAL_PATH)/libev \
                    -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
                    -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
                    -I$(LOCAL_PATH)/include/shadowsocks-libev

LOCAL_STATIC_LIBRARIES := libev libmbedtls libsodium libcork libbloom libancillary

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_EXECUTABLE)

########################################################
## jni-helper
########################################################

include $(CLEAR_VARS)

LOCAL_MODULE:= jni-helper

LOCAL_CFLAGS := -std=c++11

LOCAL_C_INCLUDES:= $(LOCAL_PATH)/libancillary

LOCAL_SRC_FILES:= jni-helper.cpp

LOCAL_LDLIBS := -ldl -llog

LOCAL_STATIC_LIBRARIES := cpufeatures libancillary

include $(BUILD_SHARED_LIBRARY)

########################################################
## tun2socks
########################################################

include $(CLEAR_VARS)

LOCAL_CFLAGS := -std=gnu99
LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
LOCAL_CFLAGS += -DBADVPN_USE_SIGNALFD -DBADVPN_USE_EPOLL
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
LOCAL_CFLAGS += -DNDEBUG -DANDROID
# LOCAL_CFLAGS += -DTUN2SOCKS_JNI

LOCAL_STATIC_LIBRARIES := libancillary

LOCAL_C_INCLUDES:= \
        $(LOCAL_PATH)/libancillary \
        $(LOCAL_PATH)/badvpn/lwip/src/include/ipv4 \
        $(LOCAL_PATH)/badvpn/lwip/src/include/ipv6 \
        $(LOCAL_PATH)/badvpn/lwip/src/include \
        $(LOCAL_PATH)/badvpn/lwip/custom \
        $(LOCAL_PATH)/badvpn/

TUN2SOCKS_SOURCES := \
        base/BLog_syslog.c \
        system/BReactor_badvpn.c \
        system/BSignal.c \
        system/BConnection_common.c \
        system/BConnection_unix.c \
        system/BTime.c \
        system/BUnixSignal.c \
        system/BNetwork.c \
        flow/StreamRecvInterface.c \
        flow/PacketRecvInterface.c \
        flow/PacketPassInterface.c \
        flow/StreamPassInterface.c \
        flow/SinglePacketBuffer.c \
        flow/BufferWriter.c \
        flow/PacketBuffer.c \
        flow/PacketStreamSender.c \
        flow/PacketPassConnector.c \
        flow/PacketProtoFlow.c \
        flow/PacketPassFairQueue.c \
        flow/PacketProtoEncoder.c \
        flow/PacketProtoDecoder.c \
        socksclient/BSocksClient.c \
        tuntap/BTap.c \
        lwip/src/core/timers.c \
        lwip/src/core/udp.c \
        lwip/src/core/memp.c \
        lwip/src/core/init.c \
        lwip/src/core/pbuf.c \
        lwip/src/core/tcp.c \
        lwip/src/core/tcp_out.c \
        lwip/src/core/netif.c \
        lwip/src/core/def.c \
        lwip/src/core/mem.c \
        lwip/src/core/tcp_in.c \
        lwip/src/core/stats.c \
        lwip/src/core/inet_chksum.c \
        lwip/src/core/ipv4/icmp.c \
        lwip/src/core/ipv4/igmp.c \
        lwip/src/core/ipv4/ip4_addr.c \
        lwip/src/core/ipv4/ip_frag.c \
        lwip/src/core/ipv4/ip4.c \
        lwip/src/core/ipv4/autoip.c \
        lwip/src/core/ipv6/ethip6.c \
        lwip/src/core/ipv6/inet6.c \
        lwip/src/core/ipv6/ip6_addr.c \
        lwip/src/core/ipv6/mld6.c \
        lwip/src/core/ipv6/dhcp6.c \
        lwip/src/core/ipv6/icmp6.c \
        lwip/src/core/ipv6/ip6.c \
        lwip/src/core/ipv6/ip6_frag.c \
        lwip/src/core/ipv6/nd6.c \
        lwip/custom/sys.c \
        tun2socks/tun2socks.c \
        base/DebugObject.c \
        base/BLog.c \
        base/BPending.c \
        system/BDatagram_unix.c \
        flowextra/PacketPassInactivityMonitor.c \
        tun2socks/SocksUdpGwClient.c \
        udpgw_client/UdpGwClient.c

LOCAL_MODULE := tun2socks

LOCAL_LDLIBS := -ldl -llog

LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES))

include $(BUILD_SHARED_EXECUTABLE)

########################################################
## mbed TLS
########################################################

include $(CLEAR_VARS)

LOCAL_MODULE := mbedtls

LOCAL_C_INCLUDES := $(LOCAL_PATH)/mbedtls/include

MBEDTLS_SOURCES := $(wildcard $(LOCAL_PATH)/mbedtls/library/*.c)

LOCAL_SRC_FILES := $(MBEDTLS_SOURCES:$(LOCAL_PATH)/%=%)

include $(BUILD_STATIC_LIBRARY)

########################################################
## pcre
########################################################

include $(CLEAR_VARS)

LOCAL_MODULE := pcre

LOCAL_CFLAGS += -DHAVE_CONFIG_H

LOCAL_C_INCLUDES := $(LOCAL_PATH)/pcre/dist $(LOCAL_PATH)/pcre

libpcre_src_files := \
    dist/pcre_byte_order.c \
    dist/pcre_compile.c \
    dist/pcre_config.c \
    dist/pcre_dfa_exec.c \
    dist/pcre_exec.c \
    dist/pcre_fullinfo.c \
    dist/pcre_get.c \
    dist/pcre_globals.c \
    dist/pcre_jit_compile.c \
    dist/pcre_maketables.c \
    dist/pcre_newline.c \
    dist/pcre_ord2utf8.c \
    dist/pcre_refcount.c \
    dist/pcre_string_utils.c \
    dist/pcre_study.c \
    dist/pcre_tables.c \
    dist/pcre_ucd.c \
    dist/pcre_valid_utf8.c \
    dist/pcre_version.c \
    dist/pcre_xclass.c

LOCAL_SRC_FILES := $(addprefix pcre/, $(libpcre_src_files)) $(LOCAL_PATH)/patch/pcre/pcre_chartables.c

include $(BUILD_STATIC_LIBRARY)

# Import cpufeatures
$(call import-module,android/cpufeatures)

在我的项目中缺少的文件:
例如(core/.externalNativeBuild/ndkBuild/debug/armeabi-v7a),这些文件夹是空的。我想这可能是问题所在。
因为在我的另一个NDK项目中,这些文件夹有文件和一些代码

最佳答案

这个错误是在我用git命令正确地克隆了项目之后解决的,如https://github.com/shadowsocks/shadowsocks-android.git
因此,要删除NDK错误,需要安装并设置所有必需内容的路径,并正确克隆,以便可以正确克隆所有子文件夹,这些错误是由于文件不可用而导致的。
但我也有其他错误,比如库冲突:
错误“Program type already present”android.support.customtabs

08-18 04:15