Windows Server 2016下安装fcgi gem失败求助
安装FCGI Gem时遇到编译错误
环境
- Windows Server 2016
- Apache 2.4
- Ruby 3.0.6(含webkit)
- Rails 7.0.4.3
问题
执行命令 gem install fcgi 时出现编译错误,核心提示找不到fcgiapp.h文件,完整错误日志如下:
C:\Apache24\htdocs\redmine-5.0.5>gem install fcgi Building native extensions. This could take a while... ERROR: Error installing fcgi: ERROR: Failed to build gem native extension. current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fcgi-0.9.2.2/ext/fcgi C:/Ruby30-x64/bin/ruby.exe extconf.rb checking for fcgiapp.h... no checking for fastcgi/fcgiapp.h... no current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fcgi-0.9.2.2/ext/fcgi make DESTDIR\= sitearchdir\=./.gem.20230518-6868-obubmv sitelibdir\=./.gem.20230518-6868-obubmv clean make: *** No hay ninguna regla para construir el objetivo 'clean'. Alto. current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fcgi-0.9.2.2/ext/fcgi make DESTDIR\= sitearchdir\=./.gem.20230518-6868-obubmv sitelibdir\=./.gem.20230518-6868-obubmv make: *** No hay objetivos. Alto. make failed, exit code 2 Gem files will remain installed in C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fcgi-0.9.2.2 for inspection. Results logged to C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/fcgi-0.9.2.2/gem_make.out
已尝试操作
- 安装不同版本的fcgi gem,错误情况一致
- 将
fcgiapp.h单独放入C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fcgi-0.9.2.2/ext/fcgi路径,无效果
解决方法
安装完整FastCGI开发库
仅复制单个头文件无法满足编译需求,需下载对应Windows x64版本的FastCGI SDK,解压后将包含fcgiapp.h的include目录添加到系统环境变量INCLUDE,同时把库文件所在的lib目录添加到LIB环境变量。手动指定路径安装
若已安装FastCGI库,执行安装命令时直接指定头文件和库文件路径:gem install fcgi -- --with-fcgi-include=你的FastCGI/include路径 --with-fcgi-lib=你的FastCGI/lib路径检查编译工具链
确认Ruby配套的MinGW编译工具完整(比如RubyInstaller安装时勾选了开发工具组件),make命令报错也可能是缺少必要的编译依赖。尝试替代部署方案
若fcgi gem在Windows下编译始终受阻,可考虑用Passenger或Puma替代FastCGI运行Redmine,这两种部署方式在Windows环境下兼容性更稳定。
内容的提问来源于stack exchange,提问作者Tomas
相关产品推荐
相关产品推荐

