简体   繁体   English

无法构建gem本机扩展(Windows)

[英]Failed to build gem native extension (Windows)

I have tried to install mysql2 on windows, but it output an error: 我试图在Windows上安装mysql2,但输出错误:

Failed to build gem native extension. 无法构建gem本机扩展。

I have installed Devkit, and have tested 我已经安装了Devkit,并进行了测试

gem install json --platform=ruby

ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"

both of them work fine, but I cannot install any other gems beside json. 它们都可以正常工作,但是我不能在json旁边安装其他任何gem。

To build mysql2 gem on Windows you should use the MySQL C Connector that can be found here . 要在Windows上构建mysql2 gem,应使用可在此处找到的MySQL C连接器。 You should unzip the folder and do this in cmd/powershell: 您应该解压缩该文件夹,并在cmd / powershell中执行以下操作:

gem install mysql2 -- --with-mysql-dir={DIRECTORY OF THE CONNECTOR}

Read this for a full guide. 阅读本以获取完整指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM