https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-12-01T20:03:22ZRuby Issue Tracking SystemRuby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433032013-12-01T20:03:22Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Assignee</strong> set to <i>usa (Usaku NAKAMURA)</i></li><li><strong>Target version</strong> set to <i>2.1.0</i></li></ul> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433062013-12-01T20:23:42Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Third Party's Issue</i></li></ul><p>"This application" is not ruby.<br>
It's your compiler.<br>
Please contact the compiler's support team for more information :)</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433092013-12-01T21:57:46Zphasis68 (Heesob Park)phasis@gmail.com
<ul></ul><p>Yes, the error message is not from ruby, but from mingw compilers.<br>
And I found TMP environtment variable is the actual cause of this error.<br>
Nevertheless, I think Ruby is not entirely free from this error.</p>
<p>If I run "ruby extconf.rb" in ext/bigdecimal folder,<br>
The mkmf works as expected without error on the same environment.</p>
<p>Anyway, I leave this message for the record:<br>
If you want to build ruby from source with Mingw toolchain,<br>
the TMP environment variable should not contain non-ascii string.</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433102013-12-01T22:59:59Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Is TEMP changed by miniruby?<br>
miniruby -e "system('set TEMP')"<br>
shows the correct path?</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433112013-12-01T23:42:08Zphasis68 (Heesob Park)phasis@gmail.com
<ul></ul><p>Yes, it shows the correct path.</p>
<p>C:\work\ruby-2.1.0-r43936>miniruby.exe -e "system('set TEMP')"<br>
TEMP=C:\Users\희섭\AppData\Local\Temp</p>
<p>BTW, In Visual C++ compiler, I can see same build failure with non-ascii USERNAME environment variable.</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433122013-12-02T00:18:50Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Third Party's Issue</i> to <i>Assigned</i></li><li><strong>Backport</strong> changed from <i>1.9.3: UNKNOWN, 2.0.0: UNKNOWN</i> to <i>1.9.3: DONTNEED, 2.0.0: REQUIRED</i></li></ul><p>Ah, I see.<br>
There is a bug of handling the environment variables in miniruby.<br>
I'm debugging it now...</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433132013-12-02T00:56:00Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r43950.<br>
Heesob, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>hash.c (getenv): use ANSI codepage version of getenv() for miniruby<br>
on Windows.<br>
<a href="/issues/9189">[ruby-core:58732]</a> [Bug <a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Build failure on Windows in case of nonascii TEMP environment. (Assigned)" href="https://bugs.ruby-lang.org/issues/9189">#9189</a>] reported by phasis68 (Heesob Park).</li>
</ul> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433592013-12-02T22:34:12Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> deleted (<del><i>usa (Usaku NAKAMURA)</i></del>)</li><li><strong>Backport</strong> changed from <i>1.9.3: DONTNEED, 2.0.0: REQUIRED</i> to <i>1.9.3: REQUIRED, 2.0.0: REQUIRED</i></li></ul><p>r43950 (and r43958) is only a workaround.<br>
We have to change the entire implementation of ENV to treat encoding.</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=433602013-12-02T22:34:33Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>1.9.3: REQUIRED, 2.0.0: REQUIRED</i> to <i>1.9.3: DONTNEED, 2.0.0: REQUIRED</i></li></ul> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=448122014-01-30T06:17:25Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Target version</strong> changed from <i>2.1.0</i> to <i>2.2.0</i></li></ul> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=463652014-04-29T13:27:58Zphasis68 (Heesob Park)phasis@gmail.com
<ul></ul><p>I still failed to build trunk.</p>
<pre><code>C:\work\ruby-2.2.0-r45738>nmake
...
generating psych-x64-mswin64_120.def
compiling psych.c
psych.c
compiling psych_emitter.c
psych_emitter.c
compiling psych_parser.c
psych_parser.c
compiling psych_to_ruby.c
psych_to_ruby.c
compiling psych_yaml_tree.c
psych_yaml_tree.c
compiling ../.././ext/psych/yaml/api.c
api.c
../.././ext/psych/yaml/api.c(10) : error C2491: 'yaml_get_version_string' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(11) : error C2065: 'YAML_VERSION_STRING' : undeclared identifier
../.././ext/psych/yaml/api.c(11) : warning C4047: 'return' : 'const char *' differs in levels of indirection from 'int'
../.././ext/psych/yaml/api.c(20) : error C2491: 'yaml_get_version' : definitionof dllimport function not allowed
../.././ext/psych/yaml/api.c(21) : error C2065: 'YAML_VERSION_MAJOR' : undeclared identifier
../.././ext/psych/yaml/api.c(22) : error C2065: 'YAML_VERSION_MINOR' : undeclared identifier
../.././ext/psych/yaml/api.c(23) : error C2065: 'YAML_VERSION_PATCH' : undeclared identifier
../.././ext/psych/yaml/api.c(32) : error C2491: 'yaml_malloc' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(42) : error C2491: 'yaml_realloc' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(52) : error C2491: 'yaml_free' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(62) : error C2491: 'yaml_strdup' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(76) : error C2491: 'yaml_string_extend' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(98) : error C2491: 'yaml_string_join' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(119) : error C2491: 'yaml_stack_extend' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(137) : error C2491: 'yaml_queue_extend' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(172) : error C2491: 'yaml_parser_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(215) : error C2491: 'yaml_parser_delete' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(285) : error C2491: 'yaml_parser_set_input_string': definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(304) : error C2491: 'yaml_parser_set_input_file' :definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(322) : error C2491: 'yaml_parser_set_input' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(337) : error C2491: 'yaml_parser_set_encoding' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(350) : error C2491: 'yaml_emitter_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(387) : error C2491: 'yaml_emitter_delete' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(453) : error C2491: 'yaml_emitter_set_output_string' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(473) : error C2491: 'yaml_emitter_set_output_file': definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(491) : error C2491: 'yaml_emitter_set_output' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(506) : error C2491: 'yaml_emitter_set_encoding' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(519) : error C2491: 'yaml_emitter_set_canonical' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(531) : error C2491: 'yaml_emitter_set_indent' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(543) : error C2491: 'yaml_emitter_set_width' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(555) : error C2491: 'yaml_emitter_set_unicode' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(567) : error C2491: 'yaml_emitter_set_break' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(579) : error C2491: 'yaml_token_delete' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(665) : error C2491: 'yaml_stream_start_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(681) : error C2491: 'yaml_stream_end_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(701) : error C2491: 'yaml_document_start_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(776) : error C2491: 'yaml_document_end_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(792) : error C2491: 'yaml_alias_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(820) : error C2491: 'yaml_scalar_event_initialize': definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(876) : error C2491: 'yaml_sequence_start_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(913) : error C2491: 'yaml_sequence_end_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(931) : error C2491: 'yaml_mapping_start_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(968) : error C2491: 'yaml_mapping_end_event_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(984) : error C2491: 'yaml_event_delete' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1039) : error C2491: 'yaml_document_initialize' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1122) : error C2491: 'yaml_document_delete' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1169) : error C2491: 'yaml_document_get_node' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1184) : error C2491: 'yaml_document_get_root_node' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1201) : error C2491: 'yaml_document_add_scalar' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1259) : error C2491: 'yaml_document_add_sequence' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1309) : error C2491: 'yaml_document_add_mapping' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1359) : error C2491: 'yaml_document_append_sequence_item' : definition of dllimport function not allowed
../.././ext/psych/yaml/api.c(1387) : error C2491: 'yaml_document_append_mapping_pair' : definition of dllimport function not allowed
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
</code></pre>
<p>Here is a patch.</p>
<pre><code>diff --git a/hash.c b/hash.c
index c3a06e5..64c4057 100644
--- a/hash.c
+++ b/hash.c
@@ -2740,7 +2740,13 @@ ruby_setenv(const char *name, const char *value)
else {
buf = rb_sprintf("%s=", name);
}
- failed = putenv(RSTRING_PTR(buf));
+ if(rb_locale_encindex()==ENCINDEX_ASCII) {
+ WCHAR *wbuf = rb_w32_mbstr_to_wstr(CP_UTF8, RSTRING_PTR(buf), -1, NULL);
+ failed = _wputenv(wbuf);
+ free(wbuf);
+ } else {
+ failed = putenv(RSTRING_PTR(buf));
+ }
/* even if putenv() failed, clean up and try to delete the
* variable from the system area. */
rb_str_resize(buf, 0);
</code></pre> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=692532018-01-05T21:00:25Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.2.0</i></del>)</li></ul> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=1053112023-11-13T20:11:27Zpcai (Peter Cai)
<ul></ul><p>I'm unable to reproduce. Windows presents an ascii-safe alias of the TEMP folder for me so I can't seem to test the handling:</p>
<ul>
<li>windows 11 (Version 10.0.22621 Build 22621)</li>
<li>Ruby+Devkit 3.2.2-1 (x64)</li>
</ul>
<pre><code>C:\work>ruby -e "system('set TEMP')"
TEMP=C:\Users\6863~1\tmp
C:\work>set TEMP
TEMP=C:\Users\6863~1\tmp
C:\work>cd C:\Users\희섭\tmp
C:\Users\희섭\tmp>echo %cd%
C:\Users\희섭\tmp
C:\Users\희섭\tmp>ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]
</code></pre>
<p>Can anyone describe an environment that can reproduce?</p> Ruby master - Bug #9189: Build failure on Windows in case of nonascii TEMP environment.https://bugs.ruby-lang.org/issues/9189?journal_id=1054282023-11-28T06:27:32Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Backport</strong> changed from <i>1.9.3: DONTNEED, 2.0.0: REQUIRED</i> to <i>3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN</i></li></ul><p>pcai (Peter Cai) wrote in <a href="#note-13">#note-13</a>:</p>
<blockquote>
<p>I'm unable to reproduce. Windows presents an ascii-safe alias of the TEMP folder for me so I can't seem to test the handling:</p>
</blockquote>
<p>Thank you for testing.<br>
Does it work after <code>set TEMP=C:\Users\희섭\tmp</code>?</p>