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

[Windows] bazel.exe crash on paths with Cyrillic characters #3821

Closed
KindDragon opened this issue Sep 26, 2017 · 36 comments
Closed

[Windows] bazel.exe crash on paths with Cyrillic characters #3821

KindDragon opened this issue Sep 26, 2017 · 36 comments
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) platform: windows stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Milestone

Comments

@KindDragon
Copy link

Description of the problem / feature request / question:

Application bazel.exe or bazel-0.5.4-without-jdk-windows-x86_64.exe crash at startup even without parameter

If possible, provide a minimal example to reproduce the problem:

Just run exe-file

Environment info

  • Operating System:
    Microsoft Windows [Version 10.0.15063]

  • Bazel version (output of bazel info release):
    0.5.4

Have you found anything relevant by searching the web?

No

Anything else, information or logs or outputs that would be helpful?

Full dump bazel.zip

@KindDragon
Copy link
Author

KindDragon commented Sep 26, 2017

I've tried extract all files from bazel.exe, client.exe crash same way

@katre katre added platform: windows P1 I'll work on this now. (Assignee required) labels Sep 27, 2017
@laszlocsomor
Copy link
Contributor

I need more info:

  • What exact command did you try to run?
  • Which shell did you use: Command Prompt (cmd.exe), PowerShell, MSYS, something else?
  • What's the crash message?
  • What should I open the bazel.dmp file with that you attached in bazel.zip?

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Sep 27, 2017

One more question:

Just run exe-file

What exactly do you mean by run: double-click on it in Windows Explorer, or run it from a shell, or something else?

@KindDragon
Copy link
Author

What exactly do you mean by run: double-click on it in Windows Explorer, or run it from a shell, or something else?

Both, double-click and from command prompt

@KindDragon
Copy link
Author

KindDragon commented Sep 27, 2017

What exact command did you try to run?
Which shell did you use: Command Prompt (cmd.exe), PowerShell, MSYS, something else?

bazel.exe in command prompt

What's the crash message?

This window appears http://support.sas.com/kb/54/addl/fusion_54246_2_sasexestoppedworking.png

What should I open the bazel.dmp file with that you attached in bazel.zip?

This is a process memory dump if you don't know how to debug it, just ignore it

@laszlocsomor
Copy link
Contributor

Hm, so Bazel crashes right after starting?

Let's try something: could you try running it like so:

C:\> path\to\bazel.exe --client_debug --output_user_root=c:\tmp1 version
C:\> path\to\bazel.exe --client_debug --output_user_root=c:\tmp1 info

and paste the output here, if there's any?

Also, just to make sure: you're using a machine with a 64-bit Intel/AMD CPU, not with ARM, right?

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Sep 28, 2017

One more thing, please open the MSYS shell (see installation requirements) and run:

$ stat /c/path/to/bazel.exe
$ md5sum /c/path/to/bazel.exe

The output should be the following for Bazel 0.5.4 (with JDK):

$ stat /c/work/bazel-0.5.4/bazel.exe
  File: /c/work/bazel-0.5.4/bazel.exe
  Size: 200780988       Blocks: 196076     IO Block: 65536  regular file
Device: ae282a26h/2921867814d   Inode: 10133099162421553  Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (1430919/laszlocsomor)   Gid: (1049089/Domain Users)
Access: 2017-08-25 14:30:45.271429000 +0200
Modify: 2017-08-25 14:31:22.620117600 +0200
Change: 2017-08-25 14:33:07.745781000 +0200
 Birth: 2017-08-25 14:30:45.271429000 +0200


$ md5sum /c/work/bazel-0.5.4/bazel.exe
234135feee0f7f696545b31cc3fd6a8b */c/work/bazel-0.5.4/bazel.exe

@KindDragon
Copy link
Author

paste the output here, if there's any?

Empty output

Also, just to make sure: you're using a machine with a 64-bit Intel/AMD CPU, not with ARM, right?

Intel i7-4790K CPU - x64 Windows 10 Pro

$ stat bazel.exe
  File: bazel.exe
  Size: 200780988       Blocks: 196076     IO Block: 65536  regular file
Device: b0e7a712h/2967971602d   Inode: 562949954158902  Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (197609/Аркадий)   Gid: (197609/ UNKNOWN)
Access: 2017-09-27 01:48:37.146843900 +0300
Modify: 1980-01-01 00:00:00.000000000 +0300
Change: 2017-09-29 02:41:18.030932800 +0300
 Birth: 2017-09-27 01:48:37.146843900 +0300

$ md5sum bazel.exe
234135feee0f7f696545b31cc3fd6a8b *bazel.exe

Same thing with 0.6.0

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Sep 29, 2017

So you have the right binary, good OS version, and good architecture.
In that case, maybe Windows is preventing you from running the binary.

Could you try building a hello world and running it like I did below?

C:\Windows\System32>cd c:\temp

c:\temp>"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

c:\temp>echo #include ^<stdio.h^> >hello.cc

c:\temp>echo int main(int,char**){printf("hello!\n");return 0;} >>hello.cc

c:\temp>cl hello.cc /O2
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

hello.cc
Microsoft (R) Incremental Linker Version 14.10.25019.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj

c:\temp>hello.exe
hello!

Depending on the version of VS you installed, vcvars.bat may be elsewhere. E.g. with vc2015 it'll be under C:\Program Files (x86)\Microsoft Visual Studio 14.0\vc\vcvarsall.bat.

Here's my binary for reference.

@laszlocsomor
Copy link
Contributor

Here's my hello.exe's MD5 for reference:

$ md5sum /c/temp/hello.exe
c91ca81a4d7972a9d20ab09b2daa0052 */c/temp/hello.exe

@KindDragon
Copy link
Author

**********************************************************************       
** Visual Studio 2017 Developer Command Prompt v15.0.26730.16                
** Copyright (c) 2017 Microsoft Corporation                                  
**********************************************************************       
[vcvarsall.bat] Environment initialized for: 'x64'                           
                                                                             
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cd \temp       
                                                                             
D:\Temp>echo #include ^<stdio.h^> >hello.cc                                  
                                                                             
D:\Temp>echo int main(int,char**){printf("hello!\n");return 0;} >>hello.cc   
                                                                             
D:\Temp>cl hello.cc /O2                                                      
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25508.2 for x64        
Copyright (C) Microsoft Corporation.  All rights reserved.                   
                                                                             
hello.cc                                                                     
Microsoft (R) Incremental Linker Version 14.11.25508.2                       
Copyright (C) Microsoft Corporation.  All rights reserved.                   
                                                                             
/out:hello.exe                                                               
hello.obj                                                                    
                                                                             
D:\Temp>hello.exe                                                            
hello!                                                                       

md5 dfc86ca2f5b1860a49f25de1ac81a625

@KindDragon
Copy link
Author

Your binary works as well

@laszlocsomor
Copy link
Contributor

Thanks, then it could be a permission issue or something with the self-extracting zip.

Could you look at bazel.exe's properties > security tab?
Maybe you're hitting something similar: #2810 (comment)

Meanwhile can you try building Bazel from source: https://docs.bazel.build/versions/master/install-compile-source.html ?

@laszlocsomor
Copy link
Contributor

Thanks, then it could be a permission issue or something with the self-extracting zip.

I forgot to mention that bazel.exe is a self-extracting zip.

If you had a working Bazel binary, you could build Bazel from source with bazel build //src:bazel.exe. That target's build rule is:

C:\work\bazel>bazel query --output=build //src:bazel.exe
# C:/work/bazel/src/BUILD:315:2
genrule(
  name = "bazel-bin.exe",
  visibility = ["//scripts:__pkg__", "//scripts/packages:__pkg__", "//src/test:__subpackages__"],
  srcs = ["//src:bazel-bin"],
  outs = ["//src:bazel.exe"],
  cmd = "cp $(location :bazel-bin) $@",
  output_to_bindir = True,
  executable = True,
)

and //src:bazel-bin is the one really doing the work:

C:\work\bazel>bazel query --output=build //src:bazel-bin
# C:/work/bazel/src/BUILD:287:2
genrule(
  name = "bazel-bin",
  visibility = ["//scripts:__pkg__", "//scripts/packages:__pkg__", "//src/java:__subpackages__", "//src/test:__subpackages__"],
  srcs = ["//src/main/cpp:client", "//src:package-zip"],
  outs = ["//src:bazel"],
  cmd = "rm -f $@; cat $(location //src/main/cpp:client) $(location :package-zip) > $@ && zip -qA $@",
  output_to_bindir = True,
  executable = True,
)

so maybe the root cause of the crash is that bazel.exe is a concat of an .exe and a .zip, or that it's a self-extracting zip.

@KindDragon
Copy link
Author

I forgot to mention that bazel.exe is a self-extracting zip.

As I mentioned before, client.exe extracted from bazel.exe crash the same way. So it's not a permissions issue.

@laszlocsomor
Copy link
Contributor

Meanwhile can you try building Bazel from source: https://docs.bazel.build/versions/master/install-compile-source.html ?

Did you try this?

@KindDragon
Copy link
Author

I tried, but it returns error

$ ./compile.sh
🍃  Building Bazel from scratch..C:/Program Files/Java/jdk1.8.0_112/bin/javac -classpath third_party/aether/aether-api-1.0.0.v20140518.jar;third_party/aether/aether-connector-basic-1.0.0.v20140518.jar;third_party/aether/aether-impl-1.0.0.v20140518.jar;third_party/aether/aether-spi-1.0.0.v20140518.jar;third_party/aether/aether-transport-classpath-1.0.0.v20140518.jar;third_party/aether/aether-transport-file-1.0.0.v20140518.jar;third_party/aether/aether-transport-http-1.0.0.v20140518.jar;third_party/aether/aether-transport-wagon-1.0.0.v20140518.jar;third_party/aether/aether-util-1.0.0.v20140518.jar;third_party/android_common/com.android.tools.build_builder-model_2.0.0.jar;third_party/android_common/com.android.tools.build_builder-test-api_2.0.0.jar;third_party/android_common/com.android.tools.build_builder_2.0.0.jar;third_party/android_common/com.android.tools.build_manifest-merger_25.0.0.jar;third_party/android_common/com.android.tools.external.lombok_lombok-ast_0.2.3.jar;third_party/android_common/com.android.tools.layoutlib_layoutlib_25.0.0.jar;third_party/android_common/com.android.tools.lint_lint-api_25.0.0.jar;third_party/android_common/com.android.tools.lint_lint-checks_25.0.0.jar;third_party/android_common/com.android.tools_common_25.0.0.jar;third_party/android_common/com.android.tools_ddmlib_25.0.0.jar;third_party/android_common/com.android.tools_dvlib_25.0.0.jar;third_party/android_common/com.android.tools_repository_25.0.0.jar;third_party/android_common/com.android.tools_sdk-common_25.0.0.jar;third_party/android_common/com.android.tools_sdklib_25.0.0.jar;third_party/android_common/com.android_annotations_25.0.0.jar;third_party/apache_commons_codec/commons-codec-1.9.jar;third_party/apache_commons_collections/commons-collections-3.2.2.jar;third_party/apache_commons_compress/apache-commons-compress-1.9.jar;third_party/apache_commons_lang/commons-lang-2.6.jar;third_party/apache_commons_logging/commons-logging-1.1.1.jar;third_party/apache_commons_pool2/commons-pool2-2.3.jar;third_party/apache_httpclient/httpclient-4.5.3.jar;third_party/apache_httpcore/httpcore-4.4.6.jar;third_party/apache_velocity/velocity-1.7.jar;third_party/api_client/google-api-client-1.22.0.jar;third_party/api_client/google-api-client-jackson2-1.22.0.jar;third_party/api_client/google-http-client-1.22.0.jar;third_party/api_client/google-http-client-jackson2-1.22.0.jar;third_party/asm/asm-5.1.jar;third_party/asm/asm-analysis-5.1.jar;third_party/asm/asm-commons-5.1.jar;third_party/asm/asm-tree-5.1.jar;third_party/asm/asm-util-5.1.jar;third_party/auth/google-auth-library-credentials-0.6.0.jar;third_party/auth/google-auth-library-oauth2-http-0.6.0.jar;third_party/auto/auto-common-0.3.jar;third_party/auto/auto-service-1.0-rc2.jar;third_party/auto/auto-value-1.4.jar;third_party/bytebuddy/byte-buddy-dep-0.7-rc6.jar;third_party/checker_framework_dataflow/dataflow-1.8.10.jar;third_party/error_prone/error_prone_annotation-2.1.1.jar;third_party/error_prone/error_prone_annotations-2.1.1.jar;third_party/error_prone/error_prone_check_api-2.1.1.jar;third_party/guava/guava-testlib-21.0.jar;third_party/gson/gson-2.2.4.jar;third_party/hamcrest/hamcrest-core-1.3.jar;third_party/hazelcast/hazelcast-3.6.4.jar;third_party/hazelcast/hazelcast-client-3.6.4.jar;third_party/hungarian_algorithm/software-and-algorithms-1.0-src.jar;third_party/hungarian_algorithm/software-and-algorithms-1.0.jar;third_party/ijar/test/libwrongcentraldir.jar;third_party/instrumentation/instrumentation-api-0.4.3.jar;third_party/jackson2/jackson-core-2.8.6.jar;third_party/java/android_databinding/v2_3_1/exec.jar;third_party/java/jacoco/jacocoagent.jar;third_party/java/jacoco/org.jacoco.agent-0.7.5.201505241946-src.jar;third_party/java/jacoco/org.jacoco.agent-0.7.5.201505241946.jar;third_party/java/jacoco/org.jacoco.core-0.7.5.201505241946-src.jar;third_party/java/jacoco/org.jacoco.core-0.7.5.201505241946.jar;third_party/java/jacoco/org.jacoco.report-0.7.5.201505241946-src.jar;third_party/java/jacoco/org.jacoco.report-0.7.5.201505241946.jar;third_party/java/jarjar/gradle/wrapper/gradle-wrapper.jar;third_party/java/jarjar/jarjar-1.4.jar;third_party/java/jarjar/jarjar-core/src/test/resources/enumtest.jar;third_party/java/javapoet/javapoet-1.8.0.jar;third_party/java/jdk/langtools/javac-9-dev-r4023-3.jar;third_party/java/jdk/langtools/javac.jar;third_party/jcip_annotations/jcip-annotations-1.0-1.jar;third_party/jgit/org.eclipse.jgit-4.0.1.201506240215-r.jar;third_party/jimfs/jimfs-1.1.jar;third_party/joda_time/joda-time-2.3.jar;third_party/jsch/jsch-0.1.51.jar;third_party/jsr305/jsr-305.jar;third_party/jsr330_inject/javax.inject.jar;third_party/junit/junit-4.11.jar;third_party/maven/maven-builder-support-3.3.3.jar;third_party/maven/maven-settings-3.3.3.jar;third_party/maven/maven-settings-builder-3.3.3.jar;third_party/maven_model/maven-aether-provider-3.2.3.jar;third_party/maven_model/maven-model-3.2.3.jar;third_party/maven_model/maven-model-builder-3.2.3.jar;third_party/maven_model/maven-repository-metadata-3.2.3.jar;third_party/mockito/mockito-all-1.10.19.jar;third_party/netty/netty-all-4.1.14.Final.jar;third_party/netty_tcnative/netty-tcnative-boringssl-static-2.0.5.Final.jar;third_party/opencensus/opencensus-api-0.5.1.jar;third_party/pcollections/pcollections-2.1.2.jar;third_party/plexus_component_annotations/plexus-component-annotations-1.6.jar;third_party/plexus_interpolation/plexus-interpolation-1.22.jar;third_party/plexus_utils/plexus-utils-3.0.21.jar;third_party/protobuf/3.4.0/libprotobuf_java.jar;third_party/protobuf/3.4.0/libprotobuf_java_util.jar;third_party/slf4j/slf4j-api-1.7.7.jar;third_party/slf4j/slf4j-jdk14-1.7.7.jar;third_party/tomcat_annotations_api/tomcat-annotations-api-8.0.5.jar;third_party/truth/truth-0.32.jar;third_party/turbine/turbine-0.1-20170828.jar;third_party/xz/xz-1.5.jar;third_party/grpc/grpc-auth-1.6.1.jar;third_party/grpc/grpc-context-1.6.1.jar;third_party/grpc/grpc-core-1.6.1.jar;third_party/grpc/grpc-netty-1.6.1.jar;third_party/grpc/grpc-protobuf-1.6.1.jar;third_party/grpc/grpc-protobuf-lite-1.6.1.jar;third_party/grpc/grpc-stub-1.6.1.jar;third_party/guava/guava-21.0.jar;third_party/error_prone/error_prone_core-2.1.1.jar;C:/Users/Аркадий/AppData/Local/Temp/bazel_v0XhTNcb -sourcepath src/java_tools/ singlejar/java/com/google/devtools/build/zip;src/main/java;src/tools/xcode-common/java/com/google/devtools/build/xcode/common;src/tools/xcode-common/java/com/google/devtools/build/xcode/util;third_party/java/dd_plist/java;C:/Users/Аркадий/AppData/Local/Temp/bazel_v0XhTNcb/src -d C:/Users/Аркадий/AppData/Local/Temp/bazel_v0XhTNcb/classes -
source 1.8 -target 1.8 -encoding UTF-8 @C:/Users/Аркадий/AppData/Local/Temp/bazel_QTpavlKA/param
javac: file not found: C:\Users\Аркадий\AppData\Local\Temp\bazel_v0XhTNcb\src\com\google\api\AnnotationsProto.jav a
Usage: javac <options> <source files>
use -help for a list of possible options

Maybe because cyrillic letters in path

@laszlocsomor
Copy link
Contributor

Yes, that seems to be the issue:

C:\work\bazel>c:\work\bazel-0.5.4\bazel.exe --nomaster_bazelrc --bazelrc=nul --batch --output_user_root=c:\tempdir\cyrillic\Аркадий\foo info
Error: MakeDirectories(c:\tempdir\cyrillic\???????\foo) failed: (error: 123): The filename, directory name, or volume label syntax is incorrect.


C:\work\bazel>c:\work\bazel-0.6.0\bazel.exe --nomaster_bazelrc --bazelrc=nul --batch --output_user_root=c:\tempdir\cyrillic\Аркадий\foo info
Error: MakeDirectories(c:\tempdir\cyrillic\???????\foo) failed: (error: 123): The filename, directory name, or volume label syntax is incorrect.

C:\work\bazel>c:\work\bazel-0.6.0\bazel.exe --nomaster_bazelrc --bazelrc=nul --batch --output_user_root=c:\tempdir\cyrillic\foo info
Extracting Bazel installation...
(...)

@laszlocsomor
Copy link
Contributor

Relevant: #2443

@laszlocsomor laszlocsomor changed the title [Windows] bazel.exe 0.5.4 crash [Windows] bazel.exe 0.5.4 crash on paths with Cyrillic characters Oct 2, 2017
@laszlocsomor laszlocsomor changed the title [Windows] bazel.exe 0.5.4 crash on paths with Cyrillic characters [Windows] bazel.exe crash on paths with Cyrillic characters Oct 2, 2017
@laszlocsomor
Copy link
Contributor

@KindDragon : Please try the following as a workaround until we fix this bug:

  1. set TMP and TEMP envvars to a path without Cyrillic letters
  2. that should be enough, but if not, pass --output_user_root like I did in my example, using a path without Cyrillic

Sorry about the breakage!

@laszlocsomor
Copy link
Contributor

Also make sure your workspace is under a path without Cyrillic letters.

@KindDragon
Copy link
Author

KindDragon commented Oct 2, 2017

set TMP and TEMP envvars to a path without Cyrillic letters

Nope :(

that should be enough, but if not, pass --output_user_root like I did in my example, using a path without Cyrillic

Still crashing even after that :(

d:\Work\bazel>set TEMP
TMP=C:\Users\E51C~1\AppData\Local\Temp

d:\Work\bazel>set TMP=D:\Temp

d:\Work\bazel>set TEMP=D:\Temp

d:\Work\bazel>bazel.exe --nomaster_bazelrc --bazelrc=nul --batch --output_user_root=d:\temp

d:\Work\bazel>bazel.exe
Crash here

@laszlocsomor
Copy link
Contributor

:(

Does the first bazel run succeed though? This one:

d:\Work\bazel>bazel.exe --nomaster_bazelrc --bazelrc=nul --batch --output_user_root=d:\temp

@laszlocsomor
Copy link
Contributor

This bug seems to affect Windows only. On Linux I can use Cyrillic characters:

$ bazel --nomaster_bazelrc --bazelrc=/dev/null --batch --output_user_root=/tmp/cyr/Шостакович/foo info
Extracting Bazel installation...

@KindDragon
Copy link
Author

Does the first bazel run succeed though?

Nope

@KindDragon
Copy link
Author

Meanwhile can you try building Bazel from source

Now it returns error:

🍃  Building Bazel from scratch......Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64          
Copyright (C) Microsoft Corporation.  All rights reserved.                                                          
                                                                                                                    
file-jni.cc                                                                                                         
file.cc                                                                                                             
jni-util.cc                                                                                                         
processes-jni.cc                                                                                                    
util.cc                                                                                                             
Generating Code...                                                                                                  
Microsoft (R) Incremental Linker Version 14.00.24215.1                                                              
Copyright (C) Microsoft Corporation.  All rights reserved.                                                          
                                                                                                                    
/dll                                                                                                                
/implib:D:\Temp\bazel_tTEoi3Gp\jni\windows_jni.lib                                                                  
/out:D:\Temp\bazel_tTEoi3Gp\jni\windows_jni.dll                                                                     
file-jni.obj                                                                                                        
file.obj                                                                                                            
jni-util.obj                                                                                                        
processes-jni.obj                                                                                                   
util.obj                                                                                                            
   Creating library D:\Temp\bazel_tTEoi3Gp\jni\windows_jni.lib and object D:\Temp\bazel_tTEoi3Gp\jni\windows_jni.exp
.                                                                                                                   
🍃  Building Bazel with Bazel.                                                                                      
.Error: Could not find or load main class Files                                                                     
                                                                                                                    
ERROR: Could not build Bazel

@laszlocsomor
Copy link
Contributor

@KindDragon : thanks for your patience!

I concluded that I can't even run a jar file if its path contains Cyrillic characters:

C:\>md c:\temp\cyr\foo\Аркадий

C:\>cd c:\temp\cyr\foo\Аркадий

c:\temp\cyr\foo\Аркадий>echo public class Main { public static void main(String[] args) { System.out.println("Hello Java!"); } } > Main.java

c:\temp\cyr\foo\Аркадий>"c:\Program Files\java\jdk1.8.0_112\bin\javac.exe" Main.java

c:\temp\cyr\foo\Аркадий>"c:\Program Files\java\jdk1.8.0_112\bin\jar.exe" cvfe Main.jar Main Main.class
added manifest
adding: Main.class(in = 409) (out= 278)(deflated 32%)

c:\temp\cyr\foo\Аркадий>copy Main.jar ..\
        1 file(s) copied.

c:\temp\cyr\foo\Аркадий>cd ..\..

c:\temp\cyr>"c:\Program Files\java\jdk1.8.0_112\bin\java.exe" -jar foo\Main.jar
Hello Java!

c:\temp\cyr>"c:\Program Files\java\jdk1.8.0_112\bin\java.exe" -jar foo\Аркадий\Main.jar
Error: Unable to access jarfile foo\???????\Main.jar

Every path the Bazel may access must use only ASCII characters. This includes envvars like PATH, JAVA_HOME, TEMP, but also your workspace path, or the path where you unpacked the Bazel distribution archive and attempted to bootstrap.

Here's one more idea: let's set up a very clean environment and try running the release Bazel binary there, see if that works:

  1. start cmd.exe
  2. list all envvars to a .bat file; we'll edit that file in a moment
    set > d:\temp\unsetall.bat
    
    The result will look something like this, depending on what envvars you have set:
    ALLUSERSPROFILE=C:\ProgramData
    ANDROID_HOME=C:\Users\laszlocsomor\AppData\Local\Android\sdk
    ANDROID_NDK_HOME=C:\Users\laszlocsomor\AppData\Local\Android\sdk\ndk-bundle
    APPDATA=C:\Users\laszlocsomor\AppData\Roaming
    (...)
    VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
    VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
    VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
    windir=C:\WINDOWS
    
  3. open that file in your favorite editor, and add "set " to the beginning of every line, and also remove the part after = on every line. You can also use sed for this in MSYS if you like. The result will be:
    set ALLUSERSPROFILE=
    set ANDROID_HOME=
    set ANDROID_NDK_HOME=
    set APPDATA=
    (...)
    set VS110COMNTOOLS=
    set VS120COMNTOOLS=
    set VS140COMNTOOLS=
    set windir=
    
  4. Add the following commands to the file (edit the paths if you need to):
    set BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe
    set BAZEL_VC=c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC
    set PATH=c:\python27;c:\tools\msys64\usr\bin;c:\windows\system32
    set SYSTEMROOT=c:\windows
    set TEMP=c:\tempdir\temp
    set TMP=c:\tempdir\temp
    
  5. Run this script. It will unset all envvars in your cmd.exe session, and set just these 6 envvars. You can run set without any arguments to see what envvars are set.
  6. Now that all your envvars' values are ASCII-only, cd into the directory where you have your source tree. If you don't have a source tree, you can create one like this:
    md d:\projects\bazel_example\cpp
    echo workspace(name="bazel_example") > d:\projects\bazel_example\WORKSPACE
    echo. > d:\projects\bazel_example\BUILD
    echo cc_binary(name="bin", srcs=["bin.cc"]) > d:\projects\bazel_example\cpp\BUILD
    echo #include ^<stdio.h^> >d:\projects\bazel_example\cpp\bin.cc
    echo int main(int,char**){printf("hello!\n");return 0;} >>d:\projects\bazel_example\cpp\bin.cc
    
  7. Try building something:
    cd d:\projects\bazel_example
    c:\path\to\bazel-0.6.0\bazel.exe build //cpp:bin --verbose_failures
    

@laszlocsomor
Copy link
Contributor

For step 4: also set JAVA_HOME:

set BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe
(...)
set TMP=c:\tempdir\temp
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112

@KindDragon
Copy link
Author

Sorry. Nope, still crashing. Something else causing it

@KindDragon
Copy link
Author

Can you provide pdb for client.exe?

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Oct 6, 2017

pdb.zip

@KindDragon
Copy link
Author

Crash callstack:

ntdll!RtlReportCriticalFailure + 0x56
ntdll!RtlpHeapHandleError + 0x12
ntdll!RtlpLogHeapFailure + 0x96
ntdll!RtlFreeHeap + 0x88254
client!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,google::protobuf::EnumValueDescriptor const * __ptr64,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,google::protobuf::EnumValueDescriptor const * __ptr64> >,0> >::_Erase + 0xac
client!std::_Unique_ptr_base<blaze::StartupOptions,std::default_delete<blaze::StartupOptions> >::_Unique_ptr_base<blaze::StartupOptions,std::default_delete<blaze::StartupOptions> ><blaze::StartupOptions * __ptr64,std::default_delete<blaze::StartupOptions> > + 0x14
client!std::_Locinfo::_Getcvt + 0xc
client!std::numpunct<char>::_Init + 0x128
client!blaze::GetArgumentArray + 0x189
client!google::protobuf::Descriptor::DebugString + 0xfbc
KERNEL32!BaseThreadInitThunk + 0x14
ntdll!RtlUserThreadStart + 0x21

@laszlocsomor
Copy link
Contributor

related bug: #2443

@laszlocsomor
Copy link
Contributor

Acknowledging that this is a problem, I'm still dropping the priority to P3. Reason being that the rest of Bazel doesn't work well with non-ASCII paths anyway (labels for example don't support non-ASCII paths), and the Windows team doesn't have capacity to fix the rest of Bazel. I'm sad to say that I don't realistically see fixing this any time in the next few months.

@laszlocsomor laszlocsomor added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed P1 I'll work on this now. (Assignee required) labels Dec 13, 2017
@KindDragon
Copy link
Author

Thanks for issue status

@aiuto aiuto added area-Windows Windows-specific issues and feature requests and removed category: misc > misc labels Dec 10, 2018
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: bug and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) more data needed labels Feb 9, 2021
@aiuto aiuto added this to the unicode milestone Apr 20, 2021
@sgowroji sgowroji added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 17, 2023
@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) platform: windows stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

No branches or pull requests

7 participants