snipsco / tensorflow-build

A set of scripts to (cross-)build the Tensorflow C lib for various architectures / OS
MIT License
178 stars 92 forks source link

I'm attempting a custom toolchain (arm64) #24

Open yonderblue opened 6 years ago

yonderblue commented 6 years ago

But I get:

launching bazel with flags '' ERROR: /root/.cache/bazel/_bazel_root/aa4e3329d28e2b64ec040c9b188aed63/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl:138:26: name 'set' is not defined ERROR: /root/.cache/bazel/_bazel_root/aa4e3329d28e2b64ec040c9b188aed63/external/io_bazel_rules_closure/closure/private/defs.bzl:27:16: name 'set' is not defined

Some js error?

yonderblue commented 6 years ago

This was an issue that needed bazel 0.11.

Have crunched through many errors latest stuck on is: tensorflow/core/platform/default/logging.cc:61:55: error: 'strrchr' was not declared in this scope const char* const partialname = strrchr(fname, '/');

even though I am sure cstring header is within an include path in the CROSSTOOL..

fredszaq commented 6 years ago

Hi ! what version of TF are you trying to build ? Last one we built with this is 1.3.1, so this is quite possible there will be some errors if you build a more recent version. If you find a solution do not hesitate to make a PR :D

yonderblue commented 6 years ago

I can certainly put up a Docker, so it is repeatable, I am at the last link and just hitting the -lpthread not found issue (with ndk toolchain it is contained in libc++). If you know how to create a stub libpthread.so please let me know :)

Edit: I have removed every semblence of pthread linker flag I can see but am still getting the following, even though gcc isn't getting a pthread flag of any kind. I also tried to remove it from gcc by custom spec file but even then I still get this, any idea?

SUBCOMMAND: # //tensorflow:libtensorflow_framework.so [action 'Linking tensorflow/libtensorflow_framework.so']
(cd /root/.cache/bazel/_bazel_root/b46121d0546718834d76554a8a3bea26/execroot/org_tensorflow && \
  exec env - \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/usr/bin/python \
    PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /android-arm/bin/aarch64-linux-android-gcc -shared -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so '-Wl,-rpath,$ORIGIN/' -Wl,-soname,libtensorflow_framework.so -pthread -Wl,-z,relro,-z,now -Wl,--gc-sections -v -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64 -Wl,@bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so-2.params)
ERROR: /tmp/tensorflow/arm/tensorflow/BUILD:744:1: Linking of rule '//tensorflow:libtensorflow_framework.so' failed (Exit 1): aarch64-linux-android-gcc failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/b46121d0546718834d76554a8a3bea26/execroot/org_tensorflow && \
  exec env - \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/usr/bin/python \
    PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /android-arm/bin/aarch64-linux-android-gcc -shared -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so '-Wl,-rpath,$ORIGIN/' -Wl,-soname,libtensorflow_framework.so -pthread -Wl,-z,relro,-z,now -Wl,--gc-sections -v -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64 -Wl,@bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so-2.params)
Using built-in specs.
COLLECT_GCC=/android-arm/bin/aarch64-linux-android-gcc
COLLECT_LTO_WRAPPER=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/lto-wrapper
Target: aarch64-linux-android
Configured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/ec4cb553ef61611c1d388a938c56382a --target=aarch64-linux-android --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/ec4cb553ef61611c1d388a938c56382a --with-sysroot=/tmp/ec4cb553ef61611c1d388a938c56382a/sysroot --with-binutils-version=2.27 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/ec4cb553ef61611c1d388a938c56382a/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-ld=default --enable-threads --enable-eh-frame-hdr-for-static --enable-fix-cortex-a53-835769 --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --program-transform-name='s&^&aarch64-linux-android-&' --enable-gold
Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (GCC) 
COMPILER_PATH=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/:/android-arm/bin/../libexec/gcc/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/
LIBRARY_PATH=/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/:/android-arm/bin/../lib/gcc/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/:/android-arm/bin/../sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-shared' '-o' 'bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so' '-pthread' '-v' '-L/android-arm/sysroot/usr/lib' '-L/android-arm/lib' '-L/android-arm/lib64' '-L/android-arm/aarch64-linux-android/lib' '-L/android-arm/aarch64-linux-android/lib64' '-mlittle-endian' '-mabi=lp64'
 /android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/collect2 -plugin /android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/liblto_plugin.so -plugin-opt=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/lto-wrapper -plugin-opt=-fresolution=/tmp/ccklAaJ3.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-ldl -plugin-opt=-pass-through=-lgcc --sysroot=/android-arm/bin/../sysroot --eh-frame-hdr -shared -dynamic-linker /system/bin/linker64 -X -EL -maarch64linux --fix-cortex-a53-835769 --fix-cortex-a53-843419 -z noexecstack -z relro -z now -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so /android-arm/bin/../sysroot/usr/lib/crtbegin_so.o -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64 -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x -L/android-arm/bin/../lib/gcc -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64 -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib -L/android-arm/bin/../sysroot/usr/lib -rpath $ORIGIN/ -soname libtensorflow_framework.so -z relro -z now --gc-sections @bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so-2.params -lgcc -lc -ldl -lgcc /android-arm/bin/../sysroot/usr/lib/crtend_so.o
/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lpthread
/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
Target //tensorflow:libtensorflow.so failed to build
INFO: Elapsed time: 123.493s, Critical Path: 15.35s
yonderblue commented 6 years ago

I found where the flag is coming from in bit above

cat bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so-2.params
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libframework_internal_impl.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libversion_lib.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/liblib_internal_impl.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/liblib_hash_crc32c_accelerate_internal.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/liblib_proto_parsing.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/snappy/libsnappy.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf_lite.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libprotos_all_cc_impl.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/grappler/costs/libop_performance_data_cc_impl.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/stream_executor/libstream_executor_impl.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_runtime_impl.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_impl.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_id.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_init_impl.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_lib.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/nsync/libnsync_cpp.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/kernels/liblookup_util.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/kernels/libinitializable_lookup_table.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libtensor_bundle.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libnaming.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_base.pic.lo
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/libgraph.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libgrappler_item.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libop_types.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libutils.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libbase.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libspinlock_wait.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libdynamic_annotations.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/gif_archive/libgif.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/jpeg/libjpeg.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/jpeg/libsimd_none.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/com_googlesource_code_re2/libre2.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/farmhash_archive/libfarmhash.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/fft2d/libfft2d.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/highwayhash/libsip_hash.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/highwayhash/libarch_specific.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/png_archive/libpng.pic.a
-no-whole-archive
-whole-archive
bazel-out/armeabi-opt/bin/external/zlib_archive/libzlib.pic.a
-no-whole-archive
-ldl
-lm
-lpthread
-lm
-lpthread
-lm
-ldl
-ldl
-lm
-lm

Know a way to find out what dependency is putting it there?

yonderblue commented 6 years ago

Turning off supports_param_files I get

SUBCOMMAND: # //tensorflow:libtensorflow_framework.so [action 'Linking tensorflow/libtensorflow_framework.so']
(cd /root/.cache/bazel/_bazel_root/b46121d0546718834d76554a8a3bea26/execroot/org_tensorflow && \
  exec env - \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/usr/bin/python \
    PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /android-arm/bin/aarch64-linux-android-gcc -shared -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libframework_internal_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libversion_lib.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_internal_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_hash_crc32c_accelerate_internal.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_proto_parsing.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/snappy/libsnappy.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf_lite.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libprotos_all_cc_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/costs/libop_performance_data_cc_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/stream_executor/libstream_executor_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_runtime_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_id.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_init_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_lib.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/nsync/libnsync_cpp.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/liblookup_util.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/libinitializable_lookup_table.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libtensor_bundle.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libnaming.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_base.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgraph.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libgrappler_item.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libop_types.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libutils.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libbase.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libspinlock_wait.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libdynamic_annotations.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/gif_archive/libgif.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libjpeg.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libsimd_none.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_googlesource_code_re2/libre2.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/farmhash_archive/libfarmhash.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/fft2d/libfft2d.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libsip_hash.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libarch_specific.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/png_archive/libpng.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/zlib_archive/libzlib.pic.a -Wl,-no-whole-archive '-Wl,-rpath,$ORIGIN/' -Wl,-soname,libtensorflow_framework.so -ldl -lm -lpthread -lm -lpthread -lm -ldl -ldl -pthread -lm -lm -Wl,-z,relro,-z,now -Wl,--gc-sections -v -mandroid -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64)
ERROR: /tmp/tensorflow/arm/tensorflow/BUILD:744:1: Linking of rule '//tensorflow:libtensorflow_framework.so' failed (Exit 1): aarch64-linux-android-gcc failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/b46121d0546718834d76554a8a3bea26/execroot/org_tensorflow && \
  exec env - \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/usr/bin/python \
    PYTHON_LIB_PATH=/usr/local/lib/python2.7/dist-packages \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /android-arm/bin/aarch64-linux-android-gcc -shared -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libframework_internal_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libversion_lib.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_internal_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_hash_crc32c_accelerate_internal.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_proto_parsing.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/snappy/libsnappy.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf_lite.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libprotos_all_cc_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/costs/libop_performance_data_cc_impl.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/stream_executor/libstream_executor_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_runtime_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_id.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_init_impl.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_lib.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/nsync/libnsync_cpp.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/liblookup_util.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/libinitializable_lookup_table.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libtensor_bundle.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libnaming.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_base.pic.lo -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgraph.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libgrappler_item.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libop_types.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libutils.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libbase.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libspinlock_wait.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libdynamic_annotations.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/gif_archive/libgif.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libjpeg.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libsimd_none.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/com_googlesource_code_re2/libre2.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/farmhash_archive/libfarmhash.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/fft2d/libfft2d.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libsip_hash.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libarch_specific.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/png_archive/libpng.pic.a -Wl,-no-whole-archive -Wl,-whole-archive bazel-out/armeabi-opt/bin/external/zlib_archive/libzlib.pic.a -Wl,-no-whole-archive '-Wl,-rpath,$ORIGIN/' -Wl,-soname,libtensorflow_framework.so -ldl -lm -lpthread -lm -lpthread -lm -ldl -ldl -pthread -lm -lm -Wl,-z,relro,-z,now -Wl,--gc-sections -v -mandroid -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64)
Using built-in specs.
COLLECT_GCC=/android-arm/bin/aarch64-linux-android-gcc
COLLECT_LTO_WRAPPER=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/lto-wrapper
Target: aarch64-linux-android
Configured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/ec4cb553ef61611c1d388a938c56382a --target=aarch64-linux-android --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/ec4cb553ef61611c1d388a938c56382a --with-sysroot=/tmp/ec4cb553ef61611c1d388a938c56382a/sysroot --with-binutils-version=2.27 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/ec4cb553ef61611c1d388a938c56382a/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-ld=default --enable-threads --enable-eh-frame-hdr-for-static --enable-fix-cortex-a53-835769 --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --program-transform-name='s&^&aarch64-linux-android-&' --enable-gold
Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (GCC) 
COMPILER_PATH=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/:/android-arm/bin/../libexec/gcc/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/
LIBRARY_PATH=/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/:/android-arm/bin/../lib/gcc/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64/:/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/:/android-arm/bin/../sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-shared' '-o' 'bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so' '-pthread' '-v' '-mandroid' '-L/android-arm/sysroot/usr/lib' '-L/android-arm/lib' '-L/android-arm/lib64' '-L/android-arm/aarch64-linux-android/lib' '-L/android-arm/aarch64-linux-android/lib64' '-mlittle-endian' '-mabi=lp64'
 /android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/collect2 -plugin /android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/liblto_plugin.so -plugin-opt=/android-arm/bin/../libexec/gcc/aarch64-linux-android/4.9.x/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIwFJZt.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-ldl -plugin-opt=-pass-through=-lgcc --sysroot=/android-arm/bin/../sysroot --eh-frame-hdr -shared -dynamic-linker /system/bin/linker64 -X -EL -maarch64linux --fix-cortex-a53-835769 --fix-cortex-a53-843419 -z noexecstack -z relro -z now -o bazel-out/armeabi-opt/bin/tensorflow/libtensorflow_framework.so /android-arm/bin/../sysroot/usr/lib/crtbegin_so.o -L/android-arm/sysroot/usr/lib -L/android-arm/lib -L/android-arm/lib64 -L/android-arm/aarch64-linux-android/lib -L/android-arm/aarch64-linux-android/lib64 -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x -L/android-arm/bin/../lib/gcc -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64 -L/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib -L/android-arm/bin/../sysroot/usr/lib -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libframework_internal_impl.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libversion_lib.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_internal_impl.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_hash_crc32c_accelerate_internal.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/liblib_proto_parsing.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/snappy/libsnappy.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/protobuf_archive/libprotobuf_lite.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libprotos_all_cc_impl.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/costs/libop_performance_data_cc_impl.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/stream_executor/libstream_executor_impl.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_runtime_impl.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_impl.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_id.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_init_impl.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgpu_lib.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/nsync/libnsync_cpp.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/liblookup_util.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/kernels/libinitializable_lookup_table.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libtensor_bundle.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/util/tensor_bundle/libnaming.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libcore_cpu_base.pic.lo -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/libgraph.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libgrappler_item.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libop_types.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/tensorflow/core/grappler/libutils.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libbase.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libspinlock_wait.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/com_google_absl/absl/base/libdynamic_annotations.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/gif_archive/libgif.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libjpeg.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/jpeg/libsimd_none.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/com_googlesource_code_re2/libre2.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/farmhash_archive/libfarmhash.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/fft2d/libfft2d.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libsip_hash.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/highwayhash/libarch_specific.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/png_archive/libpng.pic.a -no-whole-archive -whole-archive bazel-out/armeabi-opt/bin/external/zlib_archive/libzlib.pic.a -no-whole-archive -rpath $ORIGIN/ -soname libtensorflow_framework.so -ldl -lm -lpthread -lm -lpthread -lm -ldl -ldl -lm -lm -z relro -z now --gc-sections -lgcc -lc -ldl -lgcc /android-arm/bin/../sysroot/usr/lib/crtend_so.o
/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lpthread
/android-arm/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status

But still can't figure out where those last couple -lpthread flags are coming from..

wormwang commented 6 years ago

I meet same error at ubuntu ARM 16.04 with AMD ROCm and TF 1.3 https://github.com/ROCmSoftwarePlatform/tensorflow

root@scw-6c39c7:~/tensorflow# bazel build --config=opt --config=rocm //tensorflow/tools/pip_package:build_pip_package --verbose_failures ERROR: /root/.cache/bazel/_bazel_root/efb88f6336d9c4a18216fb94287b8d97/external/io_bazel_rules_closure/closure/filegroup_external.bzl:23:16: name 'set' is not defined ERROR: /root/.cache/bazel/_bazel_root/efb88f6336d9c4a18216fb94287b8d97/external/io_bazel_rules_closure/closure/webfiles/web_library.bzl:43:14: name 'set' is not defined ERROR: error loading package '': Extension 'closure/filegroup_external.bzl' has errors ERROR: error loading package '': Extension 'closure/filegroup_external.bzl' has errors INFO: Elapsed time: 4.595s INFO: 0 processes. FAILED: Build did NOT complete successfully (0 packages loaded)

HaoLiuHust commented 6 years ago

@wormwang same problem