Bazel can't find g++ despite both MSYS2 and native shell supporting it - g++

I have installed Bazel through Chocolatey on Windows and MSYS2 to have access to bash.exe.
A script I am trying to build uses g++ which I installed through pacman in MSYS2 and also added to PATH. I am able to run g++ --version in both the MSYS2 shell and my native Powershell.
But somehow it seems as if MSYS2 can't run g++ when I am running it through Bazel.
C:/<censored>> bazel build //kernels:rasterize_triangles_kernel
INFO: Analyzed target //kernels:rasterize_triangles_kernel (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: C:/<censored>/kernels/BUILD:20:8: Executing genrule //kernels:rasterize_triangles_kernel failed: (Exit 127): bash.exe failed: error executing command (from target //kernels:rasterize_triangles_kernel) C:\msys64\usr\bin\bash.exe -c ... (remaining 1 argument skipped)
/usr/bin/bash: line 1: g++: command not found
Target //kernels:rasterize_triangles_kernel failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.883s, Critical Path: 4.80s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Related

Why do I get error 'unrecognized command line option '-fuse-ld=--enable-gold=default' when building Tensorflow?

I am trying to build Tensorflow from source as described at: https://www.tensorflow.org/install/source
I have Bazel 0.29.1 and Python available. I do:
module load bazeltest/0.29.1
module load pythontest/gcc6.3.0/3.7.5tensorflow
./configure
I choose all default options in configure, then:
bazel build //tensorflow/tools/pip_package:build_pip_package
The build proceeds for a while, but fails at:
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /gpfs01/home/cczcb/.cache/bazel/_bazel_cczcb/f0a4604cf88277481621943e2a61f102/external/swig/BUILD.bazel:5:1: Linking of rule '#swig//:swig' failed (Exit 1)
gcc: error: unrecognized command line option '-fuse-ld=--enable-gold=default'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 18.642s, Critical Path: 10.57s
INFO: 125 processes: 125 local.
FAILED: Build did NOT complete successfully
I have also tried:
bazel build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/tools/pip_package:build_pip_package
as I am using GCC 6.3.0 here. The result is the same, as it is when I use GCC 4.9.3.
My O/S is Centos 7.4.
Can anyone advise what might be amiss ?
thanks,
Colin

How to build tensorflow benchmark tool

Following https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/benchmark
bazel build -c opt --crosstool_top=//external:android/crosstool --cpu=armeabi-v7a --host_crosstool_top=#bazel_tools//tools/cpp:toolchain --config monolithic tensorflow/tools/benchmark:benchmark_model
I get
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/Users/user/external_projects/tensorflow/tools/bazel.rc
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=176
ERROR: Config value monolithic is not defined in any .rc file
How to fix it?
bazel version
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/Users/user/external_projects/tensorflow/tools/bazel.rc
Build label: 0.23.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Mar 4 10:40:32 2019 (1551696032)
Build timestamp: 1551696032
Build timestamp as int: 1551696032
Update:
For fresh tensorflow master I get:
INFO: Analysed target //tensorflow/tools/benchmark:benchmark_model (71 packages loaded, 4664 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_user/144c1461f36cde95de1693452c235294/external/com_google_absl/absl/types/BUILD.bazel:178:1: C++ compilation of rule '#com_google_absl//absl/types:bad_optional_access' failed (Exit 1)
clang: error: unknown argument: '-m<platform_for_version_min>-version-min=10.14'
Target //tensorflow/tools/benchmark:benchmark_model failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 98.302s, Critical Path: 18.67s
INFO: 399 processes: 399 local.
FAILED: Build did NOT complete successfully
Update 2:
On Ubuntu 16 and fresh tensorflow master:
bazel version
INFO: Invocation ID: 34e40dab-96b2-45ef-b549-dab45a2738bc
Build label: 0.22.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Jan 28 12:58:08 2019 (1548680288)
Build timestamp: 1548680288
Build timestamp as int: 1548680288
Output:
WARNING: /data/user_data/external_projects/tensorflow/tensorflow/core/BUILD:1794:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/distributed_runtime:server_lib.h' directly. You should either move the file to this package or depend on an appropriate rule there
INFO: Analysed target //tensorflow/tools/benchmark:benchmark_model (72 packages loaded, 4809 targets configured).
INFO: Found 1 target...
INFO: From Compiling external/snappy/snappy-sinksource.cc [for host]:
cc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
INFO: From Compiling external/snappy/snappy-stubs-internal.cc [for host]:
cc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
INFO: From Compiling external/snappy/snappy.cc [for host]:
cc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
ERROR: /home/user/.cache/bazel/_bazel_user/b4774fbdb8542988b4e302c9e073f145/external/com_google_absl/absl/container/BUILD.bazel:529:1: C++ compilation of rule '#com_google_absl//absl/container:raw_hash_set' failed (Exit 1)
Target //tensorflow/tools/benchmark:benchmark_model failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 59.522s, Critical Path: 11.24s
INFO: 456 processes: 456 local.
FAILED: Build did NOT complete successfully
Which version of the NDK are you using? I used the following command line and it worked:
$ bazel build -c opt \
--crosstool_top=//external:android/crosstool \
--cpu=armeabi-v7a \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--config monolithic \
--cxxopt=-std=c++11 \
tensorflow/tools/benchmark:benchmark_model
This is with Bazel 0.23.2 and NDK r17c on https://github.com/tensorflow/tensorflow/commit/7bd86377dedaf459d22b68363a0a2d4580180379.

Compile TensorFlow v1.8.0 cuda/include/cublas_v2.h: No such file or directory

When I compile TensorFlow v1.8
ERROR: /work/tensorflow/tensorflow/stream_executor/BUILD:52:1: C++ compilation of rule '//tensorflow/stream_executor:cuda_platform' failed (Exit 1)
tensorflow/stream_executor/cuda/cuda_blas.cc:16:36: fatal error: cuda/include/cublas_v2.h: No such file or directory
compilation terminated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 119.973s, Critical Path: 43.00s
INFO: 3322 processes, local.
FAILED: Build did NOT complete successfully
I find /usr/local/cuda/include don't have this file. How can get it?
Running bazel clean --expunge and then compiling again seems to have fixed it for me.
Compiling tensorflow 1.12.3 with bazel 0.15.2

tensorflow tools: can't figure out how to build/run summarize_graph

I'm trying to convert my *.pb tensorflow model to coreML. I'm getting stuck on identifying my output node of my model.
In order to obtain my output node, I've attempted to build and run summarize_graph on my *.pb file, but running into issues. How do I build and run summarize_graph after downloading the source?
I've run the following command:
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=tensorflow_inception_graph.pb
and I get the following error:
INFO: Analysed 0 targets (0 packages loaded). INFO: Found 0 targets...
INFO: Elapsed time: 0.389s, Critical Path: 0.01s INFO: Build completed
successfully, 1 total action
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph: No such
file or directory
After issuing the bazel command, a blank bazel-bin directory appears in the location I executed the command.
Note, summarize_graph didn't exist in my tensorflow installation. So I downloaded the source from github tensorflow/tools/graph_transforms and copied it into my tensorflow/tools/graph_transforms directory.
the directory contains the following:
BUILD README.md
init.py
init.pyc add_default_attributes.cc add_default_attributes_test.cc backports.cc backports_test.cc compare_graphs.cc
fake_quantize_training.cc fake_quantize_training_test.cc file_utils.cc
file_utils.h file_utils_test.cc flatten_atrous.cc
flatten_atrous_test.cc fold_batch_norms.cc fold_batch_norms_test.cc
fold_constants_lib.cc fold_constants_lib.h fold_constants_test.cc
fold_old_batch_norms.cc fold_old_batch_norms_test.cc
freeze_requantization_ranges.cc freeze_requantization_ranges_test.cc
fuse_convolutions.cc fuse_convolutions_test.cc insert_logging.cc
insert_logging_test.cc obfuscate_names.cc obfuscate_names_test.cc out
python quantize_nodes.cc quantize_nodes_test.cc quantize_weights.cc
quantize_weights_test.cc remove_attribute.cc remove_attribute_test.cc
remove_device.cc remove_device_test.cc remove_ema.cc
remove_ema_test.cc remove_nodes.cc remove_nodes_test.cc
rename_attribute.cc rename_attribute_test.cc rename_op.cc
rename_op_test.cc round_weights.cc round_weights_test.cc set_device.cc
set_device_test.cc sort_by_execution_order.cc
sort_by_execution_order_test.cc sparsify_gather.cc
sparsify_gather_test.cc strip_unused_nodes.cc
strip_unused_nodes_test.cc summarize_graph_main.cc transform_graph.cc
transform_graph.h transform_graph_main.cc transform_graph_test.cc
transform_utils.cc transform_utils.h transform_utils_test.cc
I'm on a macbook pro
Thanks!
In case anyone is running into the similar problem, I solved it.
Navigate to the root of the tensorflow source directory
cmd> ./configure
cmd> bazel build tensorflow/tools/graph_transforms:summarize_graph
(you may get an error about xcode; if so, run the following)
cmd> xcode-select -s /Applications/Xcode.app/Contents/Developer
cmd> bazel clean --expunge
cmd> bazel build tensorflow/tools/graph_transforms:summarize_graph
CentOS 7 walkthrough:
yum install epel-release
yum update
yum install patch
curl https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo -o /etc/yum.repos.d/vbatts-bazel-epel-7.repo
yum install bazel
curl -L -O https://github.com/tensorflow/tensorflow/archive/v1.8.0.tar.gz
cd tensorflow-1.8.0
./configure # interactive!
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph

VxWorks 6.8 Image Project Not Compiling

I am using Wind River Workbench 3.3 and VxWorks 6.8. When using building from the command line everything works, but when I attempt to build within Workbench I get errors. In attempting to track it down, I have determined that the same problem occurs when creating a new VxWorks Image Project using our board support package and the gnu tool chain.
I created a new project and attempt to build it in the default_romCompress build spec. I get the following errors.
romInit.o: In function `delay_100us':
C:/WindRiver/vxworks-6.8/target/config/mrim/romInit.s:649: undefined reference to `romStart'
C:/WindRiver/vxworks-6.8/target/config/mrim/romInit.s:650: undefined reference to `romStart'
make.exe[1]: *** [vxWorks_romCompress] Error 1
rm ipcom_ipdomain
make.exe[1]: Leaving directory `D:/WindRiverWorkbench/Test/default_romCompress'
C:\WindRiver\utilities-1.0\x86-win32\bin\make.exe: *** [target_vxWorks] Error 2
Build Failed in Project 'Test' (Process Exit Value was 2): 2014-01-14 17:22:11 (Elapsed Time: 00:06)
the symbol romStart is defined in romStart.c, which is part of the project. When I attempt to compile just romStart.c I get the following output.
Build Started in Project 'Test': 2014-01-15 08:57:25
Generation of makefiles started.
Generation of makefiles finished (Elapsed Time: 00:00).
Platform: Wind River VxWorks 6.8
Command: make BUILD_SPEC=default_romCompress DEBUG_MODE=0 TRACE=1 default_romCompress/romStart.o
Working Directory: D:/WindRiverWorkbench/Test
make.exe[1]: Entering directory `D:/WindRiverWorkbench/Test'
make.exe[2]: Entering directory `D:/WindRiverWorkbench/Test/default_romCompress'
ccppc -c -DCPU_VARIANT=_ppc860 -g -msoft-float -mstrict-align -ansi -fno-builtin -Wall -D_VSB_CONFIG_FILE=\"C:/WindRiver/vxworks-6.8/target/lib/h/config/vsbConfig.h\" -mcpu=860 -I.. -IC:/WindRiver/vxworks-6.8/target/config/mrim -IC:/WindRiver/vxworks-6.8/target/h -IC:/WindRiver/vxworks-6.8/target/config/comps/src -IC:/WindRiver/vxworks-6.8/target/h/wrn/coreip -IC:/WindRiver/vxworks-6.8/target/src/drv -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=sfgnu -DPRJ_BUILD -D_WRS_KERNEL -IC:/WindRiver/components/windml-5.3/h -IC:/WindRiver/components/webservices-1.7/h -IC:/WindRiver/components/webcli-4.8/target/h -IC:/WindRiver/components/opc-3.2/h -IC:/WindRiver/components/dcom-2.3/h -IC:/WindRiver/components/windml-5.3/osconfig/vxworks/src -IC:/WindRiver/components/ip_net2-6.8/osconfig/vxworks/src -IC:/WindRiver/components/windml-5.3/osconfig/vxworks/h -IC:/WindRiver/components/ip_net2-6.8/osconfig/vxworks/h -IC:/WindRiver/vxworks-6.8/target/src/hwif -IC:/WindRiver/vxworks-6.8/target/src/hwif/h #./ipcom_ipdomain -DIP_PORT_VXWORKS=68 -DINET -UCPU -DCPU=PPC860 -I. -MD -fvolatile -G8 -msdata=eabi -DROM_COMPRESS -DRAM_DATA_ADRS=0x00e00000 -DRAM_DST_ADRS=0x00010000 C:/WindRiver/vxworks-6.8/target/config/comps/src/romStart.c -o romStart.o
ccppc: #./ipcom_ipdomain: No such file or directory
make.exe[2]: *** [romStart.o] Error 1
make.exe[2]: Leaving directory `D:/WindRiverWorkbench/Test/default_romCompress'
make.exe[1]: *** [compile_romStart.o] Error 2
make.exe[1]: Leaving directory `D:/WindRiverWorkbench/Test'
C:\WindRiver\utilities-1.0\x86-win32\bin\make.exe: *** [default_romCompress/romStart.o] Error 2
Build Failed in Project 'Test' (Process Exit Value was 2): 2014-01-15 08:57:26 (Elapsed Time: 00:01)
However, if I attempt to compile romStart.c a second time, then it succeeds
If I again try to build the project (not clean and not rebuild), then it fails again with the following output.
Build Started in Project 'Test': 2014-01-15 08:58:36
Generation of makefiles started.
Generation of makefiles finished (Elapsed Time: 00:00).
Platform: Wind River VxWorks 6.8
Command: make BUILD_SPEC=default_romCompress DEBUG_MODE=0 TRACE=1
Working Directory: D:/WindRiverWorkbench/Test
building default vxWorks image of D:/WindRiverWorkbench/Test
make.exe[1]: Entering directory `D:/WindRiverWorkbench/Test/default_romCompress'
cp vxWorks vxWorks.o
true vxWorks.o
objcopyppc -O binary --binary-without-bss vxWorks.o tmp.bin
VX_CPU_FAMILY=ppc C:/WindRiver/vxworks-6.8/host/x86-win32/bin/deflate < tmp.bin > tmp.Z
Deflation: 53.98%
VX_CPU_FAMILY=ppc C:/WindRiver/vxworks-6.8/host/x86-win32/bin/binToAsm tmp.Z > vxWorks.Z.s
ccppc -c -DCPU_VARIANT=_ppc860 -g -msoft-float -mstrict-align -ansi -fno-builtin -xassembler-with-cpp -D_VSB_CONFIG_FILE=\"C:/WindRiver/vxworks-6.8/target/lib/h/config/vsbConfig.h\" -mcpu=860 -I.. -IC:/WindRiver/vxworks-6.8/target/config/mrim -IC:/WindRiver/vxworks-6.8/target/h -IC:/WindRiver/vxworks-6.8/target/config/comps/src -IC:/WindRiver/vxworks-6.8/target/h/wrn/coreip -IC:/WindRiver/vxworks-6.8/target/src/drv -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=sfgnu -DPRJ_BUILD -D_WRS_KERNEL -IC:/WindRiver/components/windml-5.3/h -IC:/WindRiver/components/webservices-1.7/h -IC:/WindRiver/components/webcli-4.8/target/h -IC:/WindRiver/components/opc-3.2/h -IC:/WindRiver/components/dcom-2.3/h -IC:/WindRiver/components/windml-5.3/osconfig/vxworks/src -IC:/WindRiver/components/ip_net2-6.8/osconfig/vxworks/src -IC:/WindRiver/components/windml-5.3/osconfig/vxworks/h -IC:/WindRiver/components/ip_net2-6.8/osconfig/vxworks/h -IC:/WindRiver/vxworks-6.8/target/src/hwif -IC:/WindRiver/vxworks-6.8/target/src/hwif/h #./ipcom_ipdomain -DIP_PORT_VXWORKS=68 -DINET -UCPU -DCPU=PPC860 -I. -MD vxWorks.Z.s -o vxWorks.Z.o
ccppc: #./ipcom_ipdomain: No such file or directory
make.exe[1]: *** [vxWorks_romCompress] Error 1
make.exe[1]: Leaving directory `D:/WindRiverWorkbench/Test/default_romCompress'
C:\WindRiver\utilities-1.0\x86-win32\bin\make.exe: *** [target_vxWorks] Error 2
Build Failed in Project 'Test' (Process Exit Value was 2): 2014-01-15 08:58:37 (Elapsed Time: 00:01)
Can anyone suggest how I might go about fixing these problems?