Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.py fails in a Docker container: /bin/bash: line 1: $'\r': command not found #653

Closed
jjunny24 opened this issue Jul 12, 2022 · 6 comments
Labels
docker Docker-specific issue host:windows Issue that occurs when host OS is Windows type:build/install Cannot build/install the plugin

Comments

@jjunny24
Copy link

Plugin Version or Commit ID

v0.10.1

Unity Version

2021.3.3f1

Your Host OS

Windows 10 pro

Target Platform

Android

[Windows Only] Visual Studio C++ and Windows SDK Version

No response

[Linux Only] GCC/G++ and GLIBC Version

No response

[Android Only] Android Build Tools and NDK Version

No response

[iOS Only] XCode Version

No response

Command Sequences

.

Log

.

Additional Context

On windows, python3.10 is installed when building using linux dockerfile. This causes the build to fail. Where do I need to edit the dockerfile to install python3.9?

@jjunny24 jjunny24 added the type:build/install Cannot build/install the plugin label Jul 12, 2022
@homuler
Copy link
Owner

homuler commented Jul 12, 2022

Please enter the required fields.

Command Sequences

List the commands and operations you performed, in order and as best you can.
Be careful to describe what you actually did (e.g. run export PYTHON_BIN_PATH=...), not what you wanted to do (e.g. set PYTHON_BIN_PATH).

Log

Attach full log in text format.
When executing build command, make sure to add -vv option (e.g. python build.py build --desktop cpu -vv).
It is preferable to include a log of commands executed during installation (e.g. sudo apt-get install ...).

@jjunny24
Copy link
Author

Command : $ python build.py build --android arm64 -vv
Log : INFO (build.py): Building protobuf sources...
DEBUG (build.py): Running bazel build -c opt --verbose_failures //mediapipe_api:mediapipe_proto_srcs
2022/07/13 04:26:21 Downloading https://releases.bazel.build/5.2.0/release/bazel-5.2.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
WARNING: Download from http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/2f6de37d68a4c69e2ff9eec3cebbf1369e496940.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'rules_python' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "73106859751c2bc314861adc136d5cbecee3f7ae7d05539dc8235efbf4efdcbe"
DEBUG: Repository rules_cc instantiated at:
/home/mediapipe/WORKSPACE:90:13: in
Repository rule http_archive defined at:
/home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in
INFO: Analyzed target //mediapipe_api:mediapipe_proto_srcs (102 packages loaded, 1252 targets configured).
INFO: Found 1 target...
INFO: From Compiling src/google/protobuf/message_lite.cc [for host]:
In file included from /usr/include/string.h:535,
from external/com_google_protobuf/src/google/protobuf/stubs/port.h:39,
from external/com_google_protobuf/src/google/protobuf/stubs/common.h:48,
from external/com_google_protobuf/src/google/protobuf/message_lite.h:45,
from external/com_google_protobuf/src/google/protobuf/message_lite.cc:36:
In function 'void* memcpy(void*, const void*, size_t)',
inlined from 'uint8_t* google::protobuf::io::EpsCopyOutputStream::WriteRaw(const void*, int, uint8_t*)' at external/com_google_protobuf/src/google/protobuf/io/coded_stream.h:706:16,
inlined from 'virtual uint8_t* google::protobuf::internal::ImplicitWeakMessage::_InternalSerialize(uint8_t*, google::protobuf::io::EpsCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/implicit_weak_message.h:84:28,
inlined from 'bool google::protobuf::MessageLite::SerializePartialToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/message_lite.cc:412:30:
/usr/include/bits/string_fortified.h:29:33: warning: 'void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
30 | __glibc_objsize0 (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: /home/mediapipe/mediapipe_api/calculators/image/BUILD:88:17: Executing genrule //mediapipe_api/calculators/image:segmentation_smoothing_calculator_cs failed: (Exit 127): bash failed: error executing command
(cd /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/sandbox/processwrapper-sandbox/192/execroot/mediapipe_api &&
exec env -
PATH=/home/mediapipe/.cache/bazelisk/downloads/bazelbuild/bazel-5.2.0-linux-x86_64/bin:/home/mediapipe/.npm-packages/bin:/home/mediapipe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh;
mkdir -p bazel-out/k8-opt/bin
bazel-out/host/bin/external/com_google_protobuf/protoc --proto_path=. --proto_path=bazel-out/k8-opt/bin --proto_path=$(pwd)/external/com_google_protobuf/src --proto_path=$(pwd)/external/com_google_mediapipe --csharp_out=bazel-out/k8-opt/bin mediapipe/calculators/image/segmentation_smoothing_calculator.proto
mv bazel-out/k8-opt/bin/SegmentationSmoothingCalculator.cs $(dirname bazel-out/k8-opt/bin/mediapipe_api/calculators/image/SegmentationSmoothingCalculator.cs)
')

Configuration: 5bc79e698554396b72b5903a55749cf17a8b795382c49b33c74c1b2f0dfe3a15

Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/bin/bash: line 1: $'\r': command not found
Target //mediapipe_api:mediapipe_proto_srcs failed to build
INFO: Elapsed time: 576.724s, Critical Path: 212.82s
INFO: 229 processes: 44 internal, 185 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
File "/home/mediapipe/build.py", line 469, in
Argument().command().run()
File "/home/mediapipe/build.py", line 112, in run
self._run_command(self._build_proto_srcs_commands())
File "/home/mediapipe/build.py", line 54, in _run_command
return subprocess.run(' '.join(command_list), check=True, shell=shell)
File "/usr/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'bazel build -c opt --verbose_failures //mediapipe_api:mediapipe_proto_srcs' returned non-zero exit status 1.

Thank you for the reply.

@homuler
Copy link
Owner

homuler commented Jul 13, 2022

See https://github.com/homuler/MediaPipeUnityPlugin/wiki/Installation-Guide#binbash-line-1-r-command-not-found.

Probably you've set core.autocrlf=true in .gitconfig (run git config -l).
Check out the source code as it is without changing the line feed code.

See https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace for more details.

@homuler homuler added docker Docker-specific issue host:windows Issue that occurs when host OS is Windows labels Jul 13, 2022
@homuler homuler changed the title docker build python version issue build.py fails in a Docker container: /bin/bash: line 1: $'\r': command not found Jul 13, 2022
@jjunny24
Copy link
Author

This is the result after running git config -l.

Command : python build.py build --android arm64 -vv
Log :
INFO (build.py): Building protobuf sources...
DEBUG (build.py): Running bazel build -c opt --verbose_failures //mediapipe_api:mediapipe_proto_srcs
Starting local Bazel server and connecting to it...
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'rules_python' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "73106859751c2bc314861adc136d5cbecee3f7ae7d05539dc8235efbf4efdcbe"
DEBUG: Repository rules_cc instantiated at:
/home/mediapipe/WORKSPACE:90:13: in
Repository rule http_archive defined at:
/home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in
INFO: Analyzed target //mediapipe_api:mediapipe_proto_srcs (102 packages loaded, 1252 targets configured).
INFO: Found 1 target...
INFO: From Compiling src/google/protobuf/message_lite.cc [for host]:
In file included from /usr/include/string.h:535,
from external/com_google_protobuf/src/google/protobuf/stubs/port.h:39,
from external/com_google_protobuf/src/google/protobuf/stubs/common.h:48,
from external/com_google_protobuf/src/google/protobuf/message_lite.h:45,
from external/com_google_protobuf/src/google/protobuf/message_lite.cc:36:
In function 'void* memcpy(void*, const void*, size_t)',
inlined from 'uint8_t* google::protobuf::io::EpsCopyOutputStream::WriteRaw(const void*, int, uint8_t*)' at external/com_google_protobuf/src/google/protobuf/io/coded_stream.h:706:16,
inlined from 'virtual uint8_t* google::protobuf::internal::ImplicitWeakMessage::_InternalSerialize(uint8_t*, google::protobuf::io::EpsCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/implicit_weak_message.h:84:28,
inlined from 'bool google::protobuf::MessageLite::SerializePartialToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const' at external/com_google_protobuf/src/google/protobuf/message_lite.cc:412:30:
/usr/include/bits/string_fortified.h:29:33: warning: 'void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
30 | __glibc_objsize0 (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: /home/mediapipe/mediapipe_api/calculators/core/BUILD:86:17: Executing genrule //mediapipe_api/calculators/core:quantize_float_vector_calculator_cs failed: (Exit 127): bash failed: error executing command
(cd /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/sandbox/processwrapper-sandbox/191/execroot/mediapipe_api &&
exec env -
PATH=/home/mediapipe/.cache/bazelisk/downloads/bazelbuild/bazel-5.2.0-linux-x86_64/bin:/home/mediapipe/.npm-packages/bin:/home/mediapipe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh;
mkdir -p bazel-out/k8-opt/bin
bazel-out/host/bin/external/com_google_protobuf/protoc --proto_path=. --proto_path=bazel-out/k8-opt/bin --proto_path=$(pwd)/external/com_google_protobuf/src --proto_path=$(pwd)/external/com_google_mediapipe --csharp_out=bazel-out/k8-opt/bin mediapipe/calculators/core/quantize_float_vector_calculator.proto
mv bazel-out/k8-opt/bin/QuantizeFloatVectorCalculator.cs $(dirname bazel-out/k8-opt/bin/mediapipe_api/calculators/core/QuantizeFloatVectorCalculator.cs)
')

Configuration: 5bc79e698554396b72b5903a55749cf17a8b795382c49b33c74c1b2f0dfe3a15

Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/bin/bash: line 1: $'\r': command not found
ERROR: /home/mediapipe/mediapipe_api/calculators/image/BUILD:41:17: Executing genrule //mediapipe_api/calculators/image:scale_image_calculator_cs failed: (Exit 127): bash failed: error executing command
(cd /home/mediapipe/.cache/bazel/_bazel_mediapipe/6c11c387a04fa8f17c87a5c6db6ee555/sandbox/processwrapper-sandbox/188/execroot/mediapipe_api &&
exec env -
PATH=/home/mediapipe/.cache/bazelisk/downloads/bazelbuild/bazel-5.2.0-linux-x86_64/bin:/home/mediapipe/.npm-packages/bin:/home/mediapipe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh;
mkdir -p bazel-out/k8-opt/bin
bazel-out/host/bin/external/com_google_protobuf/protoc --proto_path=. --proto_path=bazel-out/k8-opt/bin --proto_path=$(pwd)/external/com_google_protobuf/src --proto_path=$(pwd)/external/com_google_mediapipe --csharp_out=bazel-out/k8-opt/bin mediapipe/calculators/image/scale_image_calculator.proto
mv bazel-out/k8-opt/bin/ScaleImageCalculator.cs $(dirname bazel-out/k8-opt/bin/mediapipe_api/calculators/image/ScaleImageCalculator.cs)
')

Configuration: 5bc79e698554396b72b5903a55749cf17a8b795382c49b33c74c1b2f0dfe3a15

Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/bin/bash: line 1: $'\r': command not found
Target //mediapipe_api:mediapipe_proto_srcs failed to build
INFO: Elapsed time: 397.860s, Critical Path: 291.85s
INFO: 278 processes: 93 internal, 185 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
Traceback (most recent call last):
File "/home/mediapipe/build.py", line 469, in
Argument().command().run()
File "/home/mediapipe/build.py", line 112, in run
self._run_command(self._build_proto_srcs_commands())
File "/home/mediapipe/build.py", line 54, in _run_command
return subprocess.run(' '.join(command_list), check=True, shell=shell)
File "/usr/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'bazel build -c opt --verbose_failures //mediapipe_api:mediapipe_proto_srcs' returned non-zero exit status 1.

@homuler
Copy link
Owner

homuler commented Jul 13, 2022

This is the result after running git config -l.

What is "This"?
I mean that I think you have downloaded (git clone, to be precise) the source code and changed the line feed code from LF to CR+LF.
To build a Docker image properly, you need to download the source code as is (don't change the line feed code).

If you don't know why this happens, see https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace.

See also #172 (comment).

@jjunny24
Copy link
Author

Build was successful. Thank you

@homuler homuler closed this as completed Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Docker-specific issue host:windows Issue that occurs when host OS is Windows type:build/install Cannot build/install the plugin
Projects
None yet
Development

No branches or pull requests

2 participants