首先,我为我糟糕的英语感到抱歉。
我正在尝试通过Windows Subsystem for Linux在Windows10上安装Ruby2.3.0到我的rbenv系统上。我按照this的说明操作(但不是100% )。但是每次我尝试用这个日志构建Ruby都失败了。
check struct members..
check libraries....
Use ActiveTcl libraries (if available).
Search tclConfig.sh and tkConfig.sh..............................
Fail to find [tclConfig.sh, tkConfig.sh]
Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on tkConfig.sh).
Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.
Can't find X11 libraries.
So, can't make tcltklib.so which is required by Ruby/Tk.
Failed to configure tk. It will not be installed.
Failed to configure tk/tkutil. It will not be installed.
configuring zlib
make[1]: Entering directory `/tmp/ruby-build.20160522033606.7696/ruby-2.3.1'
make -C ext/digest/sha2 -w --jobserver-fds=6,7 -j V= realclean
make[2]: Entering directory `/tmp/ruby-build.20160522033606.7696/ruby-2.3.1/ext/digest/sha2'
Makefile:39: *** missing separator. Stop.
make[2]: Leaving directory `/tmp/ruby-build.20160522033606.7696/ruby-2.3.1/ext/digest/sha2'
make[1]: *** [ext/digest/sha2/realclean] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20160522033606.7696/ruby-2.3.1'
make: *** [build-ext] Error 2这是我安装的软件包列表
libx11-data/trusty,now 2:1.6.2-1ubuntu2 all [installed]
libx11-dev/trusty,now 2:1.6.2-1ubuntu2 amd64 [installed]
libx11-doc/trusty,now 2:1.6.2-1ubuntu2 all [installed,automatic]
libx11-xcb1/trusty,now 2:1.6.2-1ubuntu2 amd64 [installed,automatic]
libtk8.4/trusty,now 8.4.20-7 amd64 [installed,automatic]
libtcl8.4/trusty,now 8.4.20-7 amd64 [installed,automatic]如你所见,我安装了X11,tcl,tk,但是我的系统无法检测到它们。我做错了吗?或者这只是一个bug?
任何帮助都将不胜感激。感谢您的阅读。
发布于 2016-08-12 12:05:01
我的安装遵循本教程,转到那里获取最新的更新:link here。
Ruby1.安装
首先是Ruby的一些依赖项:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-devRuby:有3种安装方式,每种方式都相互冲突,所以选择你认为最适合自己的或者我的建议:rbenv
使用rbenv的(推荐)
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v使用 rvm的
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.3.1
rvm use 2.3.1 --default
ruby -v来自源的
cd
wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar -xzvf ruby-2.3.1.tar.gz
cd ruby-2.3.1/
./configure
make
sudo make install
ruby -v安装Ruby后,安装Bundler
gem install bundler2.安装Rails
首先,您需要NodeJS:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs然后安装rails:
gem install rails -v 4.2.6如果您使用的是rbenv,则需要运行以下命令以使rails可执行文件可用:
rbenv rehash既然已经安装了Rails,就可以运行rails -v命令来确保一切都安装正确了:
rails -v
# Rails 4.2.63.安装DB
MySQL:
您可以从Ubuntu存储库中的包安装MySQL服务器和客户端。作为安装过程的一部分,您将设置root用户的密码。这些信息将在将来进入你的Rails应用的database.yml文件中。
sudo apt-get install mysql-server mysql-client libmysqlclient-devPostgreSQL:
目前,一些bug阻止你正确安装Postgres,所以我建议你现在使用MySQL。
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-devPostgres安装不会为您设置用户,因此您需要遵循以下步骤来创建具有创建数据库权限的用户。请随意将chris替换为您的用户名。
sudo -u postgres createuser chris -s
# If you would like to set a password for the user, you can do the following
sudo -u postgres psql
postgres=# \password chris最后几步
现在要确保一切顺利进行,而不是向左
#### If you want to use SQLite (not recommended)
rails new myapp
#### If you want to use MySQL
rails new myapp -d mysql
#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql
# Move into the application directory
cd myapp
# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified
# Create the database
rake db:create
rails server发布于 2017-05-17 23:12:02
确保您已经更新了Windows安装-运行'Windows 10 Upgrade Assistant‘并安装Windows 10创建者更新。在此之前的任何东西都充满了错误,并且我的rbenv Rails安装将无法工作。如果在将Windows更新到CU之后它仍然不能工作,那么你可以直接使用rvm。无论如何,您可能需要重新安装所有内容,因为如果您使用的是WSL,建议重新安装/升级Ubuntu。
https://stackoverflow.com/questions/37405528
复制相似问题