okiami1983のブログ

クオリティーが低い記事はあとで書き直します。。

SQLite3のインストール失敗。(ログイン名が日本語だとダメ)→TEMPファイル設定を変更

Railsのインストール途中でSQLite3のインストールに失敗。

ログを調べたら、日本語のログイン名のせいでコンパイルが失敗している!

 

f:id:okiami1983:20190915081722p:plain

 

対処方法

↓ここを参考に、TEMPディレクトリを変更することで回避できました。

www.atmarkit.co.jp

 

原因のログなどは↓に。

 

↓ ターミナルの表示はこんな感じになっていました(ユーザー名:漢字)


C:\Users\漢字>gem install sqlite3 --platform=ruby
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1/ext/sqlite3
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20190914-6432-1hkdiqe.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby26-x64/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
from extconf.rb:35:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1 for inspection.
Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.1/gem_make.out

C:\Users\漢字>

 

 

↓プリーズチェックと言われているログの中身はこちら。

日本語名が????となっている。

コンパイルの作業フォルダとして、ユーザーごとの作業フォルダが使われている。ユーザー名が日本語だと、フォルダを認識できないようだ。。。

"pkg-config --exists sqlite3"
| pkg-config --libs sqlite3
=> "-LC:/Ruby26-x64/msys64/mingw64/lib -lsqlite3\n"
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -IC:/Ruby26-x64/include/ruby-2.6.0/ruby/backward -IC:/Ruby26-x64/include/ruby-2.6.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math conftest.c -L. -LC:/Ruby26-x64/lib -L. -pipe -s -lx64-msvcrt-ruby260 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
Cannot create temporary file in C:\Users\????\AppData\Local\Temp\: Invalid argument
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */